private void ChangeRewardEditionAllot(HttpContext context)
 {
     try
     {
         int Id = Convert.ToInt32(context.Request["Id"]);
         TPM_RewardEdition model = RewardEdition_bll.GetEntityById(Id).retData as TPM_RewardEdition;
         model.IsMoneyAllot = Convert.ToByte(context.Request["IsMoneyAllot"]);
         jsonModel          = RewardEdition_bll.Update(model);
     }
     catch (Exception ex)
     {
         jsonModel = new JsonModel()
         {
             errNum  = 400,
             errMsg  = ex.Message,
             retData = ""
         };
         LogService.WriteErrorLog(ex.Message);
     }
 }
 private void AddRewardEditionData(HttpContext context)
 {
     try
     {
         int      Id        = RequestHelper.int_transfer(context.Request, "Id");
         int      lid       = RequestHelper.int_transfer(context.Request, "LID");
         DateTime beginTime = RequestHelper.DateTime_transfer(context.Request, "BeginTime");
         DateTime endTime   = RequestHelper.DateTime_transfer(context.Request, "EndTime");
         //" BeginTime>" +endTime + " or EndTime<"+beginTime 时间不重叠(not取非,获取不重叠)
         string    id_str = Id == 0 ? "" : " and Id!=" + Id;
         Hashtable ht     = new Hashtable();
         ht.Add("TableName", "TPM_RewardEdition");
         JsonModel edition_result = RewardEdition_bll.GetPage(ht, false, id_str + " and IsDelete=0 and lid=" + lid + " and not( convert(varchar(10),BeginTime,21)>'" + context.Request["endTime"] + "' or convert(varchar(10),EndTime,21)<'" + context.Request["beginTime"] + "')");
         if (edition_result.errNum == 0)
         {
             jsonModel = JsonModel.get_jsonmodel(-1, "与其他版本时间交叉!", edition_result.retData);
             return;
         }
         if (Id == 0)
         {
             TPM_RewardEdition model = new TPM_RewardEdition();
             model.Name      = context.Request["Name"];
             model.LID       = lid;
             model.BeginTime = beginTime;
             model.EndTime   = endTime;
             jsonModel       = RewardEdition_bll.Add(model);
             Id = Convert.ToInt32(jsonModel.retData);
         }
         else
         {
             TPM_RewardEdition model = RewardEdition_bll.GetEntityById(Id).retData as TPM_RewardEdition;
             model.Name      = context.Request["Name"];
             model.BeginTime = beginTime;
             model.EndTime   = endTime;
             jsonModel       = RewardEdition_bll.Update(model);
         }
         if (jsonModel.errNum == 0)
         {
             string add_Path    = RequestHelper.string_transfer(context.Request, "Add_Path");
             string edit_PathId = RequestHelper.string_transfer(context.Request, "Edit_PathId");
             if (!string.IsNullOrEmpty(add_Path) || !string.IsNullOrEmpty(edit_PathId))
             {
                 List <Sys_Document> pathlist = new List <Sys_Document>();
                 if (!string.IsNullOrEmpty(add_Path))
                 {
                     pathlist = JsonConvert.DeserializeObject <List <Sys_Document> >(add_Path);
                 }
                 new Sys_DocumentService().OperDocument(pathlist, edit_PathId, Id);
             }
         }
     }
     catch (Exception ex)
     {
         jsonModel = new JsonModel()
         {
             errNum  = 400,
             errMsg  = ex.Message,
             retData = ""
         };
         LogService.WriteErrorLog(ex.Message);
     }
 }
示例#3
0
 private void AddRewardEditionData(HttpContext context)
 {
     try
     {
         int      Id        = RequestHelper.int_transfer(context.Request, "Id");
         int      lid       = RequestHelper.int_transfer(context.Request, "LID");
         DateTime beginTime = RequestHelper.DateTime_transfer(context.Request, "BeginTime");
         DateTime endTime   = RequestHelper.DateTime_transfer(context.Request, "EndTime");
         //" BeginTime>" +endTime + " or EndTime<"+beginTime 时间不重叠(not取非,获取不重叠)
         string    id_str = Id == 0 ? "" : " and Id!=" + Id;
         Hashtable ht     = new Hashtable();
         ht.Add("TableName", "TPM_RewardEdition");
         JsonModel edition_result = RewardEdition_bll.GetPage(ht, false, id_str + " and IsDelete=0 and lid=" + lid + " and not( convert(varchar(10),BeginTime,21)>'" + context.Request["endTime"] + "' or convert(varchar(10),EndTime,21)<'" + context.Request["beginTime"] + "')");
         if (edition_result.errNum == 0)
         {
             jsonModel = JsonModel.get_jsonmodel(-1, "与其他版本时间交叉!", edition_result.retData);
             return;
         }
         if (Id == 0)
         {
             TPM_RewardEdition model = new TPM_RewardEdition();
             model.Name      = context.Request["Name"];
             model.LID       = lid;
             model.BeginTime = beginTime;
             model.EndTime   = endTime;
             jsonModel       = RewardEdition_bll.Add(model);
             Id = Convert.ToInt32(jsonModel.retData);
         }
         else
         {
             //版本编辑时判断时间(时间、时间已在业绩中使用)
             string definddates = SQLHelp.ExecuteScalar(@"select STUFF((select '、' + CAST(CONVERT(varchar(10),a.DefindDate,21) AS NVARCHAR(MAX)) from TPM_AcheiveRewardInfo a  
                          left join TPM_RewardLevel lev on lev.Id = a.Lid
                           where a.IsDelete = 0 and lev.EID =" + lid + " and(a.DefindDate < '" + context.Request["beginTime"] + "' or a.DefindDate > '" + context.Request["endTime"] + "') FOR xml path('')), 1, 1, '')", CommandType.Text, null).ToString();
             if (!string.IsNullOrEmpty(definddates))
             {
                 jsonModel = JsonModel.get_jsonmodel(-2, "日期" + definddates + "已在业绩中使用!", "");
                 return;
             }
             TPM_RewardEdition model = RewardEdition_bll.GetEntityById(Id).retData as TPM_RewardEdition;
             model.Name      = context.Request["Name"];
             model.BeginTime = beginTime;
             model.EndTime   = endTime;
             jsonModel       = RewardEdition_bll.Update(model);
         }
         if (jsonModel.errNum == 0)
         {
             string add_Path    = RequestHelper.string_transfer(context.Request, "Add_Path");
             string edit_PathId = RequestHelper.string_transfer(context.Request, "Edit_PathId");
             if (!string.IsNullOrEmpty(add_Path) || !string.IsNullOrEmpty(edit_PathId))
             {
                 List <Sys_Document> pathlist = new List <Sys_Document>();
                 if (!string.IsNullOrEmpty(add_Path))
                 {
                     pathlist = JsonConvert.DeserializeObject <List <Sys_Document> >(add_Path);
                 }
                 new Sys_DocumentService().OperDocument(pathlist, edit_PathId, Id);
             }
         }
     }
     catch (Exception ex)
     {
         jsonModel = new JsonModel()
         {
             errNum  = 400,
             errMsg  = ex.Message,
             retData = ""
         };
         LogService.WriteErrorLog(ex.Message);
     }
 }