Example #1
0
        public static decimal GetAward(string PrizeContent, Operation_Record record, List <Animal_Info> Animal_Info_List, ref List <string> AwardList)
        {
            decimal getdecimal = 0;

            try
            {
                List <Animal_Info_S> Detail_Ss = Animal_Info_S.GetBase(record.Buy_Content, Animal_Info_List, record.BuyPayReturn);
                var cont7 = PrizeContent.Length >= 7 ? Split_Hepler.str_to_stringss(PrizeContent)[6] : "0";
                //特奖
                int conti7 = Convert.ToInt32(cont7);
                foreach (var item in Detail_Ss)
                {
                    if (item.GlobeCodeList.Contains(conti7))
                    {
                        getdecimal += (decimal)(item.PayReturn * record.UnitPrice);
                        AwardList.Add(item.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #2
0
        public void DebtGroup(HttpContext context)
        {
            try
            {
                HttpRequest   request   = context.Request;
                string        Codes     = RequestHelper.string_transfer(request, "Codes");
                string[]      codeArray = Split_Hepler.str_to_stringss(Codes);
                List <string> codeList  = codeArray.Count() > 0 ? codeArray.ToList() : new List <string>();
                int           Count     = RequestHelper.int_transfer(request, "Count");

                string UID    = RequestHelper.string_transfer(request, "UID");
                string dsp    = RequestHelper.string_transfer(request, "dsp");
                bool   result = Constant.Check_Login_DIP(UID, dsp);//获取当前人金额
                if (result)
                {
                    var list = GroupHelper(codeList, Count);
                    jsonModel = JsonModel.GetJsonModel(0, "获取成功", list);
                }
                else
                {
                    jsonModel = JsonModel.GetJsonModel(1000, "已超时");
                }
            }
            catch (Exception ex)
            {
                jsonModel = JsonModel.GetJsonModel(400, ex.Message);
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #3
0
 /// <summary>
 /// 通知其他负责人进行添加
 /// </summary>
 /// <param name="custer"></param>
 public void Add_Other_Users(cust_linkman linkman, string cust_leaders)
 {
     try
     {
         //多负责人添加
         string[] arri = Split_Hepler.str_to_stringss(cust_leaders);
         foreach (var guid in arri)
         {
             if (!string.IsNullOrEmpty(guid))
             {
                 //如果不包含则添加
                 if (dic_Self.ContainsKey(guid))
                 {
                     if (!dic_Self[guid].Contains(linkman))
                     {
                         dic_Self[guid].Add(linkman);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Example #4
0
        public static decimal GetAward(string PrizeContent, Operation_Record record)
        {
            decimal getdecimal = 0;

            try
            {
                List <int> contents = Split_Hepler.str_to_ints(record.Buy_Content).ToList();

                List <int> contListall = Split_Hepler.str_to_ints(PrizeContent).ToList();
                int        count       = 0;

                foreach (var content in contents)
                {
                    if (!contListall.Contains(content))
                    {
                        count++;
                    }
                }
                if (count >= contents.Count)
                {
                    getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #5
0
        public static decimal GetAward(string PrizeContent, Operation_Record record, List <Globe> Globe_List, ref List <string> AwardList)
        {
            decimal getdecimal = 0;

            try
            {
                List <Globe_S> globes = Globe_S.GetBase(record.Buy_Content, Globe_List, record.BuyPayReturn);

                var contList6 = Split_Hepler.str_to_ints(PrizeContent).ToList();
                contList6.RemoveAt(contList6.Count - 1);
                List <int> contents = Split_Hepler.str_to_ints(record.Buy_Content).ToList();
                foreach (var item in contList6)
                {
                    if (contents.Contains(item))
                    {
                        Globe_S globe_ss = globes.FirstOrDefault(i => i.Code == item);
                        if (globe_ss != null)
                        {
                            getdecimal += (decimal)(globe_ss.PayReturn * record.UnitPrice);
                            AwardList.Add(globe_ss.Name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #6
0
        public static decimal GetAward(Globe_Clue clue, string PrizeContent, Operation_Record record, List <Globe> Globe_List, List <Size_SpecialNormal> Size_Special_List, ref List <Araw_Return_S> Araw_Return_Ss, ref List <string> NoAwardList, ref List <string> AwardList, ref int paytype)
        {
            decimal getdecimal = 0;

            try
            {
                List <Globe_S>      globes       = Globe_S.GetBase(record.Buy_Content, Globe_List, record.BuyPayReturn);
                List <Size_NormalS> Size_Normals = Size_NormalS.GetBase(record.Buy_Content2, Size_Special_List, record.BuyPayReturn2);
                var cont1_6 = PrizeContent.Length >= 7 ? Split_Hepler.str_to_stringss(PrizeContent)[(int)clue.Second_Type - 1] : "0";
                //特奖
                int conti1_6 = Convert.ToInt32(cont1_6);

                if (!string.IsNullOrEmpty(record.Buy_Content))
                {
                    paytype = 0;
                    List <int> contents = Split_Hepler.str_to_ints(record.Buy_Content).ToList();
                    if (contents.Contains(conti1_6))
                    {
                        Globe_S globe_ss = globes.FirstOrDefault(i => i.Code == conti1_6);
                        if (globe_ss != null)
                        {
                            getdecimal += (decimal)(globe_ss.PayReturn * record.UnitPrice);
                            AwardList.Add(globe_ss.Name);
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(record.Buy_Content2))
                {
                    paytype = 1;
                    List <int> contents2 = Split_Hepler.str_to_ints(record.Buy_Content2).ToList();
                    foreach (var buycontent in contents2)
                    {
                        Size_NormalS size_NormalS = Size_Normals.FirstOrDefault(i => i.Code == buycontent);
                        if (size_NormalS.GlobeCodeList.Contains(conti1_6))
                        {
                            //if (conti1_6 == 49 && size_NormalS.IsEnable == (int)IsEnable.Enable)
                            //{
                            //    //使用和局
                            //    Araw_Return_Ss.Add(new Araw_Return_S() { Name = size_NormalS.Name, Araw_Money = (decimal)record.UnitPrice });
                            //}
                            //else
                            //{
                            getdecimal += (decimal)(size_NormalS.PayReturn * record.UnitPrice);
                            AwardList.Add(size_NormalS.Name);
                            //}
                        }
                        else
                        {
                            NoAwardList.Add(size_NormalS.Name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #7
0
        public void GetUserByType(HttpContext context)
        {
            int intSuccess = (int)errNum.Success;

            try
            {
                HttpRequest Request      = context.Request;
                string      type         = RequestHelper.string_transfer(Request, "type");
                string      DepartmentID = RequestHelper.string_transfer(Request, "DepartmentID");
                if (!string.IsNullOrEmpty(type))
                {
                    int[] types = Split_Hepler.str_to_ints(type);

                    List <UserInfo>       UserInfo_List_      = Constant.UserInfo_List;
                    List <Sys_Role>       Sys_Role_List       = Constant.Sys_Role_List;
                    List <Sys_RoleOfUser> Sys_RoleOfUser_List = Constant.Sys_RoleOfUser_List;
                    var query = (from ul in UserInfo_List_
                                 join SysRoleOfUser in Sys_RoleOfUser_List on ul.UniqueNo equals SysRoleOfUser.UniqueNo
                                 where types.Contains((int)SysRoleOfUser.Role_Id)
                                 join SysRole in Sys_Role_List on SysRoleOfUser.Role_Id equals SysRole.Id
                                 orderby SysRole.Sort
                                 select new
                    {
                        id = ul.Id,
                        Name = (ul.Name == null) ? string.Empty : ul.Name,
                        Sex = GetSex(Convert.ToString(ul.Sex)),
                        LoginName = (ul.LoginName == null) ? string.Empty : ul.LoginName,
                        Phone = (ul.Phone == null) ? string.Empty : ul.Phone,
                        Email = (ul.Email == null) ? string.Empty : ul.Email,
                        UserType = ul.UserType,
                        Roleid = SysRole.Id,
                        Pwd = ul.ClearPassword,
                        UniqueNo = ul.UniqueNo,
                        MajorId = ul.Major_ID,
                        DepartmentName = ul.DepartmentName,
                    }).ToList();

                    if (!string.IsNullOrEmpty(DepartmentID))
                    {
                        query = (from q in query where q.MajorId == DepartmentID select q).ToList();
                    }

                    int count = query.Count();

                    jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", query);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
        public void TestGetPagelimits(HttpContext context)
        {
            try
            {
                HttpRequest Request = context.Request;
                string      Roleid  = RequestHelper.string_transfer(Request, "Rid");
                string      name    = RequestHelper.string_transfer(Request, "Name");
                //返回所有用户信息
                List <Sys_MenuInfo>   MenuInfo_List   = Constant.Sys_MenuInfo_List;
                List <Sys_RoleOfMenu> RoleOfMenu_List = Constant.Sys_RoleOfMenu_List;
                List <int>            list            = Split_Hepler.str_to_ints(Roleid).ToList();
                var query = from RoleOfMenu_ in RoleOfMenu_List
                            join MenuInfo_ in MenuInfo_List on RoleOfMenu_.Menu_Id equals MenuInfo_.Id
                            where list.Contains((int)RoleOfMenu_.Role_Id)
                            //where MenuInfo_.IsMenu=='1'
                            where MenuInfo_.Name == name
                            orderby MenuInfo_.Sort

                            select new
                {
                    //Role_Id=RoleOfMenu_.Role_Id,
                    Name        = MenuInfo_.Name,
                    Url         = MenuInfo_.Url,
                    Pid         = MenuInfo_.Pid,
                    ID          = MenuInfo_.Id,
                    Description = MenuInfo_.Description,
                    IsShow      = MenuInfo_.IsShow,
                    MenuCode    = MenuInfo_.MenuCode
                };
                int a      = query.Count();
                var query2 = from p in query
                             group p by p.ID into allg
                             select new
                {
                    //Role_Id=allg.Max(p => p.Role_Id),
                    Name        = allg.Max(p => p.Name),
                    Url         = allg.Max(p => p.Url),
                    Pid         = allg.Max(p => p.Pid),
                    ID          = allg.Max(p => p.ID),
                    Description = allg.Max(p => p.Description),
                    IsShow      = allg.Max(p => p.IsShow),
                    MenuCode    = allg.Max(p => p.MenuCode)
                };
                int a1 = query2.Count();
                jsonModel = JsonModel.get_jsonmodel(0, "success", query2);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #9
0
        public static Size_NormalS GetBase(Size_SpecialNormal item, float pay)
        {
            Size_NormalS Size_S = new Size_NormalS()
            {
                Id            = item.Id,
                Code          = item.Code,
                GlobeCodeList = Split_Hepler.str_to_ints(item.Globe),
                IsEnable      = item.IsEnable,
                Name          = item.Name,
                PayReturn     = pay,
            };

            return(Size_S);
        }
Example #10
0
        public static Animal_Info_S GetBase(Animal_Info item, float pay)
        {
            Animal_Info_S Animal_InfoS = new Animal_Info_S()
            {
                Id            = item.Id,
                Code          = item.Code,
                GlobeCodeList = Split_Hepler.str_to_ints(item.Globe),
                IsEnable      = item.IsEnable,
                Name          = item.Name,
                PayReturn     = pay,
            };

            return(Animal_InfoS);
        }
Example #11
0
        public void IsMutex(HttpContext context)
        {
            int intSuccess = (int)errNum.Success;

            try
            {
                HttpRequest Request   = context.Request;
                string      UniqueNos = RequestHelper.string_transfer(Request, "UniqueNo");
                string[]    us        = Split_Hepler.str_to_stringss(UniqueNos);
                int         Roleid    = RequestHelper.int_transfer(Request, "Roleid");
                //-----------------------------------------------------------------------
                RoleType roleType = (RoleType)Roleid;

                bool   reuslt = true;
                string info   = string.Empty;
                if (roleType == RoleType.department_mange || roleType == RoleType.school_manage)
                {
                    //先把选中的 角色进行判断性的变更【若不为改类型则设置为该类型】
                    var inf = (from uni in us
                               join r_u in Constant.Sys_RoleOfUser_List on uni equals r_u.UniqueNo
                               join r in Constant.Sys_Role_List on r_u.Role_Id equals r.Id
                               join user in Constant.UserInfo_List on uni equals user.UniqueNo
                               where r.Id == (int)RoleType.department_mange || r.Id == (int)RoleType.school_manage
                               select new MuteUser {
                        UserName = user.Name, RoleName = r.Name, RoleID = r.Id
                    }).ToList();
                    inf = (from i in inf where i.RoleID != Roleid select i).ToList();
                    if (inf.Count > 0)
                    {
                        reuslt = false;
                    }
                    var data = new { IsMutex = reuslt, inf };
                    jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", data);
                }
                else
                {
                    var data = new { IsMutex = reuslt, Info = "" };
                    jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", data);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #12
0
        public static Detail_S GetBase(Detail item, float pay)
        {
            Detail_S Size_Six_S = new Detail_S()
            {
                Id            = item.Id,
                Code          = item.Code,
                GlobeCodeList = Split_Hepler.str_to_ints(item.Globe),
                IsEnable      = item.IsEnable,
                Name          = item.Name,
                PayReturn     = pay,
            };

            return(Size_Six_S);
        }
Example #13
0
 public void TestGetMenuInfo(HttpContext context)
 {
     try
     {
         HttpRequest Request = context.Request;
         string      Roleid  = RequestHelper.string_transfer(Request, "Rid");
         string      isMenu  = RequestHelper.string_transfer(Request, "IsMenu");
         //返回所有用户信息
         List <Sys_MenuInfo> MenuInfo_List = Constant.Sys_MenuInfo_List;
         if (!string.IsNullOrEmpty(isMenu))
         {
             MenuInfo_List = MenuInfo_List.Where(t => t.IsMenu == Convert.ToByte(isMenu)).ToList();
         }
         List <Sys_RoleOfMenu> RoleOfMenu_List = Constant.Sys_RoleOfMenu_List;
         List <int>            list            = Split_Hepler.str_to_ints(Roleid).ToList();
         var query = from RoleOfMenu_ in RoleOfMenu_List
                     join MenuInfo_ in MenuInfo_List on RoleOfMenu_.Menu_Id equals MenuInfo_.Id
                     where list.Contains((int)RoleOfMenu_.Role_Id)
                     orderby MenuInfo_.Sort
                     select new
         {
             IconClass = MenuInfo_.IconClass,
             Name      = MenuInfo_.Name,
             Url       = MenuInfo_.Url,
             Pid       = MenuInfo_.Pid,
             ID        = MenuInfo_.Id
         };
         var query2 = from p in query
                      group p by p.Name into allg
                      select new
         {
             IconClass = allg.Max(p => p.IconClass),
             Name      = allg.Max(p => p.Name),
             Url       = allg.Max(p => p.Url),
             Pid       = allg.Max(p => p.Pid),
             ID        = allg.Max(p => p.ID),
         };
         jsonModel = JsonModel.get_jsonmodel(0, "success", query2);
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
     finally
     {
         //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
         context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
     }
 }
Example #14
0
        public static Size_Six_S GetBase(Size_Six item, float pay)
        {
            Size_Six_S Size_Six_S = new Size_Six_S()
            {
                Id            = item.Id,
                Code          = item.Code,
                GlobeCodeList = Split_Hepler.str_to_ints(item.Globe),
                IsEnable      = item.IsEnable,
                Name          = item.Name,
                PayReturn     = pay,
                Award_Globe   = item.Award_Globe
            };

            return(Size_Six_S);
        }
Example #15
0
        public static decimal GetAward(string PrizeContent, Operation_Record record, List <Animal_Info> Animal_Info_List, List <Detail> Detail_List, ref List <string> AwardList)
        {
            decimal getdecimal = 0;

            try
            {
                List <Animal_Info_S> Animal_Info_Ss = Animal_Info_S.GetBase(record.Buy_Content, Animal_Info_List, record.BuyPayReturn);
                List <Detail_S>      Detail_Ss      = Detail_S.GetBase(record.Buy_Content2, Detail_List, record.BuyPayReturn2);


                var contList7 = Split_Hepler.str_to_ints(PrizeContent).ToList();

                foreach (var content in Animal_Info_Ss)
                {
                    foreach (var item in contList7)
                    {
                        //Animal_Info_S animal_Info_S = Animal_Info_Ss.FirstOrDefault(i => i.Code == content);
                        if (content.GlobeCodeList.Contains(item))
                        {
                            getdecimal += (decimal)(content.PayReturn * record.UnitPrice);
                            AwardList.Add(content.Name);
                            break;
                        }
                    }
                }


                foreach (var content in Detail_Ss)
                {
                    foreach (var item in contList7)
                    {
                        //Detail_S detail_S = Detail_Ss.FirstOrDefault(i => i.Code == content);
                        if (content.GlobeCodeList.Contains(item))
                        {
                            getdecimal += (decimal)(content.PayReturn * record.UnitPrice);
                            AwardList.Add(content.Name);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
        public static JsonModel TestGetMenuInfoHelper(string Roleid, string isMenu)
        {
            int       intSuccess = (int)errNum.Success;
            JsonModel jsmodel    = new JsonModel();

            try
            {
                //返回所有用户信息
                List <Sys_MenuInfo> MenuInfo_List = Constant.Sys_MenuInfo_List;
                if (!string.IsNullOrEmpty(isMenu))
                {
                    MenuInfo_List = MenuInfo_List.Where(t => t.IsMenu == Convert.ToByte(isMenu)).ToList();
                }
                List <Sys_RoleOfMenu> RoleOfMenu_List = Constant.Sys_RoleOfMenu_List;
                List <int>            list            = Split_Hepler.str_to_ints(Roleid).ToList();
                var query = (from RoleOfMenu_ in RoleOfMenu_List
                             join MenuInfo_ in MenuInfo_List on RoleOfMenu_.Menu_Id equals MenuInfo_.Id
                             where list.Contains((int)RoleOfMenu_.Role_Id)
                             orderby MenuInfo_.Sort
                             select new
                {
                    IconClass = MenuInfo_.IconClass,
                    Name = MenuInfo_.Name,
                    Url = MenuInfo_.Url,
                    Pid = MenuInfo_.Pid,
                    ID = MenuInfo_.Id
                }).ToList();
                var query2 = (from p in query
                              group p by p.ID into allg
                              select new
                {
                    IconClass = allg.Max(p => p.IconClass),
                    Name = allg.Max(p => p.Name),
                    Url = allg.Max(p => p.Url),
                    Pid = allg.Max(p => p.Pid),
                    ID = allg.Max(p => p.ID),
                }).ToList();
                jsmodel = JsonModel.get_jsonmodel(intSuccess, "success", query2);
            }
            catch (Exception ex)
            {
                jsmodel = JsonModel.get_jsonmodel(3, "failed", ex.Message);
                LogHelper.Error(ex);
            }
            return(jsmodel);
        }
Example #17
0
        public static decimal GetAward(string PrizeContent, Operation_Record record, List <Size_Six> Size_Six_List, ref List <Araw_Return_S> Araw_Return_Ss, ref List <string> NoAwardList, ref List <string> AwardList)
        {
            decimal getdecimal = 0;

            try
            {
                //获取1-6买码对应数据
                List <Size_Six_S> Size_Six_Ss = Size_Six_S.GetBase(record.Buy_Content, Size_Six_List, record.BuyPayReturn);
                //获取开奖六位数
                List <int> contList6 = Split_Hepler.str_to_ints(PrizeContent).ToList();
                contList6.RemoveAt(contList6.Count - 1);

                //对应指定的码特
                int count = 1;
                foreach (var item in contList6)
                {
                    foreach (var buyItem in Size_Six_Ss.Where(i => i.Award_Globe == count))
                    {
                        if (buyItem.GlobeCodeList.Contains(item))
                        {
                            //if (item == 49 && buyItem.IsEnable == (int)IsEnable.Enable)
                            //{
                            //    //使用和局
                            //    Araw_Return_Ss.Add(new Araw_Return_S() { Name = buyItem.Name, Araw_Money = (decimal)record.UnitPrice });
                            //}
                            //else
                            //{
                            getdecimal += (decimal)(buyItem.PayReturn * record.UnitPrice);
                            AwardList.Add(buyItem.Name);
                            //}
                        }
                        else
                        {
                            NoAwardList.Add(buyItem.Name);
                        }
                    }
                    count++;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #18
0
        public static decimal GetAward(string PrizeContent, Operation_Record record, List <Wave> Wave_List, ref List <Araw_Return_S> Araw_Return_Ss, ref List <string> NoAwardList, ref List <string> AwardList)
        {
            decimal getdecimal = 0;

            try
            {
                List <Wave_S> Wave_Ss = Wave_S.GetBase(record.Buy_Content, Wave_List, record.BuyPayReturn);
                string        cont7   = PrizeContent.Length >= 7 ? Split_Hepler.str_to_stringss(PrizeContent)[6] : "0";
                //特奖
                int conti7 = Convert.ToInt32(cont7);

                List <int> contents = Split_Hepler.str_to_ints(record.Buy_Content).ToList();
                foreach (var wav_select in contents)
                {
                    Wave_S wave_S = Wave_Ss.FirstOrDefault(i => i.Code == wav_select);
                    if (wave_S != null)
                    {
                        if (wave_S.GlobeCodeList.Contains(conti7))
                        {
                            //if (conti7 == 49)
                            //{
                            //    //使用和局
                            //    Araw_Return_Ss.Add(new Araw_Return_S() { Name = wave_S.Name, Araw_Money = (decimal)record.UnitPrice });
                            //}
                            //else
                            //{
                            getdecimal += (decimal)(wave_S.PayReturn * record.UnitPrice);
                            AwardList.Add(wave_S.Name);
                            //}
                        }
                        else
                        {
                            NoAwardList.Add(wave_S.Name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #19
0
        public static decimal GetAward(Globe_Clue Globe_Clue, string PrizeContent, Operation_Record record, ref List <string> AwardList)
        {
            decimal getdecimal   = 0;
            string  awardCollect = string.Empty;

            try
            {
                List <int> contList6 = Split_Hepler.str_to_ints(PrizeContent).ToList();
                contList6.RemoveAt(contList6.Count - 1);

                List <int> buyList = Split_Hepler.str_to_ints(record.Buy_Content).ToList();

                var cont7 = PrizeContent.Length >= 7 ? Split_Hepler.str_to_stringss(PrizeContent)[6] : "0";
                //特奖
                int conti7 = Convert.ToInt32(cont7);

                int      count    = 0;
                LineType LineType = (LineType)Globe_Clue.Second_Type;
                if (LineType == LineType.全中)
                {
                    foreach (var wawardClobe in contList6)
                    {
                        if (buyList.Contains(wawardClobe))
                        {
                            count++;
                            awardCollect += Convert.ToString(wawardClobe) + ",";
                        }
                    }
                    if (count >= 3)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                        AwardList.Add(Convert.ToString(awardCollect));
                    }
                }
                else if (LineType == LineType.二全中 || LineType == LineType.中二之中二)
                {
                    foreach (var wawardClobe in contList6)
                    {
                        if (buyList.Contains(wawardClobe))
                        {
                            count++;
                            awardCollect += Convert.ToString(wawardClobe) + ",";
                        }
                    }
                    if (count >= 2)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                        AwardList.Add(Convert.ToString(awardCollect));
                    }
                }
                else if (LineType == LineType.二中特之中二)
                {
                    foreach (var wawardClobe in contList6)
                    {
                        if (buyList.Contains(wawardClobe))
                        {
                            count++;
                            awardCollect += Convert.ToString(wawardClobe) + ",";
                        }
                    }
                    if (count >= 2)
                    {
                        getdecimal += (decimal)(record.MaxPayReturn * record.UnitPrice);
                        AwardList.Add(Convert.ToString(awardCollect));
                    }
                }
                else if (LineType == TLC_Model.Enums.LineType.二中特之中特 || LineType == TLC_Model.Enums.LineType.特串)
                {
                    foreach (var wawardClobe in contList6)
                    {
                        if (buyList.Contains(wawardClobe))
                        {
                            count++;
                            awardCollect += Convert.ToString(wawardClobe) + ",";
                            break;
                        }
                    }
                    if (buyList.Contains(conti7))
                    {
                        count++;
                        awardCollect += Convert.ToString(conti7) + ",";
                    }
                    if (count >= 2)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                        AwardList.Add(Convert.ToString(awardCollect));
                    }
                }
                else if (LineType == TLC_Model.Enums.LineType.四中一)
                {
                    foreach (var wawardClobe in contList6)
                    {
                        if (buyList.Contains(wawardClobe))
                        {
                            count++;
                            awardCollect += Convert.ToString(wawardClobe) + ",";
                            break;
                        }
                    }
                    if (count >= 1)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                        AwardList.Add(Convert.ToString(awardCollect));
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #20
0
        public void BuyGlobe_Group(HttpContext context)
        {
            try
            {
                HttpRequest request   = context.Request;
                string      UserID    = RequestHelper.string_transfer(request, "UserID");
                int         AwardCode = RequestHelper.int_transfer(request, "AwardCode");
                int         ClueCode  = RequestHelper.int_transfer(request, "ClueCode");
                int         Count     = RequestHelper.int_transfer(request, "Count");

                string Buy_Content  = RequestHelper.string_transfer(request, "Buy_Content");
                string Buy_Content2 = string.Empty;

                int     UnitPrice   = RequestHelper.int_transfer(request, "UnitPrice");
                decimal Using_Money = RequestHelper.decimal_transfer(request, "Using_Money");

                string BuyPayReturn  = RequestHelper.string_transfer(request, "BuyPayReturn");
                string BuyPayReturn2 = string.Empty;

                string UID    = RequestHelper.string_transfer(request, "UID");
                string dsp    = RequestHelper.string_transfer(request, "dsp");
                bool   result = Constant.Check_Login_DIP(UID, dsp);//下注
                if (result)
                {
                    string[]      codeArray   = Split_Hepler.str_to_stringss(Buy_Content);
                    List <string> codeList    = codeArray.Count() > 0 ? codeArray.ToList() : new List <string>();
                    List <string> bu_contents = GroupHelper(codeList, Count);
                    //序列化表单详情列表
                    List <string> BuyPayReturnList = JsonConvert.DeserializeObject <List <string> >(BuyPayReturn);

                    int length = 0;
                    foreach (var item in bu_contents)
                    {
                        float          MinPayReturn = 0;
                        float          MaxPayReturn = 0;
                        List <Globe_S> globes       = Globe_S.GetBase(item, Constant.Globe_List, BuyPayReturnList[length]);
                        foreach (var code in globes)
                        {
                            if (MinPayReturn == 0 || MinPayReturn > code.PayReturn)
                            {
                                MinPayReturn = code.PayReturn;
                            }
                            if (MaxPayReturn == 0 || MaxPayReturn < code.PayReturn)
                            {
                                MaxPayReturn = code.PayReturn;
                            }
                        }
                        MinPayReturn = MinPayReturn > 0 ? (float)Math.Round(MinPayReturn, 2) : 0;
                        MaxPayReturn = MaxPayReturn > 0 ? (float)Math.Round(MaxPayReturn, 2) : 0;

                        jsonModel = BuyGlobe_Group_Helper(UserID, AwardCode, ClueCode, item, Buy_Content2, UnitPrice, UnitPrice, BuyPayReturnList[length], BuyPayReturn2, MinPayReturn, MaxPayReturn);
                        length++;
                    }
                }
                else
                {
                    jsonModel = JsonModel.GetJsonModel(300, "未经授权");
                }
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #21
0
        public void SetUserToRole(HttpContext context)
        {
            int intSuccess = (int)errNum.Success;

            try
            {
                HttpRequest Request   = context.Request;
                string      UniqueNos = RequestHelper.string_transfer(Request, "UniqueNo");
                int         Roleid    = RequestHelper.int_transfer(Request, "Roleid");
                string[]    us        = Split_Hepler.str_to_stringss(UniqueNos);

                //-----------------------------------------------------------------------
                //先把选中的 角色进行判断性的变更【若不为改类型则设置为该类型】
                foreach (var unique in us)
                {
                    Sys_RoleOfUser roleofuser = Constant.Sys_RoleOfUser_List.FirstOrDefault(r => r.UniqueNo == unique);
                    if (roleofuser != null && roleofuser.Role_Id != Roleid)
                    {
                        Sys_RoleOfUser RoleOfUser_Clone = Constant.Clone <Sys_RoleOfUser>(roleofuser);
                        RoleOfUser_Clone.Role_Id = Roleid;
                        //改数据库
                        JsonModel m1 = Constant.Sys_RoleOfUserService.Update(RoleOfUser_Clone);
                        if (m1.errNum == 0)
                        {
                            //改缓存
                            roleofuser.Role_Id = Roleid;
                        }
                    }
                }

                //-----------------------------------------------------------------------
                //若不为改类型则进行剔除(获取已存在的该类型角色 查看这次是否剔除)
                var roles = (from r in Constant.Sys_RoleOfUser_List where r.Role_Id == Roleid select r).ToList();
                foreach (Sys_RoleOfUser role in roles)
                {
                    //Sys_RoleOfUser Sys_RoleOfUser_=new Sys_RoleOfUser();
                    //Sys_RoleOfUser_.UniqueNo=
                    if (!us.Contains(role.UniqueNo))
                    {
                        Teacher teacher = Constant.Teacher_List.FirstOrDefault(t => t.UniqueNo == role.UniqueNo);
                        Student student = Constant.Student_List.FirstOrDefault(s => s.UniqueNo == role.UniqueNo);

                        int roleID = 2;
                        if (teacher != null)
                        {
                            roleID = 3;
                        }
                        else if (student != null)
                        {
                            roleID = 2;
                        }
                        Sys_RoleOfUser edit_RoleOfUser = Constant.Sys_RoleOfUser_List.FirstOrDefault(u => u.UniqueNo == role.UniqueNo);
                        if (edit_RoleOfUser != null)
                        {
                            Sys_RoleOfUser role_u_clone = Constant.Clone <Sys_RoleOfUser>(edit_RoleOfUser);
                            role_u_clone.Role_Id = roleID;
                            //改数据库
                            JsonModel m2 = Constant.Sys_RoleOfUserService.Update(role_u_clone);
                            if (m2.errNum == 0)
                            {
                                //改缓存
                                edit_RoleOfUser.Role_Id = roleID;
                            }
                        }
                    }
                }

                jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", "0");
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
 public void Get_MenuBtnInfo(HttpContext context)
 {
     try
     {
         HttpRequest Request         = context.Request;
         string      Roleid          = RequestHelper.string_transfer(Request, "Rid");
         List <int>  rid_list        = Split_Hepler.str_to_ints(Roleid).ToList();
         var         roleOfMenu_List = Constant.Sys_RoleOfMenu_List.Where(p => rid_list.Contains(Convert.ToInt32(p.Role_Id)));
         var         sel_menu        = rid_list.Exists(o => o == 1)? (from menu in Constant.Sys_MenuInfo_List
                                                                      select new
         {
             Id = menu.Id,
             Pid = menu.Pid,
             Name = menu.Name,
             Url = menu.Url,
             IsMenu = menu.IsMenu,
             IconClass = menu.IconClass,
             MenuCode = menu.MenuCode
         }).Distinct() : (from role in roleOfMenu_List
                          join menu in Constant.Sys_MenuInfo_List on role.Menu_Id equals menu.Id
                          select new
         {
             Id = menu.Id,
             Pid = menu.Pid,
             Name = menu.Name,
             Url = menu.Url,
             IsMenu = menu.IsMenu,
             IconClass = menu.IconClass,
             MenuCode = menu.MenuCode
         }).Distinct();
         var menulist = from menu in sel_menu
                        where menu.IsMenu == 0 && sel_menu.Where(p => p.Pid == menu.Id && p.IsMenu == 1).Count() > 0
                        select new
         {
             Id  = menu.Id,
             Url = menu.Url
         };
         var btnlist = sel_menu.Where(p => p.IsMenu == 1);
         var query   = from menu in menulist
                       select new
         {
             menu.Id,
             menu.Url,
             Btn = btnlist.Where(t => t.Pid == menu.Id)
         };
         if (query.Count() > 0)
         {
             jsonModel = JsonModel.get_jsonmodel(0, "success", query.ToList());
         }
         else
         {
             jsonModel = JsonModel.get_jsonmodel(3, "failed", "没有数据");
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
     finally
     {
         //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
         context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
     }
 }
Example #23
0
        /// <summary>
        /// 删除联系人
        /// </summary>
        /// <param name="context"></param>
        public void update_cust_linkman_isdelete(HttpContext context, string guid)
        {
            HttpRequest  Request  = context.Request;
            HttpResponse response = context.Response;

            //id号
            long id_long = RequestHelper.long_transfer(Request, "id");

            try
            {
                if (id_long != 0)
                {
                    //联系人列表,当前用户
                    List <cust_linkman> cust_linkman_selfs = dic_Self[guid];
                    //获取当前用户的指定联系人
                    cust_linkman delete_linkman = cust_linkman_selfs.FirstOrDefault(item => item.id == id_long);
                    //删除指定ID的联系人
                    if (delete_linkman != null)
                    {
                        List <follow_up> follow_up_selfs = follow_up_handle.dic_Self[guid];

                        string[] has_the_Customer_users = Split_Hepler.str_to_stringss(delete_linkman.link_users);
                        if (has_the_Customer_users.Count() > 1)
                        {
                            jsonModel = Constant.get_jsonmodel(5, "failed", "无法删除,关联了多个负责人");
                        }
                        else if (follow_up_selfs.Count(item => item.follow_link_id == id_long) > 0)
                        {
                            jsonModel = Constant.get_jsonmodel(5, "failed", "无法删除,关联了跟进记录");
                        }

                        else
                        {
                            cust_linkman_selfs.Remove(delete_linkman);
                            //删除状态
                            delete_linkman.link_isdelete = RequestHelper.string_transfer(Request, "link_isdelete");
                            jsonModel = Constant.get_jsonmodel(0, "success", 1);
                            //开启线程操作数据库
                            new Thread(() =>
                            {
                                try
                                {
                                    //通知缓存的领导删除/数据库删除该联系人[进行数据库操作]
                                    admin_delete_linkman(guid, delete_linkman);
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.Error(ex);
                                }
                            })
                            {
                                IsBackground = true
                            }.Start();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
        /// <summary>
        /// 修改定期评价
        /// </summary>
        public void Edit_Eva_Regular(HttpContext context)
        {
            HttpRequest Request = context.Request;
            //指标的ID
            int Id = RequestHelper.int_transfer(Request, "Id");

            //指标名称
            string   Name           = RequestHelper.string_transfer(Request, "Name");
            int      intSuccess     = (int)errNum.Success;
            DateTime StartTime      = RequestHelper.DateTime_transfer(Request, "StartTime");
            DateTime EndTime        = RequestHelper.DateTime_transfer(Request, "EndTime");
            byte     LookType       = Convert.ToByte(Request["LookType"]);
            DateTime Look_StartTime = RequestHelper.DateTime_transfer(Request, "Look_StartTime");
            DateTime Look_EndTime   = RequestHelper.DateTime_transfer(Request, "Look_EndTime");
            string   MaxPercent     = RequestHelper.string_transfer(Request, "MaxPercent");
            string   MinPercent     = RequestHelper.string_transfer(Request, "MinPercent");
            string   Remarks        = RequestHelper.string_transfer(Request, "Remarks");
            string   EditUID        = RequestHelper.string_transfer(Request, "EditUID");
            int      Section_Id     = RequestHelper.int_transfer(Request, "Section_Id");

            try
            {
                //获取指定要删除的定期评价
                Eva_Regular Eva_Regular_edit = Constant.Eva_Regular_List.FirstOrDefault(i => i.Id == Id);

                if (Eva_Regular_edit != null)
                {
                    //克隆该定期评价
                    Eva_Regular indic = Constant.Clone <Eva_Regular>(Eva_Regular_edit);
                    indic.Name           = Name;
                    indic.StartTime      = StartTime;
                    indic.EndTime        = EndTime;
                    indic.LookType       = LookType;
                    indic.Look_StartTime = Look_StartTime;
                    indic.Look_EndTime   = Look_EndTime;
                    indic.MaxPercent     = MaxPercent;
                    indic.MinPercent     = MinPercent;
                    indic.Remarks        = Remarks;
                    indic.EditUID        = EditUID;
                    indic.Section_Id     = Section_Id;

                    //数据库操作成功再改缓存
                    jsonModel = Constant.Eva_RegularService.Update(indic);
                    if (jsonModel.errNum == intSuccess)
                    {
                        Eva_Regular_edit.Name           = Name;
                        Eva_Regular_edit.StartTime      = StartTime;
                        Eva_Regular_edit.EndTime        = EndTime;
                        Eva_Regular_edit.LookType       = LookType;
                        Eva_Regular_edit.Look_StartTime = Look_StartTime;
                        Eva_Regular_edit.Look_EndTime   = Look_EndTime;
                        Eva_Regular_edit.MaxPercent     = MaxPercent;
                        Eva_Regular_edit.MinPercent     = MinPercent;
                        Eva_Regular_edit.Remarks        = Remarks;
                        Eva_Regular_edit.EditUID        = EditUID;
                        Eva_Regular_edit.Section_Id     = Section_Id;

                        //表格ID
                        string Table_IDs      = RequestHelper.string_transfer(Request, "Table_IDs");
                        string Course_TypeIDs = RequestHelper.string_transfer(Request, "Course_TypeIDs");
                        string Eva_Roles      = RequestHelper.string_transfer(Request, "Eva_Roles");
                        //类型转换
                        int[]    tables       = Split_Hepler.str_to_ints(Table_IDs);
                        string[] course_types = Split_Hepler.str_to_stringss(Course_TypeIDs);

                        int[] eva_roles = Split_Hepler.str_to_ints(Eva_Roles);
                        //获取相关的分配
                        List <Eva_Distribution> distri_list = (from dis in Constant.Eva_Distribution_List
                                                               where dis.Evaluate_Id == Eva_Regular_edit.Id
                                                               select dis).ToList();
                        foreach (Eva_Distribution item in distri_list)
                        {
                            item.IsDelete = (int)IsDelete.Delete;
                            JsonModel m2 = Constant.Eva_DistributionService.Update(item);
                            if (m2.errNum == intSuccess)
                            {
                                Constant.Eva_Distribution_List.Remove(item);

                                TableUsingAdd(item.Table_Id);
                            }
                        }
                        //添加分配
                        Reg_Table_Add_Helper(EditUID, EditUID, Eva_Regular_edit, tables, eva_roles, course_types);
                    }
                    else
                    {
                        jsonModel = JsonModel.get_jsonmodel(3, "failed", "修改失败");
                    }
                }
                else
                {
                    jsonModel = JsonModel.get_jsonmodel(3, "failed", "该评价不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #25
0
        public static decimal GetAward(Globe_Clue Globe_Clue, string PrizeContent, Operation_Record record, List <Animal_Info> Animal_Info_List, ref List <string> AwardList)
        {
            decimal getdecimal = 0;
            string  animals    = string.Empty;

            try
            {
                List <Animal_Info_S> Animal_Info_Ss = Animal_Info_S.GetBase(record.Buy_Content, Animal_Info_List, record.BuyPayReturn);

                List <int> contListall = Split_Hepler.str_to_ints(PrizeContent).ToList();

                int            count    = 0;
                LineAnimalType LineType = (LineAnimalType)Globe_Clue.Second_Type;
                if (LineType == LineAnimalType.二肖连中 || LineType == LineAnimalType.肖连中 || LineType == LineAnimalType.四肖连中 ||
                    LineType == LineAnimalType.五肖连中)
                {
                    foreach (var animal in Animal_Info_Ss)
                    {
                        foreach (var awardGlobe in contListall)
                        {
                            if (animal.GlobeCodeList.Contains(awardGlobe))
                            {
                                count++;
                                animals += animal.Name + ",";
                                break;
                            }
                        }
                    }
                    if (count >= Animal_Info_Ss.Count)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                        AwardList.Add(animals);
                    }
                }
                else if (LineType == LineAnimalType.二肖连不中 || LineType == LineAnimalType.肖连不中 || LineType == LineAnimalType.四肖连不中)
                {
                    foreach (var animal in Animal_Info_Ss)
                    {
                        bool NoAdd = false;
                        foreach (var awardGlobe in contListall)
                        {
                            if (animal.GlobeCodeList.Contains(awardGlobe))
                            {
                                NoAdd = true;
                                break;
                            }
                        }
                        if (!NoAdd)
                        {
                            count++;
                        }
                    }
                    if (count >= Animal_Info_Ss.Count)
                    {
                        getdecimal += (decimal)(record.MinPayReturn * record.UnitPrice);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(getdecimal);
        }
Example #26
0
        /// <summary>
        /// 编辑联系人
        /// </summary>
        /// <param name="id"></param>
        /// <param name="guid">用户id</param>
        private void edit_linkman(long id, string guid, cust_linkman new_linkman, string cust_leaders, string cust_leadernames)
        {
            try
            {
                //联系人列表,当前用户
                List <cust_linkman> cust_linkman_selfs = dic_Self[guid];
                cust_linkman        edit_linkman       = cust_linkman_selfs.FirstOrDefault(item => item.id == id);
                if (edit_linkman != null)
                {
                    edit_linkman.link_birthday    = new_linkman.link_birthday;
                    edit_linkman.link_cust_id     = new_linkman.link_cust_id;
                    edit_linkman.link_cust_name   = new_linkman.link_cust_name;
                    edit_linkman.link_department  = new_linkman.link_department;
                    edit_linkman.link_email       = new_linkman.link_email;
                    edit_linkman.link_level       = new_linkman.link_level;
                    edit_linkman.link_name        = new_linkman.link_name;
                    edit_linkman.link_phonenumber = new_linkman.link_phonenumber;
                    edit_linkman.link_position    = new_linkman.link_position;
                    edit_linkman.link_remark      = new_linkman.link_remark;
                    edit_linkman.link_sex         = new_linkman.link_sex;
                    edit_linkman.link_telephone   = new_linkman.link_telephone;

                    //查看是否有多负责人的情况
                    if (!string.IsNullOrEmpty(cust_leaders) && !string.IsNullOrEmpty(cust_leadernames))
                    {
                        string[] link_Users = Split_Hepler.str_to_stringss(edit_linkman.link_users);
                        for (int k = 0; k < link_Users.Count(); k++)
                        {
                            string link_user = link_Users[k];
                            //判断该用户是否在线 然后进行移除
                            if (!Constant.dicLimit_P.ContainsKey(link_user) && dic_Self.ContainsKey(link_user))
                            {
                                if (dic_Self[link_user].Contains(edit_linkman))
                                {
                                    dic_Self[link_user].Remove(edit_linkman);
                                }
                            }
                        }

                        edit_linkman.link_users     = cust_leaders;
                        edit_linkman.link_usersname = cust_leadernames;
                    }

                    //成功提示
                    jsonModel = Constant.get_jsonmodel(0, "success", 1);

                    //开启线程操作数据库
                    new Thread(() =>
                    {
                        jsonModel = Constant.bbc.edit_cust_linkman(edit_linkman);

                        //通知其他负责人进行添加
                        Add_Other_Users(edit_linkman, cust_leaders);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
        public void EditCourse(HttpContext context)
        {
            int         intSuccess = (int)errNum.Success;
            HttpRequest request    = context.Request;

            string Ids          = RequestHelper.string_transfer(request, "Ids");
            int    Enable       = RequestHelper.int_transfer(request, "Enable");
            int    CourseTypeId = RequestHelper.int_transfer(request, "CourseTypeId");
            int    Operation    = RequestHelper.int_transfer(request, "Operation");

            try
            {
                //课程变更【启用禁用】
                if (!string.IsNullOrEmpty(Ids))
                {
                    int[] Ids_ints = Split_Hepler.str_to_ints(Ids);

                    foreach (var id in Ids_ints)
                    {
                        //设置课程启用禁用
                        if (Operation == 1)
                        {
                            jsonModel = Constant.CourseService.GetEntityById(id);
                            if (jsonModel.errNum == 0)
                            {
                                Course s_course = jsonModel.retData as Course;
                                s_course.IsEnable = (byte)Enable;
                                JsonModel model = Constant.CourseService.Update(s_course);
                                if (jsonModel.errNum == 0)
                                {
                                    Course course = Constant.Course_List.FirstOrDefault(cour => cour.Id == id);
                                    course.IsEnable = s_course.IsEnable;
                                }
                            }
                        }
                        if (Operation == 2)
                        {
                            CourseRel courseRef = Constant.CourseRel_List.FirstOrDefault(re => re.Course_Id == Convert.ToString(id));
                            if (courseRef != null && CourseTypeId != 0)
                            {
                                CourseRel courseRef_Clone = Constant.Clone <CourseRel>(courseRef);
                                courseRef_Clone.CourseType_Id = Convert.ToString(CourseTypeId);
                                JsonModel model = Constant.CourseRelService.Update(courseRef_Clone);
                            }
                        }
                    }
                    jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", "0");
                }
                else
                {
                    jsonModel = JsonModel.get_jsonmodel((int)errNum.Failed, "failed", "数据出现异常");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Example #28
0
        public void SetUserToRole(HttpContext context)
        {
            int intSuccess = (int)errNum.Success;

            try
            {
                HttpRequest Request        = context.Request;
                string      UniqueNos      = RequestHelper.string_transfer(Request, "UniqueNo");
                int         Roleid         = RequestHelper.int_transfer(Request, "Roleid");
                string[]    us             = Split_Hepler.str_to_stringss(UniqueNos);
                bool        IsMutexCombine = RequestHelper.bool_transfer(Request, "IsMutexCombine");
                //互斥
                if (IsMutexCombine)
                {
                    //-----------------------------------------------------------------------
                    //先把选中的 角色进行判断性的变更【若不为改类型则设置为该类型】
                    foreach (var unique in us)
                    {
                        Sys_RoleOfUser Sys_RoleOfUser = Constant.Sys_RoleOfUser_List.FirstOrDefault(r => r.UniqueNo == unique);
                        if (Sys_RoleOfUser != null)
                        {
                            RoleUserUpdate(Roleid, Sys_RoleOfUser);
                        }
                        else
                        {
                            RoleUserAdd(Roleid, unique);
                        }
                    }
                }
                else
                {
                    //-----------------------------------------------------------------------
                    //先把选中的 角色进行判断性的变更【若不为改类型则设置为该类型】
                    foreach (var unique in us)
                    {
                        int count = Constant.Sys_RoleOfUser_List.Count(r => r.UniqueNo == unique && r.Role_Id == Roleid);
                        if (count == 0)
                        {
                            RoleUserAdd(Roleid, unique);
                        }
                    }
                }
                string[] deleteDatas = (from r in Constant.Sys_RoleOfUser_List where !us.Contains(r.UniqueNo) && r.Role_Id == Roleid select Convert.ToString(r.Id)).ToArray();
                if (deleteDatas.Count() > 0)
                {
                    var jsm = Constant.Sys_RoleOfUserService.DeleteBatch(deleteDatas);
                    if (jsm.errNum == 0)
                    {
                        Constant.Sys_RoleOfUser_List.RemoveAll(r => deleteDatas.Contains(Convert.ToString(r.Id)));
                    }
                }
                jsonModel = JsonModel.get_jsonmodel(intSuccess, "success", "0");
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }