12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using JLHHJSvr.BLL;
- using JLHHJSvr.Com;
- using JLHHJSvr.DBA.DBModle;
- using LJLib.Net.SPI.Server;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class SetOptionExcutor : ExcutorBase<SetOptionRequest, SetOptionResponse>
- {
- protected override void ExcuteInternal(SetOptionRequest request, object state, SetOptionResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (request.optionInfo.optionid == null || request.optionInfo.optionid == 0)
- {
- rslt.ErrMsg = "信息缺失:ID";
- return;
- }
- if (request.optionInfo.optionvalue == null)
- {
- rslt.ErrMsg = "信息缺失:值";
- return;
- }
- using (var con = new SqlConnection(GlobalVar.ConnectionString))
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- using (cmd.Transaction = con.BeginTransaction())
- {
- try
- {
- var stOption = new st_option();
- stOption.SetValue(cmd, request.optionInfo.optionid.Value, request.optionInfo.optionvalue,
- tokendata.username);
- cmd.Transaction.Commit();
- }
- catch (Exception e)
- {
- cmd.Transaction.Rollback();
- rslt.ErrMsg = e.ToString();
- return;
- }
- }
- }
- }
- }
- }
|