コード例 #1
0
 /// <summary>
 /// 添加计划
 /// </summary>
 /// <param name="ht">参数Key:Id</param>
 /// <returns></returns>
 public JsonModel AddHonor(EmsModel.Honor model)
 {
     try
     {
         var       data      = dal.GetData(model);
         JsonModel jsonModel = new JsonModel();
         if (data != null)
         {
             jsonModel.Status = "no";
             jsonModel.Msg    = "绩效名称已存在!";
             return(jsonModel);
         }
         int result = dal.Add(model);
         //定义JSON标准格式实体中
         if (result > 0)
         {
             jsonModel.Status = "ok";
             jsonModel.Msg    = "添加成功";
         }
         else
         {
             jsonModel.Status = "no";
             jsonModel.Msg    = "添加失败";
         }
         return(jsonModel);
     }
     catch (Exception ex)
     {
         JsonModel jsonModel = new JsonModel();
         jsonModel.Status = "error";
         jsonModel.Msg    = ex.ToString();
         return(jsonModel);
     }
 }
コード例 #2
0
 /// <summary>
 /// 修改计划
 /// </summary>
 /// <param name="ht">参数Key:Id</param>
 /// <returns></returns>
 public JsonModel UpdateHonor(Hashtable ht)
 {
     try
     {
         EmsModel.Honor ModelPlan = dal.GetData(ht["Id"].ToString())[0];
         ModelPlan.Name         = ht["Name"].ToString();                          //教学计划名称
         ModelPlan.HonorLevel   = Convert.ToInt32(ht["HonorLevel"].ToString());   //教学计划内容
         ModelPlan.ExperimentId = Convert.ToInt32(ht["ExperimentId"].ToString()); //学年学期ID
         //ModelPlan.Creator = Creator;//创建人登录名
         //ModelPlan.CreateTime = DateTime.Now;//创建时间
         ModelPlan.Editor     = ht["Editor"].ToString(); //修改人登录名
         ModelPlan.UpdateTime = DateTime.Now;            //修改时间
         JsonModel jsonModel = new JsonModel();
         if (ModelPlan.Name != ht["preName"].ToString())
         {
             var data = dal.GetData(ModelPlan);
             if (data != null)
             {
                 jsonModel.Status = "no";
                 jsonModel.Msg    = "绩效名称已存在!";
                 return(jsonModel);
             }
         }
         int result = dal.Update(ModelPlan);
         //定义JSON标准格式实体中
         if (result > 0)
         {
             jsonModel.Status = "ok";
             jsonModel.Msg    = "修改成功";
         }
         else
         {
             jsonModel.Status = "no";
             jsonModel.Msg    = "修改失败";
         }
         return(jsonModel);
     }
     catch (Exception ex)
     {
         JsonModel jsonModel = new JsonModel();
         jsonModel.Status = "error";
         jsonModel.Msg    = ex.ToString();
         return(jsonModel);
     }
 }