예제 #1
0
        /// <summary>
        /// JqGrid
        /// </summary>
        static public Object GetJqGrid()
        {
            string result = string.Empty;

            try
            {
                string msg = string.Empty;
                msg += "Form=";
                for (int i = 0; i < System.Web.HttpContext.Current.Request.Form.Count; i++)
                {
                    msg += System.Web.HttpContext.Current.Request.Form[i] + ",";
                }
                msg += "|QueryString=";
                for (int i = 0; i < System.Web.HttpContext.Current.Request.QueryString.Count; i++)
                {
                    msg += System.Web.HttpContext.Current.Request.QueryString[i] + ",";
                }
                msg += "|jsonText=";
                System.Web.HttpContext.Current.Response.ContentType     = "application/octet-stream";
                System.Web.HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("UTF-8");
                byte[] reqData = System.Web.HttpContext.Current.Request.BinaryRead(System.Web.HttpContext.Current.Request.TotalBytes);
                msg += Encoding.Default.GetString(reqData);

                return(msg);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                Log.WriteLog(" " + ex);
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取角色列表为ZTree
        /// </summary>
        static public Object GetDepartmentInfoListForZTree()
        {
            #region 开始
            string result = string.Empty;
            try
            {
                int channelId           = DNTRequest.GetInt("channelId", 7);
                int ParentId            = DNTRequest.GetInt("ParentId", 0);
                DepartmentInfoBLL op    = new DepartmentInfoBLL();
                DepartmentInfo    model = new DepartmentInfo();
                DataSet           ds    = op.GetList(" RecordIsDelete=0 ");
                DataTable         dt    = null;
                if (ds != null && ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }

                List <Hashtable> list = new List <Hashtable>();
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow[] allList = dt.Select(string.Format("ParentId={0}", ParentId), "DepartmentID ASC");
                    if (allList.Length > 0)
                    {
                        foreach (DataRow dr in allList)
                        {
                            bool      isParent = false;
                            DataRow[] allChild = dt.Select(string.Format("ParentId={0}", dr["DepartmentID"]), "DepartmentID ASC");
                            if (allChild != null && allChild.Length > 0)
                            {
                                isParent = true;
                            }
                            #region inner001
                            string    className = ComPage.SafeToString(dr["DepartmentName"]);
                            Hashtable ht        = new Hashtable();

                            ht.Add("id", dr["DepartmentID"]);
                            ht.Add("name", className);
                            ht.Add("pId", dr["ParentId"]);
                            ht.Add("open", true);

                            if (isParent)
                            {
                                GetDepartmentInfoChild(list, allChild, dt);
                            }
                            list.Add(ht);
                            #endregion
                        }
                    }
                }
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, ex.Message, null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);

            #endregion end 开始
        }
예제 #3
0
        /// <summary>
        /// 获取结算申请信息
        /// </summary>
        static public Object GetSettlementModel()
        {
            string result = string.Empty;

            try
            {
                int orderRebateSettlementApplyId = DNTRequest.GetInt("OrderRebateSettlementApplyId", 0);
                if (orderRebateSettlementApplyId == 0)
                {
                    result = DNTRequest.GetResultJson(false, "获取结算申请信息失败,请稍后再试", null);
                }
                OrderRebateSettlementApplyBLL op    = new OrderRebateSettlementApplyBLL();
                OrderRebateSettlementApply    model = new OrderRebateSettlementApply();
                if (orderRebateSettlementApplyId != 0)
                {
                    model = op.GetModel(orderRebateSettlementApplyId);
                }
                result = DNTRequest.GetResultJson(true, "success", model);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取结算申请信息异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #4
0
파일: IJob.cs 프로젝트: hofmannzhu/bwjs
        /// <summary>
        /// 获取承保人职业列表
        /// </summary>
        /// <param name="oJobInfoResp"></param>
        /// <returns></returns>
        static public Object GetJobInfo()
        {
            string result   = string.Empty;
            string cacheKey = string.Empty;

            try
            {
                BaoxianDataBLL oBaoxianDataBLL = new BaoxianDataBLL();
                JobInfoReq     oJobInfoReq     = new JobInfoReq();

                string parentId = DNTRequest.GetString("parentId");
                cacheKey             = "jobCacheKey";
                oJobInfoReq.caseCode = DNTRequest.GetString("caseCode");
                oJobInfoReq.transNo  = DNTRequest.GetString("transNo");

                object      objJob       = CacheHelper.GetCache(cacheKey);
                JobInfoResp oJobInfoResp = new JobInfoResp();
                if (objJob != null)
                {
                    oJobInfoResp = (JobInfoResp)objJob;
                }
                else
                {
                    oJobInfoResp = oBaoxianDataBLL.GetJobInfo(oJobInfoReq);
                    CacheHelper.SetCache(cacheKey, oJobInfoResp, 10);
                }
                if (oJobInfoResp != null)
                {
                    List <InsureJobVo> jobList = oJobInfoResp.insureJobVos;
                    if (jobList.Count > 0)
                    {
                        int pid = 0;
                        if (!string.IsNullOrEmpty(parentId))
                        {
                            pid     = int.Parse(parentId);
                            jobList = jobList.Where(c => c.parentId == pid).ToList();
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "ajax:GetJobInfo方法 ----parentId异常", null);
                            return(result);
                        }
                        object obj = new
                        {
                            result = true,
                            msg    = "",
                            data   = jobList,
                        };
                        result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                Log.WriteLog(" " + ex);
            }

            return(result);
        }
예제 #5
0
        /// <summary>
        /// 获取心跳检查间隔
        /// </summary>
        static public Object GetHeartbeatInterval()
        {
            string result = string.Empty;

            try
            {
                double heartbeatInterval = 1000;
                int    hours             = 1;
                int    minutes           = 1;
                int    seconds           = 60;

                SysSettingsBLL     opSysSettingsBLL = new SysSettingsBLL();
                SysSettings        modelSysSettings = new SysSettings();
                List <SysSettings> list             = opSysSettingsBLL.GetModelList("IsDeleted=0 and Status=0");
                if (list.Count > 0)
                {
                    modelSysSettings = list[0];
                }
                if (modelSysSettings != null)
                {
                    hours   = modelSysSettings.TimerHours;
                    minutes = modelSysSettings.TimerMinutes;
                    seconds = modelSysSettings.TimerSeconds;
                }
                heartbeatInterval = hours * minutes * seconds * 1000;
                result            = DNTRequest.GetResultJson(true, "获取心跳检查间隔成功", heartbeatInterval);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取心跳检查间隔异常", ex.Message);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #6
0
        /// <summary>
        /// 获取产品财产所在地
        /// </summary>
        static public Object GetProductPropertyArea()
        {
            string result = string.Empty;

            try
            {
                #region 获取列表

                BaoxianDataBLL         baoxianDataBLL = new BaoxianDataBLL();
                ProductPropertyAreaReq model          = new ProductPropertyAreaReq();
                model.transNo  = DNTRequest.GetString("transNo");
                model.caseCode = DNTRequest.GetString("caseCode");
                model.areaCode = DNTRequest.GetString("areaCode");
                ProductPropertyAreaResp res = baoxianDataBLL.GetProductPropertyArea(model);

                object obj = new
                {
                    result = true,
                    msg    = "",
                    data   = res.areas,
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                Log.WriteLog(" " + ex);
            }
            return(result);
        }
예제 #7
0
        public void DeleteCompany(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var CompanyId = DNTRequest.GetString("CompanyId");
                if (string.IsNullOrEmpty(CompanyId))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    CompanyBLL companybll   = new CompanyBLL();
                    Company    modelMachine = new Company();
                    bool       res          = companybll.Delete(Convert.ToInt32(CompanyId), ComPage.CurrentUser.UserID);
                    if (res)
                    {
                        result = DNTRequest.GetResultJson(true, "删除渠道成功", null);
                    }
                    else
                    {
                        result = DNTRequest.GetResultJson(false, "删除渠道失败,请稍后再试", null);
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除渠道异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }
예제 #8
0
        /// <summary>
        /// 获取左侧导航菜单
        /// </summary>
        static public Object GetLeftMenu()
        {
            #region 开始
            string result = string.Empty;
            try
            {
                int         parentId      = DNTRequest.GetInt("parentId", 0);
                FunctionBLL opFunctionBLL = new FunctionBLL();
                Function    modelFunction = new Function();
                DataSet     ds            = opFunctionBLL.GetList("IsDeleted=0");
                DataTable   dt            = null;
                if (ds != null && ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }
                List <Hashtable> list = new List <Hashtable>();
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow[] allList = dt.Select(string.Format("ClassId=0 and ParentId={0}", parentId), "OrderId ASC");
                    if (allList.Length > 0)
                    {
                        foreach (DataRow dr in allList)
                        {
                            bool      isParent = false;
                            DataRow[] allChild = dt.Select(string.Format("ClassId=0 and ParentId={0}", dr["FunctionId"]), "OrderId ASC");
                            if (allChild != null && allChild.Length > 0)
                            {
                                isParent = true;
                            }
                            string    className = ComPage.SafeToString(dr["FunctionName"]);
                            Hashtable ht        = new Hashtable();

                            ht.Add("id", dr["FunctionId"]);
                            ht.Add("name", className);
                            ht.Add("pId", dr["ParentId"]);
                            ht.Add("url", dr["ExternalLinkAddress"]);
                            ht.Add("code", dr["FunctionCode"]);

                            if (isParent)
                            {
                                GetLeftMenuChild(list, allChild, dt);
                            }
                            list.Add(ht);
                        }
                    }
                }
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, ex.Message, null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);

            #endregion end 开始
        }
예제 #9
0
        static public Object CheckRUsersMachine()
        {
            string result = string.Empty;

            try
            {
                string UserId = DNTRequest.GetString("UserId");
                #region 获取列表
                string where = string.Empty;
                where        = "RecordIsDelete=0 and UserID= " + UserId;
                R_UsersMachineBLL bll        = new R_UsersMachineBLL();
                DataTable         dt         = bll.GetList(where).Tables[0];
                string            MachineIds = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MachineIds = MachineIds + "," + dt.Rows[i]["MachineID"];
                }
                MachineIds = MachineIds.TrimStart(',').TrimEnd(',');
                MachineBLL MBLL = new MachineBLL();

                string sqlMach = string.Empty;
                sqlMach = "MachineID in (" + MachineIds + ")";
                DataTable dt2 = MBLL.GetList(sqlMach).Tables[0];
                DataTable dt3 = dt2.DefaultView.ToTable(false, new string[] { "MachineID", "SN", "Address", "Platform", "Longitude", "Latitude" });
                for (int j = 0; j < dt3.Rows.Count; j++)
                {
                    if (dt3.Rows[j]["Platform"].ToString() == "1")
                    {
                        dt3.Rows[j]["Platform"] = "平板";
                    }
                    else if (dt3.Rows[j]["Platform"].ToString() == "2")
                    {
                        dt3.Rows[j]["Platform"] = "机器";
                    }
                    else
                    {
                        dt3.Rows[j]["Platform"] = "暂无";
                    }
                }
                //object obj = new
                //{
                //    result = true,
                //    code = "",
                //    msg = "",
                //    data = ((dt2 == null) ? (new DataTable()) : (dt2))
                //};
                result = Newtonsoft.Json.JsonConvert.SerializeObject(dt3);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #10
0
        /// <summary>
        /// 设备心跳检查
        /// </summary>
        static public Object HeartbeatCheck()
        {
            string result = string.Empty;

            try
            {
                #region 启动定时器
                //double interval = 1000;
                //int hours = 1;
                //int minutes = 1;
                //int seconds = 60;

                //SysSettingsBLL opSysSettingsBLL = new SysSettingsBLL();
                //SysSettings modelSysSettings = new SysSettings();
                //List<SysSettings> list = opSysSettingsBLL.GetModelList("IsDeleted=0 and Status=0");
                //if (list.Count > 0)
                //{
                //    modelSysSettings = list[0];
                //}
                //if (modelSysSettings != null)
                //{
                //    hours = modelSysSettings.TimerHours;
                //    minutes = modelSysSettings.TimerMinutes;
                //    seconds = modelSysSettings.TimerSeconds;
                //}
                //interval = hours * minutes * seconds * 1000;
                //int enabled = DNTRequest.GetInt("enabled", 1);
                //bool timerEnabled = ((enabled == 1) ? (true) : (false));
                //System.Timers.Timer timer = new System.Timers.Timer();
                //timer.Enabled = timerEnabled;
                //timer.Interval = interval;
                //timer.Start();
                //timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer1_Elapsed);
                //if (!timerEnabled)
                //{
                //    timer.Enabled = false;
                //}

                #endregion

                UpdateMachineSettings();

                result = DNTRequest.GetResultJson(true, "心跳检测启动成功", null);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "心跳检测启动异常", ex.Message);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #11
0
        public void DeleteUser(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var usersIds = DNTRequest.GetString("UsersID");
                if (string.IsNullOrEmpty(usersIds))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    MachineBLL opMachineBLL = new MachineBLL();
                    Machine    modelMachine = new Machine();
                    modelMachine = opMachineBLL.GetModelByUserId(Convert.ToInt32(usersIds));
                    if (modelMachine != null)
                    {
                        result = DNTRequest.GetResultJson(false, "用户已绑定设备,不允许删除", null);
                    }
                    else
                    {
                        UsersBLL bll = new UsersBLL();
                        bool     res = bll.Delete(Convert.ToInt32(usersIds));
                        if (res)
                        {
                            result = DNTRequest.GetResultJson(true, "删除用户成功", null);

                            #region 通知风控系统

                            #endregion
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "删除用户失败,请稍后再试", null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除用户异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }
예제 #12
0
        /// <summary>
        /// 确认结算
        /// </summary>
        /// <returns></returns>
        static public Object ConfirmSettlement()
        {
            string result = string.Empty;

            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    string orderRebateSettlementApplyId = DNTRequest.GetString("OrderRebateSettlementApplyId");
                    if (string.IsNullOrEmpty(orderRebateSettlementApplyId))
                    {
                        return(DNTRequest.GetResultJson(false, "请先选择确认结算的商户", null));
                    }
                    if (!string.IsNullOrEmpty(orderRebateSettlementApplyId))
                    {
                        OrderRebateSettlementApplyBLL opOrderRebateSettlementApply    = new OrderRebateSettlementApplyBLL();
                        OrderRebateSettlementApply    modelOrderRebateSettlementApply = new OrderRebateSettlementApply();

                        //更新结算申请表结算状态为已结算和更新订单表结算状态为已结算
                        int res01 = 0;
                        int res02 = 0;
                        opOrderRebateSettlementApply.ConfirmSettlement(orderRebateSettlementApplyId, ComPage.CurrentAdmin.UserID, ref res01, ref res02);

                        if (res01 > 0 && res02 > 0)
                        {
                            ts.Complete();
                            result = DNTRequest.GetResultJson(true, "确认结算成功", null);
                        }
                        else
                        {
                            ts.Dispose();
                            result = DNTRequest.GetResultJson(false, "确认结算失败,请稍后再试", null);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ts.Dispose();
                    result = DNTRequest.GetResultJson(false, "确认结算异常,请稍后再试", null);
                    ExceptionLogBLL.WriteExceptionLogToDB("确认结算异常," + ex.ToString());
                }
            }
            return(result);
        }
예제 #13
0
        public void DeleteSupplierInfo(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var SId = DNTRequest.GetString("SId");
                if (string.IsNullOrEmpty(SId))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    UsersBLL oUsersBLL  = new UsersBLL();
                    Users    modelUsers = new Users();
                    modelUsers = oUsersBLL.GetModelBySId(Convert.ToInt32(SId));
                    if (modelUsers != null)
                    {
                        result = DNTRequest.GetResultJson(false, "商户已绑定用户,不允许删除", null);
                    }
                    else
                    {
                        SupplierInfoBLL bll = new SupplierInfoBLL();
                        bool            res = bll.Delete(Convert.ToInt32(SId));
                        if (res)
                        {
                            result = DNTRequest.GetResultJson(true, "删除商户成功", null);
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "删除商户失败,请稍后再试", null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除用户异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }
예제 #14
0
        /// <summary>
        /// 读Cookie
        /// </summary>
        /// <returns></returns>
        static public Object GetCookie()
        {
            string result = string.Empty;

            try
            {
                string token = DNTRequest.GetString("token");

                string apiUrl        = loanApi + "/TestApi/GetCookie";
                string postParamters = string.Format("");
                string outputJson    = UtilityHelper.HttpService.GetHttpWebResponse(apiUrl, postParamters, contentType, postMethod);
                result = outputJson;
            }
            catch (Exception ex)
            {
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
                result = DNTRequest.GetResultJson(false, "异常,请稍后再试", null);
            }
            return(result);
        }
예제 #15
0
        static public Object GetCompanyListForSelect()
        {
            string result = string.Empty;

            try
            {
                CompanyBLL     op   = new CompanyBLL();
                List <Company> list = new List <Company>();
                StringBuilder where = new StringBuilder();
                where.AppendFormat("IsDeleted=0");
                list   = op.GetModelList(where.ToString());
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取渠道异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #16
0
        static public Object DepartmentInfoListForSelect()
        {
            string result = string.Empty;

            try
            {
                DepartmentInfoBLL     op   = new DepartmentInfoBLL();
                List <DepartmentInfo> list = new List <DepartmentInfo>();
                StringBuilder where = new StringBuilder();
                where.AppendFormat("RecordIsDelete=0");
                list   = op.GetModelList(where.ToString());
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取商家部门异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #17
0
        public Object GetCompanyCategory(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                CompanyCategoryBLL     ccb  = new CompanyCategoryBLL();
                List <CompanyCategory> list = new List <CompanyCategory>();
                StringBuilder where = new StringBuilder();
                where.AppendFormat(" 1=1 and IsDeleted=0");

                list   = ccb.GetModelList(where.ToString());
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取渠道列表,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #18
0
        /// <summary>
        /// 获取功能实体类
        /// </summary>
        static public Object GetFunctionModel()
        {
            #region 开始

            string result = string.Empty;
            try
            {
                int         functionId = DNTRequest.GetInt("functionId", -1);
                FunctionBLL op         = new FunctionBLL();
                Function    model      = new Function();
                model  = op.GetModel(functionId);
                result = DNTRequest.GetResultJson(true, "success", model);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, ex.Message, null);
                Log.WriteLog(ex.ToString());
            }
            return(result);

            #endregion end 开始
        }
예제 #19
0
        static public Object SupplierInfo()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;
                #region 搜索
                StringBuilder sqlSearch  = new StringBuilder();
                string        SignName   = DNTRequest.GetString("SignName");
                string        UserName   = DNTRequest.GetString("UserName");
                string        UserMobile = DNTRequest.GetString("UserMobile");

                if (string.IsNullOrEmpty(SignName))
                {
                    SignName = JsonRequest.GetJsonKeyVal(jsonText, "SignName");
                    SignName = System.Web.HttpContext.Current.Server.UrlDecode(SignName);
                }
                if (string.IsNullOrEmpty(UserName))
                {
                    UserName = JsonRequest.GetJsonKeyVal(jsonText, "UserName");
                    UserName = System.Web.HttpContext.Current.Server.UrlDecode(UserName);
                }
                if (string.IsNullOrEmpty(UserMobile))
                {
                    UserMobile = JsonRequest.GetJsonKeyVal(jsonText, "UserMobile");
                    UserMobile = System.Web.HttpContext.Current.Server.UrlDecode(UserMobile);
                }

                if (!string.IsNullOrEmpty(SignName))
                {
                    sqlSearch.AppendFormat(" and SignName like'{0}%'  ", SignName);
                }
                if (!string.IsNullOrEmpty(UserName))
                {
                    sqlSearch.AppendFormat(" and UserName like'{0}%'  ", UserName);
                }
                if (!string.IsNullOrEmpty(UserMobile))
                {
                    sqlSearch.AppendFormat(" and UserMobile ='{0}'  ", UserMobile);
                }

                #endregion

                string              orderBy  = string.Empty;
                string              sql      = "";
                int                 zys      = 0;
                int                 sumcount = 0;
                SupplierInfoBLL     op       = new SupplierInfoBLL();
                List <SupplierInfo> list     = new List <SupplierInfo>();
                StringBuilder where = new StringBuilder();
                where.Append("State=0");
                where.Append(sqlSearch);
                DataTable dt = op.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount);

                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = sumcount,
                    recordsFiltered = sumcount,
                    data            = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho           = sEcho,
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取商户信息异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #20
0
        /// <summary>
        /// 获取分利列表
        /// </summary>
        static public Object GetOrderRebateList()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;

                #region 获取列表
                StringBuilder where = new StringBuilder();
                where.Append("1=1 and ort.IsDeleted=0 ");
                DepartmentInfo    df  = new DepartmentInfo();
                DepartmentInfoBLL bll = new DepartmentInfoBLL();
                df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID);
                if (ComPage.CurrentAdmin.UserType != 1)
                {
                    if ((df == null) || (df != null && df.IsReceiveBusiness != false))
                    {
                        //where.Append(" AND  moa.UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))");
                        where.Append(" AND moa.UserID IN(SELECT ID from[BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))");
                    }
                }

                #region 条件搜索
                string key = DNTRequest.GetString("searchKey");
                if (string.IsNullOrEmpty(key))
                {
                    key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey");
                }

                string val = DNTRequest.GetString("searchValue");
                if (string.IsNullOrEmpty(val))
                {
                    val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue");
                    val = System.Web.HttpContext.Current.Server.UrlDecode(val);
                }

                if (!string.IsNullOrEmpty(val))
                {
                    where.AppendFormat(" and  (moa.InsureNum like'" + val + "%'  or ort.TransNo  like'" + val + "%') ", val);
                }
                #endregion

                string iSortCol_0   = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0");
                string sSortDir_0   = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0");
                int    iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols"));
                string orderBy      = string.Empty;
                if (!string.IsNullOrEmpty(iSortCol_0))
                {
                    string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0));
                    orderBy = string.Format(" {0} {1}", orderField, sSortDir_0);
                }

                string         sql            = "";
                int            zys            = 0;
                int            sumcount       = 0;
                OrderRebateBLL orderRebatebll = new OrderRebateBLL();
                DataTable      dt             = orderRebatebll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount);

                /*
                 *  iTotalRecord = sumcount,
                 *  iTotalDisplayRecords = sumcount,
                 */
                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = sumcount,
                    recordsFiltered = sumcount,
                    data            = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho           = sEcho,
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #21
0
        /// <summary>
        /// 获取结算申请列表
        /// </summary>
        static public Object GetSettlementList()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;

                StringBuilder where = new StringBuilder();
                where.Append("a.IsDeleted=0 ");

                #region 权限
                if (ComPage.CurrentAdmin.UserType != 1)
                {
                    where.Append("AND  a.UserID IN (select ID from [dbo].[GetChildrenRole](" + ComPage.CurrentAdmin.UserID + "))");
                }
                #endregion

                #region 条件搜索

                #region 结算方式
                string settlementMethod = DNTRequest.GetString("settlementMethod");
                if (string.IsNullOrEmpty(settlementMethod))
                {
                    settlementMethod = JsonRequest.GetJsonKeyVal(jsonText, "settlementMethod");
                }
                if (!string.IsNullOrEmpty(settlementMethod))
                {
                    where.AppendFormat(" and a.SettlementMethod={0}", settlementMethod);
                }
                #endregion

                #region 支付方式
                string paymentMethod = DNTRequest.GetString("paymentMethod");
                if (string.IsNullOrEmpty(paymentMethod))
                {
                    paymentMethod = JsonRequest.GetJsonKeyVal(jsonText, "paymentMethod");
                }
                if (!string.IsNullOrEmpty(paymentMethod))
                {
                    where.AppendFormat(" and a.PaymentMethod={0}", paymentMethod);
                }
                #endregion

                #region 结算状态
                string status = DNTRequest.GetString("status");
                if (string.IsNullOrEmpty(status))
                {
                    status = JsonRequest.GetJsonKeyVal(jsonText, "status");
                }
                if (!string.IsNullOrEmpty(status))
                {
                    where.AppendFormat(" and a.ApplyStatus={0}", status);
                }
                #endregion

                #region 商家
                string merchantName = DNTRequest.GetString("merchantName");
                if (string.IsNullOrEmpty(merchantName))
                {
                    merchantName = JsonRequest.GetJsonKeyVal(jsonText, "merchantName");
                    merchantName = System.Web.HttpContext.Current.Server.UrlDecode(merchantName);
                }
                if (!string.IsNullOrEmpty(merchantName))
                {
                    where.AppendFormat(" and b.UserName like'%{0}%'", merchantName);
                }
                #endregion

                #region 开户行
                string openingBank = DNTRequest.GetString("openingBank");
                if (string.IsNullOrEmpty(openingBank))
                {
                    openingBank = JsonRequest.GetJsonKeyVal(jsonText, "openingBank");
                    openingBank = System.Web.HttpContext.Current.Server.UrlDecode(openingBank);
                }
                if (!string.IsNullOrEmpty(openingBank))
                {
                    where.AppendFormat(" and a.OpeningBank like'%{0}%'", openingBank);
                }
                #endregion

                #region 持卡人
                string cardHolder = DNTRequest.GetString("cardHolder");
                if (string.IsNullOrEmpty(cardHolder))
                {
                    cardHolder = JsonRequest.GetJsonKeyVal(jsonText, "cardHolder");
                    cardHolder = System.Web.HttpContext.Current.Server.UrlDecode(cardHolder);
                }
                if (!string.IsNullOrEmpty(cardHolder))
                {
                    where.AppendFormat(" and a.CardHolder like'%{0}%'", cardHolder);
                }
                #endregion

                #region 卡号
                string cardNumber = DNTRequest.GetString("cardNumber");
                if (string.IsNullOrEmpty(cardNumber))
                {
                    cardNumber = JsonRequest.GetJsonKeyVal(jsonText, "cardNumber");
                    cardNumber = System.Web.HttpContext.Current.Server.UrlDecode(cardNumber);
                }
                if (!string.IsNullOrEmpty(cardNumber))
                {
                    where.AppendFormat(" and a.CardNumber like '%{0}%'", cardNumber);
                }
                #endregion

                #region 备注
                string remark = DNTRequest.GetString("remark");
                if (string.IsNullOrEmpty(remark))
                {
                    remark = JsonRequest.GetJsonKeyVal(jsonText, "remark");
                    remark = System.Web.HttpContext.Current.Server.UrlDecode(remark);
                }
                if (!string.IsNullOrEmpty(remark))
                {
                    where.AppendFormat(" and a.Remark like '%{0}%'", remark);
                }
                #endregion

                #region 结算金额
                string applyMoney = DNTRequest.GetString("applyMoney");
                if (string.IsNullOrEmpty(applyMoney))
                {
                    applyMoney = JsonRequest.GetJsonKeyVal(jsonText, "applyMoney");
                    applyMoney = System.Web.HttpContext.Current.Server.UrlDecode(applyMoney);
                }
                if (!string.IsNullOrEmpty(applyMoney))
                {
                    where.AppendFormat(" and (a.ApplyMoney={0} or a.ActualMoney={0})", applyMoney);
                }
                #endregion

                #region 结算周期
                string startDate = DNTRequest.GetString("startDate");
                if (string.IsNullOrEmpty(applyMoney))
                {
                    startDate = JsonRequest.GetJsonKeyVal(jsonText, "startDate");
                    startDate = System.Web.HttpContext.Current.Server.UrlDecode(startDate);
                }
                string endDate = DNTRequest.GetString("endDate");
                if (string.IsNullOrEmpty(endDate))
                {
                    endDate = JsonRequest.GetJsonKeyVal(jsonText, "endDate");
                    endDate = System.Web.HttpContext.Current.Server.UrlDecode(endDate);
                }

                if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate))
                {
                    where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", startDate, endDate);
                }
                else if (string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate))
                {
                    where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", endDate, endDate);
                }
                else if (!string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate))
                {
                    where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", startDate, startDate);
                }
                #endregion

                #endregion

                #region 排序字段
                string iSortCol_0   = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0");
                string sSortDir_0   = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0");
                int    iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols"));
                string orderBy      = string.Empty;
                if (!string.IsNullOrEmpty(iSortCol_0))
                {
                    string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0));
                    orderBy = string.Format(" {0} {1}", orderField, sSortDir_0);
                }
                #endregion

                #region 分页查询
                string sql      = "";
                int    zys      = 0;
                int    sumcount = 0;
                OrderRebateSettlementApplyBLL opOrderRebateSettlementApplyBLL = new OrderRebateSettlementApplyBLL();
                DataTable dt = opOrderRebateSettlementApplyBLL.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount);
                #endregion

                #region 查询结果
                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = sumcount,
                    recordsFiltered = sumcount,
                    data            = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho           = sEcho,
                };
                #endregion

                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取结算申请信息异常,", ex.Message);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #22
0
        /// <summary>
        /// 获取渠道列表
        /// </summary>
        static public Object GetCompanyList()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;

                #region 获取列表
                StringBuilder where = new StringBuilder();
                where.Append("1=1 and c.IsDeleted=0");
                #region 条件搜索
                string key = DNTRequest.GetString("searchKey");
                if (string.IsNullOrEmpty(key))
                {
                    key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey");
                }
                string val = DNTRequest.GetString("searchValue");
                if (string.IsNullOrEmpty(val))
                {
                    val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue");
                    val = System.Web.HttpContext.Current.Server.UrlDecode(val);
                }

                if (!string.IsNullOrEmpty(val) && val != "undefined")
                {
                    where.AppendFormat(" and (c.CompanyName like  '{0}%')", val);
                }
                string CompanyCategoryId = DNTRequest.GetString("CompanyCategoryId");
                string CompanyManager    = DNTRequest.GetString("CompanyManager");
                if (string.IsNullOrEmpty(CompanyCategoryId))
                {
                    CompanyCategoryId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyCategoryId");
                    CompanyCategoryId = System.Web.HttpContext.Current.Server.UrlDecode(CompanyCategoryId);
                }
                if (string.IsNullOrEmpty(CompanyManager))
                {
                    CompanyManager = JsonRequest.GetJsonKeyVal(jsonText, "CompanyManager");
                    CompanyManager = System.Web.HttpContext.Current.Server.UrlDecode(CompanyManager);
                }
                if (!string.IsNullOrEmpty(CompanyCategoryId) && CompanyCategoryId != "null" && CompanyCategoryId != "undefined")
                {
                    where.AppendFormat(" and c.CompanyCategoryId ={0} ", CompanyCategoryId);
                }
                if (!string.IsNullOrEmpty(CompanyManager) && CompanyManager != "null" && CompanyManager != "undefined")
                {
                    where.AppendFormat(" and c.CompanyManager like'{0}%'  ", CompanyManager);
                }

                #endregion

                string iSortCol_0   = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0");
                string sSortDir_0   = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0");
                int    iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols"));
                string orderBy      = string.Empty;
                if (!string.IsNullOrEmpty(iSortCol_0))
                {
                    string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0));
                    orderBy = string.Format(" {0} {1}", orderField, sSortDir_0);
                }

                string     sql        = "";
                int        zys        = 0;
                int        sumcount   = 0;
                CompanyBLL companybll = new CompanyBLL();
                DataTable  dt         = companybll.GetNameList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount);

                /*
                 *  iTotalRecord = sumcount,
                 *  iTotalDisplayRecords = sumcount,
                 */
                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = sumcount,
                    recordsFiltered = sumcount,
                    data            = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho           = sEcho,
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #23
0
        /// <summary>
        /// 申请结算提交
        /// </summary>
        /// <returns></returns>
        static public Object ApplySettlement()
        {
            string result = string.Empty;

            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    string userIdAndDepartmentId = DNTRequest.GetString("userIdAndDepartmentId");
                    if (string.IsNullOrEmpty(userIdAndDepartmentId))
                    {
                        return(DNTRequest.GetResultJson(false, "请先选择需要结算的商户", null));
                    }
                    int userId       = 0;
                    int departmentId = 0;
                    if (!string.IsNullOrEmpty(userIdAndDepartmentId))
                    {
                        string[] userIdAndDepartmentIdList = userIdAndDepartmentId.Split(new char[] { ',' });
                        userId       = ComPage.SafeToInt(userIdAndDepartmentIdList[0]);
                        departmentId = ComPage.SafeToInt(userIdAndDepartmentIdList[1]);
                    }
                    if (userId == 0)
                    {
                        return(DNTRequest.GetResultJson(false, "请先选择需要结算的商户", null));
                    }

                    //订单返利结算申请表主键
                    int orderRebateSettlementApplyId = 0;
                    int res01 = 0;
                    int res02 = 0;

                    #region 订单返利结算申请信息入库
                    string objOrderRebateSettlementApply = DNTRequest.GetString("modelOrderRebateSettlementApply");
                    OrderRebateSettlementApply postOrderRebateSettlementApply = JsonConvert.DeserializeObject <OrderRebateSettlementApply>(objOrderRebateSettlementApply);

                    OrderRebateSettlementApplyBLL opOrderRebateSettlementApply    = new OrderRebateSettlementApplyBLL();
                    OrderRebateSettlementApply    modelOrderRebateSettlementApply = new OrderRebateSettlementApply();
                    modelOrderRebateSettlementApply.UserId           = userId;
                    modelOrderRebateSettlementApply.DepartmentId     = departmentId;
                    modelOrderRebateSettlementApply.StartDate        = postOrderRebateSettlementApply.StartDate;
                    modelOrderRebateSettlementApply.EndDate          = postOrderRebateSettlementApply.EndDate;
                    modelOrderRebateSettlementApply.ApplyMoney       = postOrderRebateSettlementApply.ApplyMoney;
                    modelOrderRebateSettlementApply.ActualMoney      = postOrderRebateSettlementApply.ActualMoney;
                    modelOrderRebateSettlementApply.ApplyStatus      = 0;
                    modelOrderRebateSettlementApply.SettlementMethod = null;
                    modelOrderRebateSettlementApply.SalesPercentage  = 0;
                    modelOrderRebateSettlementApply.PaymentMethod    = postOrderRebateSettlementApply.PaymentMethod;
                    modelOrderRebateSettlementApply.OpeningBank      = postOrderRebateSettlementApply.OpeningBank;
                    modelOrderRebateSettlementApply.CardHolder       = postOrderRebateSettlementApply.CardHolder;
                    modelOrderRebateSettlementApply.CardNumber       = postOrderRebateSettlementApply.CardNumber;
                    modelOrderRebateSettlementApply.Remark           = postOrderRebateSettlementApply.Remark;
                    modelOrderRebateSettlementApply.CreateId         = ComPage.CurrentAdmin.UserID;
                    modelOrderRebateSettlementApply.CreateDate       = DateTime.Now;
                    modelOrderRebateSettlementApply.EditId           = null;
                    modelOrderRebateSettlementApply.EditDate         = null;
                    modelOrderRebateSettlementApply.IsDeleted        = 0;

                    orderRebateSettlementApplyId = opOrderRebateSettlementApply.Add(modelOrderRebateSettlementApply);
                    #endregion

                    #region 结算申请详情信息入库和修改订单返利结算申请表的结算状态为已申请
                    if (orderRebateSettlementApplyId > 0)
                    {
                        #region 结算申请详情信息入库和修改订单返利结算申请表的结算状态为已申请

                        StringBuilder where = new StringBuilder();
                        where.Append("b.ProductId=0");
                        #region 获取结算申请列表查询条件
                        string UserId = DNTRequest.GetString("UserId");
                        if (string.IsNullOrEmpty(UserId))
                        {
                            UserId = JsonRequest.GetJsonKeyVal(jsonText, "UserId");
                        }
                        if (!string.IsNullOrEmpty(UserId))
                        {
                            where.AppendFormat(" and a.UserId={0}", UserId);
                        }

                        string CompanyId = DNTRequest.GetString("CompanyId");
                        if (string.IsNullOrEmpty(CompanyId))
                        {
                            CompanyId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyId");
                        }
                        if (!string.IsNullOrEmpty(CompanyId))
                        {
                            where.AppendFormat(" and a.CompanyId={0}", CompanyId);
                        }

                        string StartDate = DNTRequest.GetString("StartDate");
                        if (string.IsNullOrEmpty(StartDate))
                        {
                            StartDate = JsonRequest.GetJsonKeyVal(jsonText, "StartDate");
                        }

                        string EndDate = DNTRequest.GetString("EndDate");
                        if (string.IsNullOrEmpty(EndDate))
                        {
                            EndDate = JsonRequest.GetJsonKeyVal(jsonText, "EndDate");
                        }

                        if (!string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate))
                        {
                            where.AppendFormat(" and a.CreateDate between '{0} 00:00:00' and '{1} 23:59:59'", StartDate, EndDate);
                        }
                        else if (string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate))
                        {
                            where.AppendFormat(" and a.CreateDate<='{0} 23:59:59'", EndDate);
                        }
                        else if (!string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate))
                        {
                            where.AppendFormat(" and a.CreateDate >= '{0} 00:00:00'", StartDate);
                        }

                        #endregion

                        where.Append(" and a.IsDeleted=0 and a.PayStatus=1 and a.IsSettled=0 and a.IsCancel=0");
                        OrderRebateBLL op = new OrderRebateBLL();
                        op.ApplySettlement(orderRebateSettlementApplyId, ComPage.CurrentAdmin.UserID, where.ToString(), ref res01, ref res02);

                        #endregion
                    }
                    #endregion
                    if (orderRebateSettlementApplyId > 0 && res01 > 0 && res02 > 0)
                    {
                        ts.Complete();
                        result = DNTRequest.GetResultJson(true, "申请结算成功", null);
                    }
                    else
                    {
                        ts.Dispose();
                        result = DNTRequest.GetResultJson(false, "申请结算失败,请稍后再试", null);
                    }
                }
                catch (Exception ex)
                {
                    ts.Dispose();
                    result = DNTRequest.GetResultJson(false, "申请结算异常,请稍后再试", null);
                    ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
                }
            }
            return(result);
        }
예제 #24
0
        /// <summary>
        /// 查询可结算订单列表
        /// </summary>
        static public Object QueryOrderList()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;

                #region 获取列表
                StringBuilder where = new StringBuilder();
                where.Append("b.ProductId=0");
                #region 查询条件

                #region 商家
                string UserId = DNTRequest.GetString("UserId");
                if (string.IsNullOrEmpty(UserId))
                {
                    UserId = JsonRequest.GetJsonKeyVal(jsonText, "UserId");
                }
                if (!string.IsNullOrEmpty(UserId))
                {
                    where.AppendFormat(" and a.UserId={0}", UserId);
                }
                #endregion

                #region  道
                string CompanyId = DNTRequest.GetString("CompanyId");
                if (string.IsNullOrEmpty(CompanyId))
                {
                    CompanyId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyId");
                }
                if (!string.IsNullOrEmpty(CompanyId))
                {
                    where.AppendFormat(" and a.CompanyId={0}", CompanyId);
                }
                #endregion

                #region 结算周期
                string StartDate = DNTRequest.GetString("StartDate");
                if (string.IsNullOrEmpty(StartDate))
                {
                    StartDate = JsonRequest.GetJsonKeyVal(jsonText, "StartDate");
                }

                string EndDate = DNTRequest.GetString("EndDate");
                if (string.IsNullOrEmpty(EndDate))
                {
                    EndDate = JsonRequest.GetJsonKeyVal(jsonText, "EndDate");
                }

                if (!string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate))
                {
                    where.AppendFormat(" and a.CreateDate between '{0} 00:00:00' and '{1} 23:59:59'", StartDate, EndDate);
                }
                else if (string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate))
                {
                    where.AppendFormat(" and a.CreateDate<='{0} 23:59:59'", EndDate);
                }
                else if (!string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate))
                {
                    where.AppendFormat(" and a.CreateDate>='{0} 00:00:00'", StartDate);
                }
                #endregion

                #endregion

                #region 固定的查询条件
                where.Append(" and a.IsDeleted=0 and a.PayStatus=1 and a.IsSettled=0 and a.IsCancel=0");
                #endregion

                #region 执行sql
                OrderRebateBLL op = new OrderRebateBLL();
                DataTable      dt = op.QueryOrderList(where.ToString());
                #endregion

                #region 结果处理
                double sumOrderMoney    = 0;
                double sumMerchantMoney = 0;
                double sumAgentMoney    = 0;
                double sumHQMoney       = 0;
                double sumNetProfit     = 0;
                double sumApplyMoney    = 0;
                int    totalCount       = 0;
                if (dt != null && dt.Rows.Count > 0)
                {
                    totalCount = dt.Rows.Count;
                    foreach (DataRow dr in dt.Rows)
                    {
                        sumOrderMoney    += Math.Round(ComPage.SafeToDouble(dr["sumOrderMoney"]), 2, MidpointRounding.AwayFromZero);
                        sumMerchantMoney += Math.Round(ComPage.SafeToDouble(dr["sumMerchantMoney"]), 2, MidpointRounding.AwayFromZero);
                        sumAgentMoney    += Math.Round(ComPage.SafeToDouble(dr["sumAgentMoney"]), 2, MidpointRounding.AwayFromZero);
                        sumHQMoney       += Math.Round(ComPage.SafeToDouble(dr["sumHQMoney"]), 2, MidpointRounding.AwayFromZero);
                        sumNetProfit     += Math.Round(ComPage.SafeToDouble(dr["sumNetProfit"]), 2, MidpointRounding.AwayFromZero);
                        int    settlementMethod = ComPage.SafeToInt(dr["SettlementMethod"]);
                        double salesPercentage  = ComPage.SafeToDouble(dr["SalesPercentage"]);
                        int    userType         = ComPage.SafeToInt(dr["UserType"]);
                        switch (settlementMethod)
                        {
                        case 1:
                            #region 销售额百分比分成
                            double salesPercentageMoney = (sumOrderMoney * salesPercentage) / 100;
                            sumApplyMoney += Math.Round(salesPercentageMoney, 2, MidpointRounding.AwayFromZero);
                            #endregion
                            break;

                        case 2:
                            #region 单笔结算分成
                            switch (userType)
                            {
                            case 2:        //经销商
                                sumApplyMoney += Math.Round(sumMerchantMoney, 2, MidpointRounding.AwayFromZero);
                                break;

                            case 3:        //代理商
                                sumApplyMoney += Math.Round(sumAgentMoney, 2, MidpointRounding.AwayFromZero);
                                break;
                            }
                            #endregion
                            break;
                        }
                    }
                }
                #endregion

                #region 拼装返回结果
                var obj = new
                {
                    result           = true,
                    code             = "",
                    msg              = "",
                    sumOrderMoney    = sumOrderMoney,
                    sumMerchantMoney = sumMerchantMoney,
                    sumAgentMoney    = sumAgentMoney,
                    sumHQMoney       = sumHQMoney,
                    sumNetProfit     = sumNetProfit,
                    sumApplyMoney    = sumApplyMoney,
                    recordsTotal     = totalCount,
                    recordsFiltered  = totalCount,
                    data             = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho            = sEcho
                };
                #endregion

                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "获取结算申请信息异常,", ex.Message);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
예제 #25
0
        /// <summary>
        /// 检查是否已登录
        /// </summary>
        /// <returns></returns>
        static public Object Test()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));

                string sSearch      = JsonRequest.GetJsonKeyVal(jsonText, "sSearch");
                string iSortCol_0   = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0");
                string sSortDir_0   = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0");
                int    iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols"));

                string timeStamp = JsonRequest.GetJsonKeyVal(jsonText, "timeStamp");
                int    pageIndex = (displayStart / displayLength) + 1;
                int    pageSize  = displayLength;
                string orderBy   = string.Empty;
                if (!string.IsNullOrEmpty(iSortCol_0))
                {
                    string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0));
                    orderBy = string.Format(" order by {0} {1}", orderField, sSortDir_0);
                }

                List <object> list = new List <object>();
                //list.Sort();
                int totalCount = 1000;
                for (int i = 1; i <= totalCount; i++)
                {
                    if (i > displayStart && i <= (displayStart + displayLength))
                    {
                        object data = new
                        {
                            Id         = i,
                            Name       = "hfm" + i.ToString().PadLeft(4, '0'),
                            Sex        = new Random().Next(0, 2).ToString(),
                            CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                        };
                        list.Add(data);
                    }
                }
                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = totalCount,
                    recordsFiltered = totalCount,
                    data            = list,

                    sEcho = sEcho,

                    #region 注释
                    //iColumns = 6,
                    //sColumns = "",
                    //mDataProp_0 = "Id",
                    //sSearch_0 = "",
                    //bRegex_0 = false,
                    //bSearchable_0 = true,
                    //bSortable_0 = false,
                    //mDataProp_1 = "Id",
                    //sSearch_1 = "",
                    //bRegex_1 = false,
                    //bSearchable_1 = true,
                    //bSortable_1 = true,
                    //mDataProp_2 = "Name",
                    //sSearch_2 = "",
                    //bRegex_2 = false,
                    //bSearchable_2 = true,
                    //bSortable_2 = true,
                    //mDataProp_3 = "Sex",
                    //sSearch_3 = "",
                    //bRegex_3 = false,
                    //bSearchable_3 = true,
                    //bSortable_3 = true,
                    //mDataProp_4 = "CreateDate",
                    //sSearch_4 = "",
                    //bRegex_4 = false,
                    //bSearchable_4 = true,
                    //bSortable_4 = true,
                    //mDataProp_5 = "",
                    //sSearch_5 = "",
                    //bRegex_5 = false,
                    //bSearchable_5 = true,
                    //bSortable_5 = true,
                    //sSearch = "",
                    //bRegex = false,
                    //iSortCol_0 = 0,
                    //sSortDir_0 = "asc",
                    //iSortingCols = 1,
                    #endregion
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                Log.WriteLog(" " + ex);
            }
            return(result);
        }
