Beispiel #1
0
        /// <summary>
        /// 构造函数
        /// </summary>

        public WorkFlowApiController()
        {
            //获取AppInfo值 头部信息记录
            #region 设置当前线程数据库
            var base64EncodedBytes = Convert.FromBase64String(HttpContext.Current.Request.Headers.GetValues("AppInfo").First());
            var jsonText           = Encoding.UTF8.GetString(base64EncodedBytes);
            var AppInfo            = JsonConvert.DeserializeObject <ApiControllerBase.Models.AppInfoBase>(jsonText);

            if (AppInfo != null)
            {
                DBConnectionStringBuilder dbbuilder = new DBConnectionStringBuilder();
                string result, userConn;
                var    pubConn = dbbuilder.GetMainConnStringElement(0, out result, false);
                string defaultConn = dbbuilder.GetDefaultConnString();

                if (AppInfo.DbName.ToLower() == "ngsoft")
                {
                    userConn = pubConn;
                }
                else
                {
                    userConn = string.IsNullOrWhiteSpace(AppInfo.DbName)
                        ? defaultConn
                        : dbbuilder.GetAccConnstringElement(0, AppInfo.DbName, pubConn,
                                                            out result);
                }

                //设置当前数据库连接信息
                ConnectionInfoService.SetCallContextConnectString(userConn);
                MultiDelegatingDbProvider.CurrentDbProviderName = AppInfo.DbName;
            }
            #endregion

            service = new WorkFlowServiceProxy();
        }
Beispiel #2
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            //获取AppInfo值 头部信息记录
            var base64EncodedBytes = Convert.FromBase64String(HttpContext.Current.Request.Headers.GetValues("AppInfo").First());
            var jsonText           = Encoding.UTF8.GetString(base64EncodedBytes);
            var AppInfo            = JsonConvert.DeserializeObject <AppInfoBase>(jsonText);

            if (AppInfo != null)
            {
                string curConnect = DbHelper.ConnectString;
                if (curConnect.IndexOf(AppInfo.DbName, StringComparison.CurrentCultureIgnoreCase) > 0)
                {
                    //连接串包含了当前数据库
                }
                else
                {
                    DBConnectionStringBuilder dbbuilder = new DBConnectionStringBuilder();
                    string result, userConn;
                    var    pubConn = dbbuilder.GetMainConnStringElement(0, out result, false);
                    string defaultConn = dbbuilder.GetDefaultConnString();

                    if (AppInfo.DbName.ToLower() == "ngsoft")
                    {
                        userConn = pubConn;
                    }
                    else
                    {
                        userConn = string.IsNullOrWhiteSpace(AppInfo.DbName)
                            ? defaultConn
                            : dbbuilder.GetAccConnstringElement(0, AppInfo.DbName, pubConn,
                                                                out result);
                    }

                    //设置当前数据库连接信息
                    ConnectionInfoService.SetCallContextConnectString(userConn);
                    MultiDelegatingDbProvider.CurrentDbProviderName = AppInfo.DbName;
                }
            }

            base.OnActionExecuting(actionContext);
        }
        /// <summary>
        /// 获取所有审批种类对应的审批单据的总数量
        /// </summary>
        /// <returns>返回Json串</returns>
        public string GetRecordListNum()
        {
            long   Uid   = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["Uid"]);
            long   Orgid = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["Orgid"]);
            string Year  = System.Web.HttpContext.Current.Request.Params["Year"];

            if (Uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }
            if (Orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }
            if (string.IsNullOrEmpty(Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }

            //设置当前数据库连接信息
            ConnectionInfoService.SetCallContextConnectString(NG3.AppInfoBase.UserConnectString);
            MultiDelegatingDbProvider.CurrentDbProviderName = NG3.AppInfoBase.DbName;

            BillRequestModel billRequest = new BillRequestModel();

            billRequest.Uid   = Uid;
            billRequest.Orgid = Orgid;
            billRequest.Year  = Year;
            var YNum = 0; //已审数量
            var NNum = 0; //待审数量

            try
            {
                //获取审批所有类型
                List <QTSysSetModel> procTypes = QTSysSetService.GetProcTypes();
                if (procTypes != null && procTypes.Count > 0)
                {
                    foreach (var sysSet in procTypes)
                    {
                        billRequest.BType     = sysSet.Value;
                        billRequest.Splx_Phid = sysSet.PhId;
                        int total = 0;
                        List <AppvalRecordVo> recordVos = GAppvalRecordService.GetDoneRecordList(billRequest, out total);
                        int total2 = 0;
                        List <AppvalRecordVo> recordVos2 = GAppvalRecordService.GetUnDoRecordList(billRequest, out total2);

                        YNum += total;
                        NNum += total2;
                    }
                }
                var dic = new Dictionary <string, object>();
                new CreateCriteria(dic).Add(ORMRestrictions <Int64> .NotEq("PhId", 0));
                new CreateCriteria(dic).Add(ORMRestrictions <List <Int32> > .In("FState", new List <int>()
                {
                    2, 0
                }));
                new CreateCriteria(dic).Add(ORMRestrictions <Int64> .Eq("OrgPhid", Orgid));
                new CreateCriteria(dic).Add(ORMRestrictions <string> .Eq("FYear", Year));
                //var Query = GKPaymentMstService.GetPaymentFailure(dic);
                var Query = GKPaymentMstService.Find(dic).Data;
                return(DataConverterHelper.SerializeObject(new
                {
                    Status = "success",
                    YNum = YNum,
                    NNum = NNum,
                    PaymentState = Query.Count//【待支付】信息提醒需求
                }));
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }