public static bool TryCallWCFFunc(string OPNameStr, ReqeFunStruct requestObj, out RespFunStruct responseObj)
       {
           UserIDOP userOP = new UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = OPNameStr };
           requestObj.userIDOP = userOP;
           requestObj.PCClientCookieStr = GlobalStaticObj.CookieStr;
           RespFunStruct returnObj = new RespFunStruct();
           string requestStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(requestObj));
           if (!WCFClientProxy.TestPCClientProxy())
           {
               returnObj.IsSuccess = "0";
               returnObj.ReturnObject = "未能建立同服务器连接";
               responseObj = returnObj;
               MessageBox.Show("未能建立同服务器连接!");
               return false;
           }
           try
           {
               string ResultStr = GlobalStaticObj.proxy.JsonOperate(requestStr);
               string Str = HXCCommon.DotNetEncrypt.DESEncrypt.Decrypt(ResultStr);
               responseObj = JsonConvert.DeserializeObject<RespFunStruct>(Str);
               return true;
           }
           catch (Exception ex)
           {
               returnObj.IsSuccess = "0";
               returnObj.ReturnObject = "发生错误";
               returnObj.Msg = ex.Message;
               responseObj = returnObj;
               MessageBox.Show("发生错误!");
               return false;
           }

       }
 public static RespFunStruct ExtBaseFuncCall(ReqeFunStruct reqeObj)
 {
     RespFunStruct resp = new RespFunStruct();
     bool result = false;
     UserIDOP userID = reqeObj.userIDOP;
     switch (reqeObj.FunName)
     {
         case ComFunCallEnum.LogFunctionCall:
             UserFunctionOPLog add = JsonConvert.DeserializeObject<UserFunctionOPLog>(reqeObj.FunObject.ToString());
             try
             {
                 add.acc_code = reqeObj.AccCode;
                 result = BLL.OPLog.Add(add, GlobalStaticObj_Server.DbPrefix + reqeObj.AccCode);
                 resp.IsSuccess = "1";
                 resp.ReturnObject = result.ToString();
             }
             catch (Exception ex)
             {
                 resp.IsSuccess = "0";
                 resp.Msg = "ComFunCallEnum.LogFunctionCall error";
                 ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.LogFunctionCall;Add对象JSON字串描述:" + reqeObj.FunObject.ToString());
                 throw ex;
             }
             break;
     }
     return resp;
 }
Exemple #3
0
 /// <summary> 系统登出
 /// </summary>
 /// <param name="opName">操作名称</param>
 /// <param name="uid">用户id</param>
 /// <returns>返回错误信息</returns>
 public static string LoginOutput(string opName, string uid)
 {
     if (!WCFClientProxy.TestDataProxy())
     {
         return "未能建立同服务器连接";
     }
     ReqeFunStruct UserO = new ReqeFunStruct();
     /* 此处注意填入实际的当前用户ID */
     UserO.userIDOP = new UserIDOP() { OPName = opName, UserID = uid };
     UserO.AccCode = GlobalStaticObj.CurrAccCode;
     string Str = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(UserO));
     GlobalStaticObj.proxy.LoginOut(Str);
     if (GlobalStaticObj.channelFactory.State != CommunicationState.Opened)
     {
         GlobalStaticObj.proxy = null;
         GlobalStaticObj.channelFactory.Close();
         GlobalStaticObj.channelFactory = null;
     }
     return "";
 }
        public static RespFunStruct ComFunCall(ReqeFunStruct reqeObj)
        {
            RespFunStruct resp = new RespFunStruct();
            bool result = false;
            int exeCount = 0;
            UserIDOP userID = reqeObj.userIDOP;
            switch (reqeObj.FunName)
            {
                //根据主键值,单表添加或者更新,给定主键为Update,缺失为Insert操作                    
                case ComFunCallEnum.Submit_AddOrEdit:
                    Submit_AddOrEdit add = JsonConvert.DeserializeObject<Submit_AddOrEdit>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.Submit_AddOrEdit(connString, add.TableName, add.pkName, add.pkVal, (Dictionary<string, string>)add.DicParam, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "Submit_AddOrEdit error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.Submit_AddOrEdit;Submit_AddOrEdit对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据主键值,单表删除单记录
                case ComFunCallEnum.DeleteDataByID:
                    DeleteDataByID del = JsonConvert.DeserializeObject<DeleteDataByID>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.DeleteDataByID(connString, del.TableName, del.pkName, del.pkVal, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "DeleteDataByID  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.DeleteDataByID;DeleteDataByID对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据主键值,单表删除多记录,In操作
                case ComFunCallEnum.BatchDeleteDataByIn:
                    BatchDeleteDataByIn delBat = JsonConvert.DeserializeObject<BatchDeleteDataByIn>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchDeleteDataByIn(connString, delBat.TableName, delBat.pkName, delBat.pkValues, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchDeleteDataByIn  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchDeleteDataByIn;BatchDeleteDataByIn对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据Where条件,单表删除多记录
                case ComFunCallEnum.BatchDeleteDataByWhere:
                    BatchDeleteDataByWhere delWhere = JsonConvert.DeserializeObject<BatchDeleteDataByWhere>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchDeleteDataByWhere(connString, delWhere.TableName, delWhere.whereString, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchDeleteDataByWhere  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchDeleteDataByWhere;BatchDeleteDataByWhere对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据主键值,单表更新多记录,In操作
                case ComFunCallEnum.BatchUpdateDataByIn:
                    BatchUpdateDataByIn updaByIn = JsonConvert.DeserializeObject<BatchUpdateDataByIn>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchUpdateDataByIn(connString, updaByIn.TableName, (Dictionary<string, string>)updaByIn.DicParam, updaByIn.pkName, updaByIn.pkValues, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchUpdateDataByIn  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchUpdateDataByIn;BatchUpdateDataByIn对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                // 根据Where条件,单表更新多记录
                case ComFunCallEnum.BatchUpdateDataByWhere:
                    BatchUpdateDataByWhere updaByWhere = JsonConvert.DeserializeObject<BatchUpdateDataByWhere>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchUpdateDataByWhere(connString, updaByWhere.TableName, (Dictionary<string, string>)updaByWhere.DicParam, updaByWhere.whereString, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchUpdateDataByWhere  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchUpdateDataByWhere;BatchUpdateDataByWhere对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                // 批处理更新操作,普通型
                case ComFunCallEnum.BatchUpdateDataMulti:
                    BatchUpdateDataMulti updaMulti = JsonConvert.DeserializeObject<BatchUpdateDataMulti>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchUpdateDataMulti(connString, updaMulti.batUpdateList, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchUpdateDataMulti  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchUpdateDataMulti;BatchUpdateDataMulti对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                // 批处理更新操作,事务型
                case ComFunCallEnum.BatchUpdateDataMultiByTrans:
                    BatchUpdateDataMultiByTrans updaMultiByTrans = JsonConvert.DeserializeObject<BatchUpdateDataMultiByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.BatchUpdateDataMultiByTrans(connString, updaMultiByTrans.batUpdateList, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchUpdateDataMultiByTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchUpdateDataMultiByTrans;BatchUpdateDataMultiByTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,多次执行多条语句,多参数多次添加)多条语句,返回bool;参数为SQLObj.
                case ComFunCallEnum.BatchExeSQLMultiByTrans:
                    BatchExeSQLMultiByTrans BatchExeSQLMultiByTrans = JsonConvert.DeserializeObject<BatchExeSQLMultiByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.BatchExeSQLMultiByTrans(connString, BatchExeSQLMultiByTrans.batSQLObjList, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchExeSQLMultiByTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchExeSQLMultiByTrans;BatchExeSQLMultiByTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,多次执行多条语句,多参数多次添加)多条语句,返回bool;参数为SQLString.
                case ComFunCallEnum.BatchExeSQLStringMultiByTrans:
                    BatchExeSQLStringMultiByTrans BatchExeSQLStringMultiByTrans = JsonConvert.DeserializeObject<BatchExeSQLStringMultiByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.BatchExeSQLMultiByTrans(connString, BatchExeSQLStringMultiByTrans.batSQLStringList, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchExeSQLMultiByTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchExeSQLStringMultiByTrans;BatchExeSQLStringMultiByTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,一次执行多条语句,多参数一次添加)多条语句,返回bool
                case ComFunCallEnum.ExecuteNonQueryReturnBoolByTrans:
                    ExecuteNonQueryReturnBoolByTrans ExeSQLMultiByTrans = JsonConvert.DeserializeObject<ExecuteNonQueryReturnBoolByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.ExecuteNonQueryReturnBoolByTrans(connString, ExeSQLMultiByTrans.sqlObj.cmdType, ExeSQLMultiByTrans.sqlObj.sqlString, ExeSQLMultiByTrans.sqlObj.Param, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "ExecuteNonQueryReturnBoolByTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.ExecuteNonQueryReturnBoolByTrans;ExecuteNonQueryReturnBoolByTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,多次执行多条语句,没有参数)多条语句带事务(无备份操作记录功能,无SQL日志操作记录功能),返回带事务的bool执行结果
                case ComFunCallEnum.BatchExeSQLStrMultiByTransNoLogNoBackup:
                    BatchExeSQLStringMultiByTrans BatchExeSQLStringMultiByTransNoLog = JsonConvert.DeserializeObject<BatchExeSQLStringMultiByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.BatchExeSQLStrMultiByTransNoLogNoBackup(connString, BatchExeSQLStringMultiByTransNoLog.batSQLStringList, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "BatchExeSQLStrMultiByTransNoLogNoBackup  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.BatchExeSQLStrMultiByTransNoLogNoBackup;BatchExeSQLStringMultiByTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,一次执行多条语句)多条语句(不带事务),返回bool。
                case ComFunCallEnum.ExecuteNonQueryReturnBoolNoTrans:
                    ExecuteNonQueryReturnBoolByTrans ExeSQLReturnBoolNoTrans = JsonConvert.DeserializeObject<ExecuteNonQueryReturnBoolByTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.ExecuteNonQueryReturnBoolNoTrans(connString, ExeSQLReturnBoolNoTrans.sqlObj.cmdType, ExeSQLReturnBoolNoTrans.sqlObj.sqlString, ExeSQLReturnBoolNoTrans.sqlObj.Param, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "ExecuteNonQueryReturnBoolNoTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.ExecuteNonQueryReturnBoolNoTrans;ExecuteNonQueryReturnBoolNoTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,一次执行多条语句)多条语句(不带事务),返回影响行数Int。
                case ComFunCallEnum.ExecuteNonQueryReturnIntNoTrans:
                    ExecuteNonQueryReturnIntNoTrans ExeSQLReturnIntNoTrans = JsonConvert.DeserializeObject<ExecuteNonQueryReturnIntNoTrans>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        exeCount = BLL.DbCommon.Instance.ExecuteNonQueryReturnIntNoTrans(connString, ExeSQLReturnIntNoTrans.sqlObj.cmdType, ExeSQLReturnIntNoTrans.sqlObj.sqlString, ExeSQLReturnIntNoTrans.sqlObj.Param, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = exeCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "ExecuteNonQueryReturnIntNoTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.ExecuteNonQueryReturnIntNoTrans;ExecuteNonQueryReturnIntNoTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,一次执行多条语句)多条语句(不带事务),返回Object。
                case ComFunCallEnum.ExecuteNonQueryReturnObjectNoTrans:
                    ExecuteNonQueryReturnDataSetNoTrans ExeSQLReturnObjNoTrans = JsonConvert.DeserializeObject<ExecuteNonQueryReturnDataSetNoTrans>(reqeObj.FunObject.ToString());
                    Object obj;
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        obj = BLL.DbCommon.Instance.ExecuteNonQueryReturnObjectNoTrans(connString, ExeSQLReturnObjNoTrans.sqlObj.cmdType, ExeSQLReturnObjNoTrans.sqlObj.sqlString, ExeSQLReturnObjNoTrans.sqlObj.Param, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = obj == null ? "" : obj.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "ExecuteNonQueryReturnObjectNoTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.ExecuteNonQueryReturnObjectNoTrans;ExecuteNonQueryReturnObjectNoTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //一次执行(一次连接,一次执行多条语句)多条语句(不带事务),返回DataSet。
                case ComFunCallEnum.ExecuteNonQueryReturnDataSetNoTrans:
                    ExecuteNonQueryReturnDataSetNoTrans ExeSQLReturnDSNoTrans = JsonConvert.DeserializeObject<ExecuteNonQueryReturnDataSetNoTrans>(reqeObj.FunObject.ToString());
                    DataSet ds = new DataSet();
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringReadonly);
                        ds = BLL.DbCommon.Instance.ExecuteNonQueryReturnDataSetNoTrans(connString, ExeSQLReturnDSNoTrans.sqlObj.cmdType, ExeSQLReturnDSNoTrans.sqlObj.sqlString, ExeSQLReturnDSNoTrans.sqlObj.Param, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = JsonConvert.SerializeObject(ds);
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "ExecuteNonQueryReturnDataSetNoTrans  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.ExecuteNonQueryReturnDataSetNoTrans;ExecuteNonQueryReturnDataSetNoTrans对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据查询条件,查单表,重点是Where条件,拼接SQL
                case ComFunCallEnum.SelOPSingleTable:
                    SelOPSingleTable selOpSingTable = JsonConvert.DeserializeObject<SelOPSingleTable>(reqeObj.FunObject.ToString());
                    DataSet ds1 = new DataSet();
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringReadonly);
                        ds1 = BLL.DbCommon.Instance.SelOPSingleTable(connString, selOpSingTable.Fields, selOpSingTable.TableName, selOpSingTable.whereString, selOpSingTable.AdditionalConditions, userID);
                        //var jSetting = new JsonSerializerSettings();
                        //jSetting.NullValueHandling = NullValueHandling.Include;
                        //jSetting.DefaultValueHandling = DefaultValueHandling.Include;
                        //jSetting.MissingMemberHandling = MissingMemberHandling.Error;
                        resp.IsSuccess = "1";
                        resp.ReturnObject = JsonConvert.SerializeObject(ds1);
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "SelOPSingleTable error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.SelOPSingleTable;SelOPSingleTable对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据查询条件,查单表,查前几条,重点是Where条件,拼接SQL
                case ComFunCallEnum.SelTopOPSingleTable:
                    SelTopOPSingleTable selTopOpSingTable = JsonConvert.DeserializeObject<SelTopOPSingleTable>(reqeObj.FunObject.ToString());
                    DataSet ds2 = new DataSet();
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringReadonly);
                        ds2 = BLL.DbCommon.Instance.SelTopOPSingleTable(connString, selTopOpSingTable.TopNum, selTopOpSingTable.Fields, selTopOpSingTable.TableName, selTopOpSingTable.whereString, selTopOpSingTable.AdditionalConditions, userID);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = JsonConvert.SerializeObject(ds2);
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "SelTopOPSingleTable  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.SelTopOPSingleTable;SelTopOPSingleTable对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                //根据通用的分页存储过程,分页查询GetListPageStoreProcedure(page, pageSize, tableSource, whereValue, OrderExpression, Fields, ref Counts);   
                case ComFunCallEnum.SelOPByStoreProcePage:
                    SelOPByStoreProcePage selOpBySPPage = JsonConvert.DeserializeObject<SelOPByStoreProcePage>(reqeObj.FunObject.ToString());
                    DataSet ds3 = new DataSet();
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringReadonly);
                        ds3 = BLL.DbCommon.Instance.GetListPageStoreProcedure(connString, selOpBySPPage.PageIndex, selOpBySPPage.PageSize, selOpBySPPage.TableSource, selOpBySPPage.whereString, selOpBySPPage.OrderExpression, selOpBySPPage.Fields, userID, ref exeCount);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = JsonConvert.SerializeObject(ds3);
                        resp.RecordCount = exeCount;
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "SelOPByStoreProcePage  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.SelOPByStoreProcePage;SelOPByStoreProcePage对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;
                /// <summary>
                /// SQLBulk方式操作带事务,无日志记录,无操作备份
                /// </summary>
                /// <param name="connStr">数据库连接串</param>
                /// <param name="tableName">表名</param>
                /// <param name="listRow">DataRowList集合</param>
                /// <returns>SQLBulk批处理方式操作带事务,执行结果。全部成功,返回Bool True; 否则,返回False。</returns>
                case ComFunCallEnum.SqlBulkByTransNoLogNoBackUp:
                    SqlBulkByTransNoLogNoBackUp SqlBulkNoLogNoBackUp = JsonConvert.DeserializeObject<SqlBulkByTransNoLogNoBackUp>(reqeObj.FunObject.ToString());
                    try
                    {
                        string connString = LocalVariable.GetConnString(GlobalStaticObj_Server.Instance.CurrAccDbName, ConfigConst.ConnectionStringWrite);
                        result = BLL.DbCommon.Instance.SqlBulkByTransNoLogNoBackUp(connString, SqlBulkNoLogNoBackUp.tableName, SqlBulkNoLogNoBackUp.listRow);
                        resp.IsSuccess = "1";
                        resp.ReturnObject = result.ToString();
                    }
                    catch (Exception ex)
                    {
                        resp.IsSuccess = "0";
                        resp.Msg = "SqlBulkByTransNoLogNoBackUp  error:" + ex.Message;
                        ex.Data.Add("UserCustomDefinitionMsg", "准确点错误描述:ComFunCallEnum.SqlBulkByTransNoLogNoBackUp;SqlBulkByTransNoLogNoBackUp对象JSON字串描述:" + reqeObj.FunObject.ToString());
                        throw ex;
                    }
                    break;

            }
            exeCount = 0;
            return resp;
        }
Exemple #5
0
        /// <summary> 查询表
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="accCode">帐套代码</param>
        /// <param name="obj">操作sql对象</param>
        /// <returns></returns>
        public static DataSet GetDataSet(string opName, string accCode, SQLObj obj)
        {
            ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
            reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
            reqeFunStruct.FunName = ComFunCallEnum.ExecuteNonQueryReturnDataSetNoTrans;
            reqeFunStruct.AccCode = accCode;
            ExecuteNonQueryReturnDataSetNoTrans ExeSQLReturnDSNoTrans = new ExecuteNonQueryReturnDataSetNoTrans();
            ExeSQLReturnDSNoTrans.ReadOnlyFlag = true;
            ExeSQLReturnDSNoTrans.sqlObj = obj;
            reqeFunStruct.FunObject = ExeSQLReturnDSNoTrans;
            reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
            reqeFunStruct.userIDOP.OPName = opName;
            reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

            var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
            var respO = JsonOperate(addStr);
            if (respO.IsSuccess == "0")
            {
                return null;
            }
            DataSet ds = JsonConvert.DeserializeObject<DataSet>(respO.ReturnObject);
            return ds;
        }
Exemple #6
0
        /// <summary> 根据查询条件,查单表,重点是Where条件,拼接SQL
        /// <param name="opName">操作名</param>
        /// <param name="accCode">帐套代码</param>
        /// <param name="tableName">表名</param>
        /// <param name="fileds">查询字段</param>
        /// <param name="where">查询条件,不包含where</param>
        /// <param name="groupBy">分组字段,多个以“,”分割</param>
        /// <param name="orderBy">排序字段+排序方式,多个以“,”分割</param>
        /// </summary>
        /// <returns>返回结果集</returns>
        public static DataTable GetTable(string opName, string accCode, string tableName, string fileds, string where, string groupBy, string orderBy)
        {
            try
            {
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.SelOPSingleTable;
                reqeFunStruct.AccCode = accCode;
                SelOPSingleTable selOPSingleTable = new SelOPSingleTable();
                selOPSingleTable.TableName = string.Format("{0}", tableName);
                selOPSingleTable.whereString = where;
                string[] fieldArr = Regex.Split(fileds, ",", RegexOptions.IgnorePatternWhitespace);
                List<string> listField = new List<string>();
                foreach (string str in fieldArr)
                {
                    listField.Add(str);
                }
                selOPSingleTable.Fields = listField;
                selOPSingleTable.AdditionalConditions = orderBy;
                reqeFunStruct.FunObject = selOPSingleTable;
                reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                var respO = JsonOperate(addStr);
                if (respO.IsSuccess == "0")
                {
                    //JsonOperateLogService.WriteLog(respO.Msg);
                    return null;
                }
                DataSet ds = JsonConvert.DeserializeObject<DataSet>(respO.ReturnObject);
                if (ds == null || ds.Tables.Count == 0)
                {
                    throw new Exception("查询异常:数据表不存在!");
                }
                return ds.Tables[0];
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                return null;
            }
        }
Exemple #7
0
 /// <summary> 删除 BYID
 /// </summary>
 /// <param name="opName">操作名</param>
 /// <param name="accCode">帐套代码</param>
 /// <param name="tableName">表名</param>
 /// <param name="keyName">键名称</param>
 /// <param name="keyValue">键值</param>
 /// <returns></returns>
 public static bool DeleteDataByID(string opName, string accCode, string tableName, string keyName, string keyValue)
 {
     ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
     reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
     reqeFunStruct.FunName = ComFunCallEnum.DeleteDataByID;
     reqeFunStruct.AccCode = accCode;
     DeleteDataByID DeleteDataByID = new DeleteDataByID();
     DeleteDataByID.TableName = string.Format("{0}", tableName);
     DeleteDataByID.pkName = keyName;//默认第一个
     DeleteDataByID.pkVal = keyValue;
     reqeFunStruct.FunObject = DeleteDataByID;
     UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = opName };
     reqeFunStruct.userIDOP = userOp;
     reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;
     var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
     var respO = JsonOperate(addStr);
     if (respO.IsSuccess == "0")
     {
         return false;
     }
     return bool.Parse(respO.ReturnObject);
 }
Exemple #8
0
 /// <summary> 新增或更新
 /// </summary>
 /// <param name="opName">操作名</param>
 /// <param name="accCode">帐套代码</param>
 /// <param name="tableName">表名</param>
 /// <param name="keyName">主键名称</param>
 /// <param name="keyValue">主键值,如果有值,表示更新记录</param>
 /// <param name="dicFileds">字段集合</param>
 /// <returns>返回执行是否成功</returns>
 public static bool Submit_AddOrEdit(string opName, string accCode, string tableName, string keyName, string keyValue, Dictionary<string, string> dicFileds)
 {
     ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
     reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
     reqeFunStruct.FunName = ComFunCallEnum.Submit_AddOrEdit;
     reqeFunStruct.AccCode = accCode;
     Submit_AddOrEdit submit_AddOrEdit = new Submit_AddOrEdit();
     submit_AddOrEdit.TableName = string.Format("{0}", tableName);
     submit_AddOrEdit.DicParam = dicFileds;
     submit_AddOrEdit.pkName = keyName;//默认第一个
     submit_AddOrEdit.pkVal = keyValue;
     reqeFunStruct.FunObject = submit_AddOrEdit;
     UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = opName };
     reqeFunStruct.userIDOP = userOp;
     reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;
     var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
     var respO = JsonOperate(addStr);
     if (respO.IsSuccess == "0")
     {
         return false;
     }
     return bool.Parse(respO.ReturnObject);
 }
Exemple #9
0
        /// <summary> 事务批量执行,不执行备份
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="sqlStringList">批量sql</param>
        /// <returns></returns>
        public static bool BatchExeSQLStrMultiByTransNoLogNoBackup(string opName, IList<SysSQLString> sqlStringList)
        {
            try
            {
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.BatchExeSQLStrMultiByTransNoLogNoBackup;
                reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
                reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                BatchExeSQLStringMultiByTrans batchExeSQLStringByTrans = new BatchExeSQLStringMultiByTrans();
                batchExeSQLStringByTrans.batSQLStringList = sqlStringList;
                reqeFunStruct.FunObject = batchExeSQLStringByTrans;

                string addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                if (!WCFClientProxy.TestDataProxy())
                {
                    throw new Exception("未能建立同服务器连接!");
                }
                string ResultStr = string.Empty;
                try
                {
                    ResultStr = GlobalStaticObj.proxy.JsonOperate(addStr);
                }
                catch (Exception e)
                {
                    return false;
                }

                string Str = HXCCommon.DotNetEncrypt.DESEncrypt.Decrypt(ResultStr);
                RespFunStruct respO = JsonConvert.DeserializeObject<RespFunStruct>(Str);
                return respO.ReturnObject == "True";
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                return false;
            }
        }
Exemple #10
0
 public static void LogFunctionCall(string fun_id, string setbook_id)
 {
     ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
     reqeFunStruct.SubSysName = SubSysName.ExtendBaseFuncCall;
     reqeFunStruct.FunName = ComFunCallEnum.LogFunctionCall;
     reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
     UserFunctionOPLog FunctionOP_Add = new UserFunctionOPLog();
     FunctionOP_Add.com_id = GlobalStaticObj.CurrUserCom_Id;
     FunctionOP_Add.fun_id = fun_id;           
     FunctionOP_Add.access_time = Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime);
     FunctionOP_Add.userOP = new SYSModel.UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = "菜单功能操作日志" };
     reqeFunStruct.FunObject = FunctionOP_Add;
     UserIDOP userOp = new SYSModel.UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = "菜单功能操作日志" };
     reqeFunStruct.userIDOP = userOp;
     reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;
     string addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
     if (!WCFClientProxy.TestDataProxy())
     {
         throw new Exception("未能建立同服务器连接!");
     }
     GlobalStaticObj.proxy.JsonOperate(addStr);           
 }
Exemple #11
0
        /// <summary> 根据条件删除指定表中的数据
        /// 创建人:唐春奎
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="tableName">表名</param>
        /// <param name="strWhere">执行条件,不包含where</param>
        /// <returns></returns>
        public static bool BatchDeleteDataByWhere(string opName, string tableName, string strWhere)
        {
            try
            {
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.BatchDeleteDataByWhere;
                reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
                reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                BatchDeleteDataByWhere batchDeleteDataByWhere = new BatchDeleteDataByWhere();
                batchDeleteDataByWhere.TableName = tableName;
                batchDeleteDataByWhere.whereString = strWhere;
                reqeFunStruct.FunObject = batchDeleteDataByWhere;

                var deleteStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                var respO = JsonOperate(deleteStr);
                return respO.IsSuccess == "1";
                //return respO.ReturnObject == "True";
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                return false;
            }
        }
Exemple #12
0
        /// <summary> 事务批量执行(List<string>)
        /// 创建人:唐春奎
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="sqlStringList">批量sql</param>
        /// <returns></returns>
        public static bool BatchExeSQLStringMultiByTrans(string opName, IList<SysSQLString> sqlStringList)
        {
            try
            {
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.BatchExeSQLStringMultiByTrans;
                reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
                reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                BatchExeSQLStringMultiByTrans batchExeSQLStringByTrans = new BatchExeSQLStringMultiByTrans();
                batchExeSQLStringByTrans.batSQLStringList = sqlStringList;
                reqeFunStruct.FunObject = batchExeSQLStringByTrans;

                var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                var respO = JsonOperate(addStr);
                return respO.ReturnObject == "True";
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                return false;
            }
        }
Exemple #13
0
        /// <summary> 根据主键值,单表删除多记录,In操作
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="sqlObjList">sql对象</param>
        /// <returns></returns>
        public static bool BatchUpdateDataByIn(string opName, string tableName, Dictionary<string, string> dicParam, string pkName, string[] pkValues)
        {
            try
            {
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.BatchUpdateDataByIn;
                reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
                reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                BatchUpdateDataByIn batchUpdateDataByIn = new BatchUpdateDataByIn();
                batchUpdateDataByIn.TableName = tableName;
                batchUpdateDataByIn.DicParam = dicParam;
                batchUpdateDataByIn.pkName = pkName;
                batchUpdateDataByIn.pkValues = pkValues;
                reqeFunStruct.FunObject = batchUpdateDataByIn;

                var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                var respO = JsonOperate(addStr);
                return respO.IsSuccess == "1";
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                return false;
            }
        }
Exemple #14
0
        /// <summary> 根据通用的分页存储过程,分页查询
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="tableName">表名</param>
        /// <param name="fileds">查询字段集合,以“,”分割</param>
        /// <param name="where">查询条件,不包含where</param>
        /// <param name="groupBy">分组字段,多个以“,”分割</param>
        /// <param name="orderBy">排序字段+排序方式,多个以“,”分割</param>
        /// <param name="pageIndex">查询第几页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="recordCount">返回总记录数</param>
        /// <returns>返回结果集</returns>
        public static DataTable GetTableByPage(string opName, string tableName, string fileds, string where, string groupBy, string orderBy, int pageIndex, int pageSize, out int recordCount)
        {
            try
            {
                DataSet ds = new DataSet();
                recordCount = 0;
                ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
                reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
                reqeFunStruct.FunName = ComFunCallEnum.SelOPByStoreProcePage;
                reqeFunStruct.AccCode = GlobalStaticObj.CurrAccCode;
                SelOPByStoreProcePage procePageInfo = new SelOPByStoreProcePage();
                procePageInfo.TableSource = string.Format("{0}", tableName);
                procePageInfo.PageIndex = pageIndex;
                procePageInfo.PageSize = pageSize;
                procePageInfo.Fields = fileds;
                //检查是否包含order by 关键字
                if (orderBy.Replace(" ", "").ToLower().IndexOf("orderby") < 0)
                {
                    orderBy = "order by " + orderBy;
                }
                procePageInfo.OrderExpression = orderBy;
                procePageInfo.whereString = where;
                reqeFunStruct.FunObject = procePageInfo;

                UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = opName };
                reqeFunStruct.userIDOP = userOp;

                //reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
                //reqeFunStruct.userIDOP.OPName = opName;
                reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

                var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
                var respO = JsonOperate(addStr);
                if (respO.IsSuccess == "0")
                {
                    throw new Exception(respO.Msg);
                }
                if (respO.ReturnObject == null)
                {
                    throw new Exception("返回数据异常:返回数据对象为空!");
                }
                else
                {
                    ds = JsonConvert.DeserializeObject<DataSet>(respO.ReturnObject);
                    if (ds == null || ds.Tables.Count == 0)
                    {
                        throw new Exception("查询异常:数据表不存在!");
                    }
                    recordCount = respO.RecordCount;
                }
                return ds.Tables[0];
            }
            catch (Exception ex)
            {
                JsonOperateLogService.WriteLog(ex);
                recordCount = 0;
                return null;
            }
        }
Exemple #15
0
        /// <summary> 事务批量执行
        /// </summary>
        /// <param name="opName">操作名</param>
        /// <param name="accCode">帐套代码</param>
        /// <param name="sqlObjList">批量sql</param>
        /// <returns></returns>
        public static bool BatchExeSQLMultiByTrans(string opName, string accCode, IList<SQLObj> sqlObjList)
        {
            ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
            reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
            reqeFunStruct.FunName = ComFunCallEnum.BatchExeSQLMultiByTrans;
            reqeFunStruct.AccCode = accCode;
            reqeFunStruct.userIDOP.UserID = GlobalStaticObj.UserID;
            reqeFunStruct.userIDOP.OPName = opName;
            reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;

            BatchExeSQLMultiByTrans batchExeSQLMultiByTrans = new BatchExeSQLMultiByTrans();
            batchExeSQLMultiByTrans.batSQLObjList = sqlObjList;
            reqeFunStruct.FunObject = batchExeSQLMultiByTrans;

            var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
            var respO = JsonOperate(addStr); ;
            return respO.IsSuccess == "1";
        }
Exemple #16
0
 private bool Call(string opName, ReqeFunStruct request0, out RespFunStruct result)
 {
     return CommonFuncCall.TryCallWCFFunc(opName, request0, out result);
 }
Exemple #17
0
 private ReqeFunStruct opUserParam()
 {
     ReqeFunStruct newUserO = new ReqeFunStruct();
     newUserO.SubSysName = SubSysName.CommonBaseFuncCall;
     newUserO.FunName = ComFunCallEnum.Submit_AddOrEdit;
     Submit_AddOrEdit addUser0 = new Submit_AddOrEdit();
     addUser0.TableName = "[sys_user]";
     Dictionary<string, string> DicParam = new Dictionary<string, string>();
     DicParam.Add("user_name", "123");
     DicParam.Add("password", "456");
     DicParam.Add("create_by", GlobalStaticObj.UserID);
     DicParam.Add("create_time", DateTime.UtcNow.Ticks.ToString());
     DicParam.Add("user_id", System.Guid.NewGuid().ToString());
     addUser0.DicParam = DicParam;
     newUserO.FunObject = addUser0;
     return newUserO;
 }
Exemple #18
0
 /// <summary> 查询单个字段的值(一般求最大,最小值)
 /// <param name="opName">操作名</param>
 /// <param name="accCode">帐套代码</param>
 /// <param name="tableName">表名</param>
 /// <param name="field">单个查询字段</param>
 /// <param name="orderBy">排序字段,多个以“,”分割</param>
 /// </summary>
 /// <returns>返回Value</returns>
 public static string GetSingleValue(string opName, string accCode, string tableName, string field, string where, string orderBy)
 {
     ReqeFunStruct reqeFunStruct = new ReqeFunStruct();
     reqeFunStruct.SubSysName = SubSysName.CommonBaseFuncCall;
     reqeFunStruct.FunName = ComFunCallEnum.ExecuteNonQueryReturnObjectNoTrans;
     reqeFunStruct.AccCode = accCode;
     SQLObj sqlObj = new SQLObj();
     sqlObj.cmdType = CommandType.Text;
     StringBuilder strBuilder = new StringBuilder();
     strBuilder.Append("select " + field);
     if (!string.IsNullOrEmpty(tableName))
     {
         strBuilder.Append(" from  " + tableName);
         if (!string.IsNullOrEmpty(where))
         {
             strBuilder.Append(" where  " + where);
         }
         if (!string.IsNullOrEmpty(orderBy))
         {
             strBuilder.Append(" order by  " + orderBy);
         }
     }
     sqlObj.sqlString = strBuilder.ToString();
     sqlObj.Param = new Dictionary<string, ParamObj>();
     ExecuteNonQueryReturnDataSetNoTrans executeNonQueryReturnDataSetNoTrans = new ExecuteNonQueryReturnDataSetNoTrans();
     executeNonQueryReturnDataSetNoTrans.ReadOnlyFlag = true;
     executeNonQueryReturnDataSetNoTrans.sqlObj = sqlObj;
     reqeFunStruct.FunObject = executeNonQueryReturnDataSetNoTrans;
     UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj.UserID, OPName = opName };
     reqeFunStruct.userIDOP = userOp;
     reqeFunStruct.PCClientCookieStr = GlobalStaticObj.CookieStr;
     var addStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(reqeFunStruct));
     var respO = JsonOperate(addStr);
     if (respO.IsSuccess == "0")
     {
         return "";
     }
     return respO.ReturnObject;
 }