예제 #26
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        static public Object GetUsersList()
        {
            string result = string.Empty;

            try
            {
                string sEcho         = JsonRequest.GetJsonKeyVal(jsonText, "sEcho");
                int    displayStart  = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart"));
                int    displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength"));
                int    pageIndex     = (displayStart / displayLength) + 1;
                int    pageSize      = displayLength;

                #region 获取列表
                StringBuilder where = new StringBuilder();
                where.Append("1=1 and u.RecordIsDelete=0 ");
                DepartmentInfo    df  = new DepartmentInfo();
                DepartmentInfoBLL bll = new DepartmentInfoBLL();
                df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID);

                if (ComPage.CurrentAdmin.UserType != 1)
                {
                    if ((df == null) || (df != null && df.IsReceiveBusiness != false))
                    {
                        where.Append(" AND  u. UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))");
                    }
                }

                #region 条件搜索
                string key = DNTRequest.GetString("searchKey");
                if (string.IsNullOrEmpty(key))
                {
                    key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey");
                }
                string LoginName        = DNTRequest.GetString("LoginName");
                string UsersName        = DNTRequest.GetString("UsersName");
                string Mobiles          = DNTRequest.GetString("Mobiles");
                string DepartmentInfoID = DNTRequest.GetString("DepartmentInfoID");

                if (string.IsNullOrEmpty(LoginName))
                {
                    LoginName = JsonRequest.GetJsonKeyVal(jsonText, "LoginName");
                    LoginName = System.Web.HttpContext.Current.Server.UrlDecode(LoginName);
                }
                if (string.IsNullOrEmpty(UsersName))
                {
                    UsersName = JsonRequest.GetJsonKeyVal(jsonText, "UsersName");
                    UsersName = System.Web.HttpContext.Current.Server.UrlDecode(UsersName);
                }
                if (string.IsNullOrEmpty(Mobiles))
                {
                    Mobiles = JsonRequest.GetJsonKeyVal(jsonText, "Mobiles");
                    Mobiles = System.Web.HttpContext.Current.Server.UrlDecode(Mobiles);
                }
                if (string.IsNullOrEmpty(DepartmentInfoID))
                {
                    DepartmentInfoID = JsonRequest.GetJsonKeyVal(jsonText, "DepartmentInfoID");
                    DepartmentInfoID = System.Web.HttpContext.Current.Server.UrlDecode(DepartmentInfoID);
                }



                if (!string.IsNullOrEmpty(LoginName))
                {
                    where.AppendFormat(" and u.LoginName like'{0}%'  ", LoginName);
                }
                if (!string.IsNullOrEmpty(UsersName))
                {
                    where.AppendFormat(" and u.UserName like'{0}%'  ", UsersName);
                }
                if (!string.IsNullOrEmpty(Mobiles))
                {
                    where.AppendFormat(" and u.Phone like'{0}%'  ", Mobiles);
                }
                if (!string.IsNullOrEmpty(DepartmentInfoID) && DepartmentInfoID != "undefined" && DepartmentInfoID != "0")
                {
                    where.AppendFormat(" and u.DepartmentID ={0}  ", DepartmentInfoID);
                }
                #endregion

                string iSortCol_0   = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0");
                string sSortDir_0   = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0");
                int    iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols"));
                string orderBy      = string.Empty;
                if (!string.IsNullOrEmpty(iSortCol_0))
                {
                    string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0));
                    orderBy = string.Format(" {0} {1}", orderField, sSortDir_0);
                }

                string    sql      = "";
                int       zys      = 0;
                int       sumcount = 0;
                UsersBLL  Usersbll = new UsersBLL();
                DataTable dt       = Usersbll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount);

                /*
                 *  iTotalRecord = sumcount,
                 *  iTotalDisplayRecords = sumcount,
                 */
                object obj = new
                {
                    result          = true,
                    code            = "",
                    msg             = "",
                    recordsTotal    = sumcount,
                    recordsFiltered = sumcount,
                    data            = ((dt == null) ? (new DataTable()) : (dt)),
                    sEcho           = sEcho,
                };
                result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }