Ejemplo n.º 1
0
        public static JsonModel AddUserMoney_Helper(int Id, decimal Money)
        {
            JsonModel jsm = null;

            try
            {
                List <UserInfo> UserInfo_List = Constant.UserInfo_List;

                UserInfo userinfo = UserInfo_List.FirstOrDefault(user => user.Id == Id);
                if (userinfo != null)
                {
                    UserInfo userClone = Constant.Clone <UserInfo>(userinfo);
                    userClone.Money += Money;
                    jsm              = Constant.UserInfo_S.Update(userClone);
                    if (jsm.errNum == 0)
                    {
                        userinfo.Money += Money;

                        Constant.MoneyAnsys(null, Money, userinfo, TLC_Model.Enums.MoneyType.充值, "");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "用户不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
        public void SetUserInfo(HttpContext context)
        {
            try
            {
                HttpRequest Request       = context.Request;
                string      UserName      = RequestHelper.string_transfer(Request, "UserNamae");
                string      TelePhone     = RequestHelper.string_transfer(Request, "TelePhone");
                string      UniqueNo      = RequestHelper.string_transfer(Request, "Userid");
                UserInfo    edit_userInfo = Constant.UserInfo_List.FirstOrDefault(u => u.UniqueNo == UniqueNo);

                UserInfo UserInfo_ = Constant.Clone <UserInfo>(edit_userInfo);
                UserInfo_.Name  = UserName;
                UserInfo_.Phone = TelePhone;
                //改数据库
                jsonModel = Constant.UserInfoService.Update(UserInfo_);
                if (jsonModel.errNum == 0)
                {
                    //改缓存
                    edit_userInfo.Name  = UserName;
                    edit_userInfo.Phone = TelePhone;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设置辅助
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="pay1"></param>
        /// <param name="pay2"></param>
        /// <returns></returns>
        public static JsonModel Globe_PaySetting_Helper(string Code, string pay1, string pay2, decimal Return_Pay, decimal Return_Pay2)
        {
            JsonModel jsm = null;

            try
            {
                //GlobeClueType GlobeClueType = (GlobeClueType)Enum.Parse(typeof(GlobeClueType), Type);
                Globe_Clue globe_Clue = Constant.Globe_Clue_List.FirstOrDefault(i => Convert.ToString(i.Code) == Code);
                if (globe_Clue != null)
                {
                    Globe_Clue globe_clue_clone = Constant.Clone <Globe_Clue>(globe_Clue);
                    globe_clue_clone.Pay         = pay1;
                    globe_clue_clone.Pay2        = pay2;
                    globe_clue_clone.Return_Pay  = Return_Pay;
                    globe_clue_clone.Return_Pay2 = Return_Pay2;
                    jsm = Constant.Globe_Clue_S.Update(globe_clue_clone);
                    if (jsm.errNum == 0)
                    {
                        globe_Clue.Pay         = pay1;
                        globe_Clue.Pay2        = pay2;
                        globe_Clue.Return_Pay  = Return_Pay;
                        globe_Clue.Return_Pay2 = Return_Pay2;
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "successed", "该规则不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
Ejemplo n.º 4
0
 public void TableUsingReduce(int?Table_Id)
 {
     try
     {
         //获取表的引用,减少引用次数
         Eva_Table table = Constant.Eva_Table_List.FirstOrDefault(t => Table_Id == t.Id);
         if (table != null)
         {
             //克隆该表格
             Eva_Table table_clone = Constant.Clone <Eva_Table>(table);
             if (table_clone.UseTimes > 0)
             {
                 table_clone.UseTimes -= 1;
                 JsonModel m3 = Constant.Eva_TableService.Update(table_clone);
                 if (m3.errNum == 0)
                 {
                     table.UseTimes -= 1;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 指标库引用减1
 /// </summary>
 /// <param name="Id"></param>
 private static void Indicate_Using_Reduce(int Id)
 {
     try
     {
         //指标库的计数
         Indicator Indicator       = Constant.Indicator_List.FirstOrDefault(t => t.Id == Id);
         Indicator Indicator_clone = Constant.Clone <Indicator>(Indicator);
         if (Indicator_clone.UseTimes > 0)
         {
             Indicator_clone.UseTimes -= 1;
             //直接进行更改
             if (Indicator_clone != null)
             {
                 JsonModel m = Constant.IndicatorService.Update(Indicator);
                 if (m.errNum == 0)
                 {
                     Indicator.UseTimes -= 1;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Ejemplo n.º 6
0
        public JsonModel DeleteCourseType_TableHelper(int Id)
        {
            int       intSuccess = (int)errNum.Success;
            JsonModel jsmodel    = new JsonModel();

            try
            {
                Eva_CourseType_Table delete_Eva_CourseType_Table = Constant.Eva_CourseType_Table_List.FirstOrDefault(i => i.Id == Id);

                if (delete_Eva_CourseType_Table != null)
                {
                    Eva_CourseType_Table delete_Eva_CourseType_Table_clone = Constant.Clone <Eva_CourseType_Table>(delete_Eva_CourseType_Table);
                    delete_Eva_CourseType_Table_clone.IsDelete = (int)IsDelete.Delete;
                    var jsmo = Constant.Eva_CourseType_TableService.Update(delete_Eva_CourseType_Table_clone);
                    if (jsmo.errNum == 0)
                    {
                        Constant.Eva_CourseType_Table_List.Remove(delete_Eva_CourseType_Table);
                        jsmodel = JsonModel.get_jsonmodel(intSuccess, "success", 0);

                        TableUsingReduce(delete_Eva_CourseType_Table_clone.TableId);
                    }
                    else
                    {
                        jsonModel = JsonModel.get_jsonmodel(3, "failed", "该项分配不存在");
                    }
                }
            }
            catch (Exception ex)
            {
                jsonModel = JsonModel.get_jsonmodel(3, "failed", ex.Message);
                LogHelper.Error(ex);
            }
            return(jsmodel);
        }
Ejemplo n.º 7
0
 private void User_Gourp_Edit_Helper(int Id, string Name, string UniqueNo)
 {
     try
     {
         if (Id > 0)
         {
             //编辑
             var role_edit = Constant.Sys_Role_List.FirstOrDefault(r => r.Id == Id);
             if (role_edit != null)
             {
                 var role_Clone = Constant.Clone <Sys_Role>(role_edit);
                 if (role_Clone != null)
                 {
                     role_Clone.Name     = Name;
                     role_Clone.EditTime = DateTime.Now;
                     role_Clone.EditUID  = UniqueNo;
                     jsonModel           = Constant.Sys_RoleService.Update(role_Clone);
                     if (jsonModel.errNum == 0)
                     {
                         role_edit.Name     = Name;
                         role_edit.EditTime = DateTime.Now;
                         role_edit.EditUID  = UniqueNo;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 修改指标分类
        /// </summary>
        public void Edit_IndicatorType(HttpContext context)
        {
            lock (obj_Edit_IndicatorType)
            {
                int intSuccess = (int)errNum.Success;
                try
                {
                    HttpRequest Request = context.Request;
                    //指标的ID
                    int Id = RequestHelper.int_transfer(Request, "Id");

                    //获取指定要删除的指标
                    IndicatorType IndicatorType_edit = Constant.IndicatorType_List.FirstOrDefault(i => i.Id == Id);

                    if (IndicatorType_edit != null)
                    {
                        string Name    = RequestHelper.string_transfer(Request, "Name");
                        string EditUID = RequestHelper.string_transfer(Request, "EditUID");
                        var    count   = Constant.Indicator_List.Count(i => i.IndicatorType_Id == Id && i.UseTimes > 0);
                        if (count == 0)
                        {
                            //克隆该指标
                            IndicatorType indic = Constant.Clone <IndicatorType>(IndicatorType_edit);
                            indic.Name    = Name;
                            indic.EditUID = EditUID;

                            //数据库操作成功再改缓存
                            jsonModel = Constant.IndicatorTypeService.Update(indic);
                            if (jsonModel.errNum == intSuccess)
                            {
                                IndicatorType_edit.Name    = Name;
                                IndicatorType_edit.EditUID = EditUID;
                            }
                            else
                            {
                                jsonModel = JsonModel.get_jsonmodel(3, "failed", "修改失败");
                            }
                        }
                        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) + "}");
                }
            }
        }
        public void Constant()
        {
            Constant inter = new Constant(controller);

            inter.DataType = new DataType(controller, "int");
            inter.Modifiers.Add("public");
            inter.Name = "CONSTANT1";

            Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 删除指标分类
        /// </summary>
        public void Delete_Indicator_Type(HttpContext context)
        {
            int         intSuccess = (int)errNum.Success;
            HttpRequest Request    = context.Request;
            //指标的ID
            int Id = RequestHelper.int_transfer(Request, "Id");

            try
            {
                //获取指定要删除的指标分类
                IndicatorType IndicatorType_delete = Constant.IndicatorType_List.FirstOrDefault(i => i.Id == Id);
                if (IndicatorType_delete != null)
                {
                    var count  = Constant.Indicator_List.Count(i => i.IndicatorType_Id == Id);
                    var count2 = Constant.IndicatorType_List.Count(i => i.Parent_Id == Id);
                    if (count == 0 && count2 == 0)
                    {
                        //克隆该指标
                        IndicatorType indic = Constant.Clone <IndicatorType>(IndicatorType_delete);
                        indic.IsDelete = (int)IsDelete.Delete;

                        //数据库操作成功再改缓存
                        jsonModel = Constant.IndicatorTypeService.Update(indic);
                        if (jsonModel.errNum == intSuccess)
                        {
                            IndicatorType_delete.IsDelete = (int)IsDelete.Delete;
                            Constant.IndicatorType_List.Remove(IndicatorType_delete);
                        }
                        else
                        {
                            jsonModel = JsonModel.get_jsonmodel(3, "failed", "删除失败");
                        }
                    }
                    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) + "}");
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AwardCode"></param>
        /// <param name="PayUID"></param>
        /// <returns></returns>
        public static JsonModel PayAward_Helper(int Code, string PayUID, string PrizeContent)
        {
            JsonModel jsm = null;

            try
            {
                List <Award_Public>     Award_Public_List     = Constant.Award_Public_List;
                List <Operation_Record> Operation_Record_List = Constant.Operation_Record_List;
                Award_Public            award_Public          = Award_Public_List.FirstOrDefault(p => p.Code == Code);
                if (award_Public != null)
                {
                    List <Operation_Record> recordList = (from op in Operation_Record_List where op.AwardCode == Code select op).ToList();
                    if (award_Public.IsCompleate == (int)IsCompleate.No)
                    {
                        foreach (var record in recordList)
                        {
                            AwardDealWidth(award_Public, record, PrizeContent);
                        }
                    }
                    jsm = JsonModel.GetJsonModel(0, "派奖成功");


                    Award_Public award_Edit_clone = Constant.Clone <Award_Public>(award_Public);
                    award_Edit_clone.PrizeContent = PrizeContent;
                    award_Edit_clone.EndTime      = DateTime.Now;
                    award_Edit_clone.IsCompleate  = (int)IsCompleate.Yes;
                    jsm = Constant.Award_Public_S.Update(award_Edit_clone);
                    if (jsm.errNum == 0)
                    {
                        award_Public.PrizeContent = PrizeContent;
                        award_Public.EndTime      = DateTime.Now;
                        award_Public.IsCompleate  = (int)IsCompleate.Yes;
                        jsm = JsonModel.GetJsonModel(0, "操作成功");
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "操作失败");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "该期不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 状态变更
        /// </summary>
        /// <param name="context"></param>
        public void Change_Eva_QuestionAnswer_State(HttpContext context)
        {
            int         intSuccess = (int)errNum.Success;
            int         intFailed  = (int)errNum.Failed;
            HttpRequest Request    = context.Request;
            int         Id         = RequestHelper.int_transfer(Request, "Id");
            int         State      = RequestHelper.int_transfer(Request, "State");

            try
            {
                Eva_QuestionAnswer answer = Constant.Eva_QuestionAnswer_List.FirstOrDefault(i => i.Id == Id);
                if (answer != null)
                {
                    Eva_QuestionAnswer answerClone = Constant.Clone(answer);
                    answerClone.State = State;
                    jsonModel         = Constant.Eva_QuestionAnswerService.Update(answerClone);
                    if (jsonModel.errNum == intSuccess)
                    {
                        answer.State = State;
                        List <Eva_QuestionAnswer_Detail> details = (from d in Constant.Eva_QuestionAnswer_Detail_List where d.QuestionID == Id select d).ToList();
                        foreach (var item in details)
                        {
                            Eva_QuestionAnswer_Detail detailClone = Constant.Clone(item);
                            detailClone.State = State;
                            var jsm = Constant.Eva_QuestionAnswer_DetailService.Update(detailClone);
                            if (jsm.errNum == 0)
                            {
                                item.State = State;
                            }
                        }
                    }
                }
                else
                {
                    jsonModel = JsonModel.get_jsonmodel(intFailed, "failed", "操作失败");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            finally
            {
                //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 编辑表格
 /// </summary>
 public void Enable_Eva_Table(HttpContext context)
 {
     lock (obj_Enable_Eva_Table)
     {
         int         intSuccess = (int)errNum.Success;
         HttpRequest Request    = context.Request;
         //表格Id
         int table_Id = RequestHelper.int_transfer(Request, "table_Id");
         int IsEnable = RequestHelper.int_transfer(Request, "IsEnable");
         try
         {
             //获取指定要删除的表格
             Eva_Table Eva_Table_edit = Constant.Eva_Table_List.FirstOrDefault(i => i.Id == table_Id);
             if (Eva_Table_edit != null)
             {
                 //克隆该表格
                 Eva_Table Eva_Table_clone = Constant.Clone <Eva_Table>(Eva_Table_edit);
                 Eva_Table_clone.IsEnable = (byte)IsEnable;
                 //数据库操作成功再改缓存
                 jsonModel = Constant.Eva_TableService.Update(Eva_Table_clone);
                 if (jsonModel.errNum == intSuccess)
                 {
                     Eva_Table_edit.IsEnable = (byte)IsEnable;
                 }
                 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) + "}");
         }
     }
 }
Ejemplo n.º 14
0
 private static void RoleUserUpdate(int Roleid, Sys_RoleOfUser Sys_RoleOfUser)
 {
     try
     {
         Sys_RoleOfUser Sys_RoleOfUser_Clone = Constant.Clone(Sys_RoleOfUser);
         Sys_RoleOfUser_Clone.Role_Id = Roleid;
         //改数据库
         JsonModel m1 = Constant.Sys_RoleOfUserService.Update(Sys_RoleOfUser_Clone);
         if (m1.errNum == 0)
         {
             Sys_RoleOfUser.Role_Id = Roleid;
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Ejemplo n.º 15
0
        public static JsonModel UpdatePassword_Helper(string LoginName, string oldPassword, string newPassword)
        {
            JsonModel jsm = null;

            try
            {
                List <UserInfo> UserInfo_List = Constant.UserInfo_List;
                UserInfo        userInfo      = UserInfo_List.FirstOrDefault(user => user.LoginName == LoginName);
                if (userInfo != null)
                {
                    string pass = DESEncrypt.Decrypt(userInfo.Password, userInfo.Salt);
                    if (oldPassword == pass)
                    {
                        UserInfo _usInfo = Constant.Clone <UserInfo>(userInfo);
                        _usInfo.Salt     = Utils.GetCheckCode(6);
                        _usInfo.Password = DESEncrypt.Encrypt(newPassword, _usInfo.Salt);
                        jsm = Constant.UserInfo_S.Update(_usInfo);
                        if (jsm.errNum == 0)
                        {
                            userInfo.Salt     = _usInfo.Salt;
                            userInfo.Password = _usInfo.Password;
                        }
                        else
                        {
                            jsm = JsonModel.GetJsonModel(300, "更改密码失败");
                        }
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "密码错误");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "该用户不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
 public void Edit_CourseType(HttpContext context)
 {
     try
     {
         HttpRequest    request  = context.Request;
         int            Id       = RequestHelper.int_transfer(request, "Id");
         string         Name     = RequestHelper.string_transfer(request, "Name");
         int            IsEnable = RequestHelper.int_transfer(request, "IsEnable");
         Sys_Dictionary dic      = Constant.Sys_Dictionary_List.FirstOrDefault(di => di.Id == Id);
         if (dic != null)
         {
             Sys_Dictionary dic_clone = Constant.Clone <Sys_Dictionary>(dic);
             dic_clone.Value    = Name;
             dic_clone.IsEnable = (byte)IsEnable;
             if (dic_clone != null)
             {
                 jsonModel = Constant.Sys_DictionaryService.Update(dic_clone);
                 if (jsonModel.errNum == 0)
                 {
                     dic.Value    = Name;
                     dic.IsEnable = (byte)IsEnable;
                 }
                 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) + "}");
     }
 }
Ejemplo n.º 17
0
 private void User_Gourp_Delete_Helper(int Id, string UniqueNo)
 {
     try
     {
         if (Id > 0)
         {
             //编辑
             var role_edit = Constant.Sys_Role_List.FirstOrDefault(r => r.Id == Id);
             if (role_edit != null)
             {
                 var r_Count = Constant.Sys_RoleOfUser_List.Count(i => i.Role_Id == Id);//角色成员
                 if (r_Count == 0)
                 {
                     var role_Clone = Constant.Clone <Sys_Role>(role_edit);
                     if (role_Clone != null)
                     {
                         role_Clone.IsDelete = 1;
                         role_Clone.EditUID  = UniqueNo;
                         role_Clone.EditTime = DateTime.Now;
                         jsonModel           = Constant.Sys_RoleService.Update(role_Clone);
                         if (jsonModel.errNum == 0)
                         {
                             role_edit.IsDelete = 1;
                             role_edit.EditUID  = UniqueNo;
                             role_edit.EditTime = DateTime.Now;
                             Constant.Sys_Role_List.Remove(role_edit);
                         }
                     }
                 }
                 else
                 {
                     jsonModel = JsonModel.get_jsonmodel(3, "已分配成员不可删除", 0);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
 }
Ejemplo n.º 18
0
        public void UplodeSubmit(HttpContext context)
        {
            HttpRequest Request  = context.Request;
            string      UniqueNo = RequestHelper.string_transfer(Request, "UniqueNo");
            string      ValueUrl = RequestHelper.string_transfer(Request, "ValueUrl");
            string      url      = "";



            UserInfo edit_userInfo = Constant.UserInfo_List.FirstOrDefault(u => u.UniqueNo == UniqueNo);
            UserInfo UserInfo_     = Constant.Clone <UserInfo>(edit_userInfo);

            UserInfo_.HeadPic = ValueUrl;
            //改数据库
            jsonModel = Constant.UserInfoService.Update(UserInfo_);
            if (jsonModel.errNum == 0)
            {
                //改缓存
                edit_userInfo.HeadPic = ValueUrl;
            }
            context.Response.Write(Constant.jss.Serialize(new { Result = ValueUrl, redata = ValueUrl }));
        }
 public void SetPassWord(HttpContext context)
 {
     try
     {
         HttpRequest Request     = context.Request;
         string      UniqueNo    = RequestHelper.string_transfer(Request, "Userid");
         string      NewPassWord = RequestHelper.string_transfer(Request, "NewPassWord");
         //OldPassWord
         string   OldPassWord   = RequestHelper.string_transfer(Request, "OldPassWord");
         UserInfo edit_userInfo = Constant.UserInfo_List.FirstOrDefault(u => u.UniqueNo == UniqueNo);
         if (edit_userInfo.ClearPassword != OldPassWord)
         {
             jsonModel.errMsg = "ClearPasswordError";
         }
         else
         {
             UserInfo UserInfo_ = Constant.Clone <UserInfo>(edit_userInfo);
             UserInfo_.ClearPassword = NewPassWord;
             //改数据库
             jsonModel = Constant.UserInfoService.Update(UserInfo_);
             if (jsonModel.errNum == 0)
             {
                 //改缓存
                 edit_userInfo.ClearPassword = NewPassWord;
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex);
     }
     finally
     {
         //无论后端出现什么问题,都要给前端有个通知【为防止jsonModel 为空 ,全局字段 jsonModel 特意声明之后进行初始化】
         context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
     }
 }
Ejemplo n.º 20
0
        public static JsonModel ResetPassword_Helper(int Id)
        {
            JsonModel jsm = null;

            try
            {
                List <UserInfo> UserInfo_List = Constant.UserInfo_List;

                UserInfo userinfo = UserInfo_List.FirstOrDefault(user => user.Id == Id);
                if (userinfo != null)
                {
                    UserInfo _usInfo = Constant.Clone <UserInfo>(userinfo);

                    _usInfo.Salt     = Utils.GetCheckCode(6);
                    _usInfo.Password = DESEncrypt.Encrypt(defaltPassword, _usInfo.Salt);
                    jsm = Constant.UserInfo_S.Update(_usInfo);
                    if (jsm.errNum == 0)
                    {
                        userinfo.Salt     = _usInfo.Salt;
                        userinfo.Password = _usInfo.Password;
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "更改密码失败");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "用户不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
Ejemplo n.º 21
0
        public static JsonModel BuyGlobe_Group_Helper(string UserID, int AwardCode, int ClueCode, string Buy_Content, string Buy_Content2,
                                                      int UnitPrice, decimal Using_Money, string BuyPayReturn, string BuyPayReturn2, float MinPayReturn, float MaxPayReturn)
        {
            JsonModel jsm = null;

            try
            {
                List <Operation_Record> Operation_Record_List = Constant.Operation_Record_List;
                List <UserInfo>         UserInfo_List         = Constant.UserInfo_List;
                UserInfo userInfo = UserInfo_List.FirstOrDefault(user => user.LoginName == Convert.ToString(UserID));
                if (userInfo != null)
                {
                    string pass = DESEncrypt.Decrypt(userInfo.Password, userInfo.Salt);

                    if (userInfo.Money >= Using_Money)
                    {
                        Operation_Record Operation_Record = new Operation_Record()
                        {
                            Buy_Content    = Buy_Content,
                            Buy_Content2   = Buy_Content2,
                            CreateUID      = userInfo.LoginName,
                            UnitPrice      = UnitPrice,
                            AwardCode      = AwardCode,
                            ClueCode       = ClueCode,
                            BuyPayReturn   = BuyPayReturn,
                            BuyPayReturn2  = BuyPayReturn2,
                            UserID         = UserID,
                            Using_Money    = Using_Money,
                            MinPayReturn   = (decimal)MinPayReturn,
                            MaxPayReturn   = (decimal)MaxPayReturn,
                            Type           = (int)DebtType.Group,
                            Operation_Time = DateTime.Now,
                            CreateTime     = DateTime.Now,
                            Get_Money      = 0,

                            Araw_ReturnMoney = 0,
                            Return_Money     = 0,
                            EditUID          = "",
                            IsDelete         = 0,
                            IsEnable         = (int)IsEnable.Enable,
                            IsWin            = (int)IsWinType.未开奖,
                            PayUID           = "",
                        };
                        JsonModel jsmo = Constant.Operation_Record_S.Add(Operation_Record);
                        if (jsmo.errNum == 0)
                        {
                            Operation_Record.Id = Convert.ToInt32(jsmo.retData);

                            UserInfo userInfo_Clone = Constant.Clone <UserInfo>(userInfo);
                            userInfo_Clone.Money -= Using_Money;
                            jsm = Constant.UserInfo_S.Update(userInfo_Clone);
                            if (jsm.errNum == 0)
                            {
                                userInfo.Money -= Using_Money;
                                Constant.Operation_Record_List.Add(Operation_Record);

                                //支出支入
                                //支出支入
                                Constant.MoneyAnsys(Operation_Record, Using_Money, userInfo, MoneyType.注, "");
                            }
                            else
                            {
                                jsm = JsonModel.GetJsonModel(500, "下注失败");
                            }
                        }
                        else
                        {
                            jsm = JsonModel.GetJsonModel(500, "下注失败");
                        }
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(400, "您当前的余额不足");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "未经授权");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 结果处理
        /// </summary>
        /// <param name="Award_Public"></param>
        /// <param name="record"></param>
        public static void AwardDealWidth(Award_Public Award_Public, Operation_Record record, string PrizeContent)
        {
            try
            {
                List <UserInfo>      UserInfo_List  = Constant.UserInfo_List;
                Globe_Clue           clue           = Constant.Globe_Clue_List.FirstOrDefault(i => i.Code == record.ClueCode);
                decimal              getMoney       = 0;
                List <Araw_Return_S> Araw_Return_Ss = new List <Araw_Return_S>();
                List <string>        NoAwardList    = new List <string>();
                List <string>        AwardList      = new List <string>();

                int paytype = 0;
                if (!string.IsNullOrEmpty(PrizeContent))
                {
                    if (clue != null)
                    {
                        switch ((GlobeClueType)clue.First_Type)
                        {
                        case GlobeClueType.Special:
                            getMoney = SpecialModel.GetAward(PrizeContent, record, Constant.Globe_List, Constant.Size_Special_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype);
                            break;

                        case GlobeClueType.Normal:
                            getMoney = NormalModel.GetAward(PrizeContent, record, Constant.Globe_List, ref AwardList);
                            break;

                        case GlobeClueType.SpecialNormal:
                            getMoney = SpecialNormalModel.GetAward(clue, PrizeContent, record, Constant.Globe_List, Constant.Size_SpecialNormal_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype);
                            break;

                        case GlobeClueType.NormalSix:
                            getMoney = NormalSixModel.GetAward(PrizeContent, record, Constant.Size_Six_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.Line:
                            getMoney = LineModel.GetAward(clue, PrizeContent, record, ref AwardList);
                            break;

                        case GlobeClueType.Wave:
                            getMoney = WaveModel.GetAward(PrizeContent, record, Constant.Wave_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.Detail:
                            getMoney = Globe_ClueDetail.GetAward(PrizeContent, record, Constant.Animal_Info_List, Constant.Detail_List, ref AwardList);
                            break;

                        case GlobeClueType.SpecialAnimal:
                            getMoney = SpecialAnimalModel.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref AwardList);
                            break;

                        case GlobeClueType.CombineAnimal:
                            getMoney = Globe_ClueCombineAnimal.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.LineAnimal:
                            getMoney = LineAnimalModel.GetAward(clue, PrizeContent, record, Constant.Animal_Info_List, ref AwardList);
                            break;

                        case GlobeClueType.LineDetail:
                            getMoney = LineDetaillModel.GetAward(clue, PrizeContent, record, Constant.Detail_List, ref AwardList);
                            break;

                        case GlobeClueType.NotAll:
                            getMoney = NotAllModel.GetAward(PrizeContent, record);
                            break;

                        default:
                            break;
                        }
                    }
                }
                //最终完成【结束】
                Operation_Record record_Clone = Constant.Clone <Operation_Record>(record);

                if (paytype == 1)
                {
                    //返率的钱
                    record_Clone.Return_Money = (decimal)(clue.Return_Pay2 * record_Clone.Using_Money);
                }
                else
                {
                    //返率的钱
                    record_Clone.Return_Money = (decimal)(clue.Return_Pay * record_Clone.Using_Money);
                }

                //获奖的钱
                record_Clone.Get_Money = (decimal)getMoney;

                if (Araw_Return_Ss.Count > 0)
                {
                    #region  和局的情况下

                    //record_Clone.IsWin = (int)IsWinType.综合;
                    //record_Clone.Araw_ReturnMoney = 0;
                    //record_Clone.Araw_RetrunContent = "和局:(";
                    //for (int i = 0; i < Araw_Return_Ss.Count ; i++)
                    //{
                    //    //和局返的钱
                    //    record_Clone.Araw_ReturnMoney += Araw_Return_Ss[i].Araw_Money;
                    //    if (i != Araw_Return_Ss.Count - 1)
                    //    {
                    //        record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ",";
                    //    }
                    //    else
                    //    {
                    //        record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ")";
                    //    }

                    //}
                    //if (NoAwardList.Count > 0)
                    //{
                    //    record_Clone.Araw_RetrunContent += "、不中奖:(";
                    //    for (int i = 0; i < NoAwardList.Count; i++)
                    //    {
                    //        if (i != NoAwardList.Count - 1)
                    //        {
                    //            record_Clone.Araw_RetrunContent += NoAwardList[i] += ",";
                    //        }
                    //        else
                    //        {
                    //            record_Clone.Araw_RetrunContent += NoAwardList[i] += ")";
                    //        }

                    //    }
                    //}

                    //if (AwardList.Count > 0)
                    //{
                    //    record_Clone.Araw_RetrunContent += "、中奖:(";
                    //    for (int i = 0; i < AwardList.Count; i++)
                    //    {
                    //        if (i != AwardList.Count - 1)
                    //        {
                    //            record_Clone.Araw_RetrunContent += AwardList[i] += ",";
                    //        }
                    //        else
                    //        {
                    //            record_Clone.Araw_RetrunContent += AwardList[i] += ")";
                    //        }

                    //    }
                    //}

                    #endregion
                }
                else if (record_Clone.Get_Money > 0)
                {
                    record_Clone.IsWin = (int)IsWinType.获奖;

                    if (AwardList.Count > 0)
                    {
                        record_Clone.Araw_RetrunContent += "中奖:(";
                        for (int i = 0; i < AwardList.Count; i++)
                        {
                            if (i != AwardList.Count - 1)
                            {
                                record_Clone.Araw_RetrunContent += AwardList[i] += ",";
                            }
                            else
                            {
                                record_Clone.Araw_RetrunContent += AwardList[i] += ")";
                            }
                        }
                    }
                }
                else
                {
                    record_Clone.IsWin = (int)IsWinType.未获奖;
                }

                var jsm = Constant.Operation_Record_S.Update(record_Clone);
                if (jsm.errNum == 0)
                {
                    record.Get_Money          = record_Clone.Get_Money;
                    record.Return_Money       = record_Clone.Return_Money;
                    record.Araw_ReturnMoney   = record_Clone.Araw_ReturnMoney;
                    record.Araw_RetrunContent = record_Clone.Araw_RetrunContent;
                    record.IsWin = record_Clone.IsWin;

                    UserInfo user = UserInfo_List.FirstOrDefault(u => u.LoginName == record.UserID);
                    if (user != null)
                    {
                        UserInfo userinfo_Clone = Constant.Clone <UserInfo>(user);
                        userinfo_Clone.Money += record_Clone.Get_Money;
                        userinfo_Clone.Money += record.Araw_ReturnMoney;
                        userinfo_Clone.Money += record.Return_Money;
                        var jsm2 = Constant.UserInfo_S.Update(userinfo_Clone);
                        if (jsm2.errNum == 0)
                        {
                            user.Money += record_Clone.Get_Money;
                            user.Money += record.Araw_ReturnMoney;
                            user.Money += record.Return_Money;

                            if (record.Get_Money > 0)
                            {
                                //支出支入
                                Constant.MoneyAnsys(record, (decimal)record.Get_Money, user, MoneyType.中奖, record.Araw_RetrunContent);
                            }
                            if (record.Araw_ReturnMoney > 0)
                            {
                                //支出支入
                                //Constant.MoneyAnsys(record, (decimal)record.Araw_ReturnMoney, user, MoneyType.综合, record.Araw_RetrunContent);
                            }
                            if (record.Return_Money > 0)
                            {
                                //支出支入
                                Constant.MoneyAnsys(record, (decimal)record.Return_Money, user, MoneyType.返还奖金, "");
                            }
                        }
                        else
                        {
                            jsm = JsonModel.GetJsonModel(300, "操作失败");
                        }
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "操作失败");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "操作失败");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
Ejemplo n.º 23
0
 public override Constant VisitConstant(Constant node)
 {
     return(base.VisitConstant((Constant)node.Clone()));
 }
Ejemplo n.º 24
0
        public static JsonModel EditAward_Helper(int Id, string EditUID, int Year, int Name,
                                                 string PrizeContent, DateTime StartTime, DateTime EndTime, DateTime CloseTime)
        {
            JsonModel jsm = null;

            try
            {
                List <Award_Public> Award_Public_List = Constant.Award_Public_List;
                Award_Public        award_Edit        = Award_Public_List.FirstOrDefault(award => award.Id == Id);
                if (award_Edit != null)
                {
                    Award_Public award_Public = Award_Public_List.FirstOrDefault(p => p.Year == Year && p.Name == Name && p.Id != Id);
                    if (award_Public == null)
                    {
                        var  Eva_Regular_Lists = (from award in Award_Public_List where award.Id != Id select award).ToList();
                        bool hasAcross         = false;
                        foreach (Award_Public regu in Eva_Regular_Lists)
                        {
                            //if (StartTime <= regu.StartTime && EndTime >= regu.CloseTime)
                            //{
                            //    hasAcross = true;
                            //    break;
                            //}
                            if (StartTime >= regu.StartTime && StartTime <= regu.CloseTime)
                            {
                                hasAcross = true;
                                break;
                            }
                            //if (EndTime >= regu.StartTime && EndTime <= regu.CloseTime)
                            //{
                            //    hasAcross = true;
                            //    break;
                            //}
                        }
                        if (!hasAcross)
                        {
                            Award_Public award_Edit_clone = Constant.Clone <Award_Public>(award_Edit);
                            award_Edit_clone.EditUID      = EditUID;
                            award_Edit_clone.Year         = Year;
                            award_Edit_clone.Name         = Name;
                            award_Edit_clone.PrizeContent = PrizeContent;
                            award_Edit_clone.EndTime      = EndTime;
                            award_Edit_clone.StartTime    = StartTime;
                            award_Edit_clone.CloseTime    = CloseTime;
                            jsm = Constant.Award_Public_S.Update(award_Edit_clone);
                            if (jsm.errNum == 0)
                            {
                                award_Edit.EditUID      = EditUID;
                                award_Edit.Year         = Year;
                                award_Edit.Name         = Name;
                                award_Edit.PrizeContent = PrizeContent;
                                award_Edit.EndTime      = EndTime;
                                award_Edit.StartTime    = StartTime;
                                award_Edit.CloseTime    = CloseTime;
                                jsm = JsonModel.GetJsonModel(0, "操作成功");
                            }
                            else
                            {
                                jsm = JsonModel.GetJsonModel(300, "操作失败");
                            }
                        }
                        else
                        {
                            jsm = JsonModel.GetJsonModel(300, "和已知的奖项时间交叉");
                        }
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "该期已存在");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "该奖项不存在");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 编辑表格
        /// </summary>
        public void Edit_Eva_Table(HttpContext context)
        {
            lock (obj_Edit_Eva_Table)
            {
                int         intSuccess = (int)errNum.Success;
                HttpRequest Request    = context.Request;
                //表格Id
                int table_Id = RequestHelper.int_transfer(Request, "table_Id");
                try
                {
                    //获取指定要删除的表格
                    Eva_Table Eva_Table_edit = Constant.Eva_Table_List.FirstOrDefault(i => i.Id == table_Id);
                    if (Eva_Table_edit != null)
                    {
                        string Name = RequestHelper.string_transfer(Request, "Name");

                        int    IsScore       = RequestHelper.int_transfer(Request, "IsScore");
                        string Remarks       = RequestHelper.string_transfer(Request, "Remarks");
                        string EditUID       = RequestHelper.string_transfer(Request, "EditUID");
                        string CourseType_Id = RequestHelper.string_transfer(Request, "CourseType_Id");

                        int IsEnable = RequestHelper.int_transfer(Request, "IsEnable");
                        //克隆该表格
                        Eva_Table Eva_Table_clone = Constant.Clone <Eva_Table>(Eva_Table_edit);
                        Eva_Table_clone.Name     = Name;
                        Eva_Table_clone.IsScore  = (byte)IsScore;
                        Eva_Table_clone.Remarks  = Remarks;
                        Eva_Table_clone.EditTime = DateTime.Now;
                        Eva_Table_clone.EditUID  = EditUID;
                        Eva_Table_clone.IsEnable = (byte)IsEnable;
                        //数据库操作成功再改缓存
                        jsonModel = Constant.Eva_TableService.Update(Eva_Table_clone);
                        if (jsonModel.errNum == intSuccess)
                        {
                            Eva_Table_edit.Name     = Name;
                            Eva_Table_edit.IsScore  = (byte)IsScore;
                            Eva_Table_edit.Remarks  = Remarks;
                            Eva_Table_edit.EditTime = DateTime.Now;
                            Eva_Table_edit.EditUID  = EditUID;
                            Eva_Table_edit.IsEnable = (byte)IsEnable;
                            //表单明细
                            string List = RequestHelper.string_transfer(Request, "List");

                            //序列化表单详情列表
                            List <Table_A> Table_A_List = JsonConvert.DeserializeObject <List <Table_A> >(List);
                            //先进行删除,然后进行添加
                            List <Eva_TableDetail> table_list = (from t in Constant.Eva_TableDetail_List where t.Eva_table_Id == Eva_Table_edit.Id select t).ToList();

                            //删除详情表
                            foreach (Eva_TableDetail item in table_list)
                            {
                                JsonModel m = Constant.Eva_TableDetailService.Delete((int)item.Id);
                                if (m.errNum == intSuccess)
                                {
                                    Constant.Eva_TableDetail_List.Remove(item);
                                    Indicate_Using_Reduce((int)item.Indicator_Id);
                                }
                            }
                            Remove_Header((int)Eva_Table_edit.Id);

                            //解析正常才可进行操作
                            if (Table_A_List != null)
                            {
                                //表格详情表创建添加
                                Eva_TableAdd_Helper(Eva_Table_edit.EditUID, EditUID, Eva_Table_edit, Table_A_List);

                                string head_value = RequestHelper.string_transfer(Request, "head_value");
                                //string lisss = RequestHelper.string_transfer(Request, "lisss");
                                //表头信息添加
                                Table_Header((int)Eva_Table_edit.Id, head_value);//lisss
                            }
                        }
                        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) + "}");
                }
            }
        }
Ejemplo n.º 26
0
 public override Constant VisitConstant(Constant node)
 {
     //Contract.Requires(node != null);
     Contract.Ensures(Contract.Result <Constant>() != null);
     return(base.VisitConstant((Constant)node.Clone()));
 }
        /// <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) + "}");
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 删除表格
        /// </summary>
        public void Delete_Eva_Table(HttpContext context)
        {
            int         intSuccess = (int)errNum.Success;
            HttpRequest Request    = context.Request;
            //指标的ID
            int Id = RequestHelper.int_transfer(Request, "Id");

            try
            {
                //获取指定要删除的表格
                Eva_Table Eva_Table_delete = Constant.Eva_Table_List.FirstOrDefault(i => i.Id == Id);
                if (Eva_Table_delete != null)
                {
                    //克隆该表格
                    Eva_Table indic = Constant.Clone <Eva_Table>(Eva_Table_delete);
                    indic.IsDelete = (int)IsDelete.Delete;
                    //数据库操作成功再改缓存
                    jsonModel = Constant.Eva_TableService.Update(indic);
                    if (jsonModel.errNum == intSuccess)
                    {
                        Eva_Table_delete.IsDelete = (int)IsDelete.Delete;
                        Constant.Eva_Table_List.Remove(Eva_Table_delete);
                        List <Eva_Table_Header> Eva_Table_Header_List = Constant.Eva_Table_Header_List.Where(t => t.Table_Id == Id).ToList();
                        foreach (Eva_Table_Header item in Eva_Table_Header_List)
                        {
                            item.IsDelete = (int)IsDelete.Delete;
                            var jm = Constant.Eva_Table_HeaderService.Update(item);
                            if (jm.errNum == 0)
                            {
                                Constant.Eva_Table_Header_List.Remove(item);
                            }
                        }

                        List <Eva_TableDetail> Eva_TableDetail_List = Constant.Eva_TableDetail_List.Where(t => t.Eva_table_Id == Id).ToList();
                        foreach (Eva_TableDetail item in Eva_TableDetail_List)
                        {
                            item.IsDelete = (int)IsDelete.Delete;
                            var jsonmodel = Constant.Eva_TableDetailService.Update(item);
                            if (jsonmodel.errNum == 0)
                            {
                                Constant.Eva_TableDetail_List.Remove(item);
                                Indicate_Using_Reduce((int)item.Indicator_Id);
                            }
                        }
                    }
                    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) + "}");
            }
        }
Ejemplo n.º 29
0
        public JsonModel AddCourseType_TableHelper(string CourseTypeId, string CreateUID, List <int> tableList, int SectionId)
        {
            int       intSuccess = (int)errNum.Success;
            JsonModel jsmodel    = new JsonModel();

            try
            {
                jsmodel = JsonModel.get_jsonmodel(intSuccess, "success", 0);
                //   where t.IsEnable == (int)IsEnable.Enable
                var tablss_add = (from vir_t in tableList
                                  join tab_c in Constant.Eva_CourseType_Table_List on new
                {
                    TableId = vir_t,
                    CourseTypeId = CourseTypeId,
                    SectionID = SectionId,
                } equals new
                {
                    TableId = (int)tab_c.TableId,
                    CourseTypeId = tab_c.CourseTypeId,
                    SectionID = (int)tab_c.StudySection_Id,
                } into tabc_cs
                                  from tac_ in tabc_cs.DefaultIfEmpty()
                                  where tac_ == null
                                  select new { tac_, vir_t }).ToList();

                var tablss_delete = (from tab_c in Constant.Eva_CourseType_Table_List
                                     where tab_c.CourseTypeId == CourseTypeId && tab_c.StudySection_Id == SectionId
                                     join t in Constant.Eva_Table_List on tab_c.TableId equals t.Id

                                     join vir_t in tableList on t.Id equals vir_t into vir_ts
                                     from vir_t_ in vir_ts.DefaultIfEmpty()
                                     where vir_t_ == 0
                                     select new { tab_c, vir_t_ }).ToList();

                foreach (var item in tablss_add)
                {
                    Eva_CourseType_Table ect = new Eva_CourseType_Table()
                    {
                        CourseTypeId    = CourseTypeId,
                        CreateTime      = DateTime.Now,
                        CreateUID       = CreateUID,
                        IsDelete        = (int)IsDelete.No_Delete,
                        TableId         = item.vir_t,
                        StudySection_Id = SectionId,
                    };
                    var jsmo = Constant.Eva_CourseType_TableService.Add(ect);
                    if (jsmo.errNum == 0)
                    {
                        Constant.Eva_CourseType_Table_List.Add(ect);
                        ect.Id = Convert.ToInt32(jsmo.retData);
                        TableUsingAdd(ect.TableId);
                    }
                    else
                    {
                        jsonModel = JsonModel.get_jsonmodel(3, "failed", "内部错误");
                        break;
                    }
                }

                foreach (var item in tablss_delete)
                {
                    Eva_CourseType_Table eva_CourseType_Table_clone = Constant.Clone <Eva_CourseType_Table>(item.tab_c);
                    eva_CourseType_Table_clone.IsDelete = (int)IsDelete.Delete;
                    var jsm = Constant.Eva_CourseType_TableService.Update(eva_CourseType_Table_clone);
                    if (jsm.errNum == 0)
                    {
                        Constant.Eva_CourseType_Table_List.Remove(item.tab_c);
                    }
                    else
                    {
                        jsonModel = JsonModel.get_jsonmodel(3, "failed", "内部错误");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                jsonModel = JsonModel.get_jsonmodel(3, "failed", ex.Message);
                LogHelper.Error(ex);
            }
            return(jsmodel);
        }
        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) + "}");
            }
        }