public string Add(FormCollection context)
        {
            try
            {
                UserBll.Instance.CheckUserOnlingState();

                //var rpm = GetRpm(context);

                TB_REVIEWTEAMModel model = new TB_REVIEWTEAMModel();
                model.FNAME      = context["FNAME"];
                model.FBILL_TYPE = context["FBILL_TYPE"].ToInt();
                if (string.IsNullOrEmpty(model.FNAME))
                {
                    return(JSONhelper.ToJson(new { message = "名称不能为空!", errCode = -1 }));
                }
                model.FREMARK = context["FREMARK"];

                string fid = TB_REVIEWTEAMDal.Instance.Insert(model);
                if (fid != "")
                {
                    return(JSONhelper.ToJson(new { message = "添加审批组成功!", errCode = 0 }));
                }
                else
                {
                    return(JSONhelper.ToJson(new { message = "添加审批组失败!", errCode = -1 }));
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(JSONhelper.ToJson(new { errCode = -1, message = ex.Message }));
            }
        }
        public string Edit(FormCollection context)
        {
            try
            {
                UserBll.Instance.CheckUserOnlingState();

                string             fid = context["FID"];
                TB_REVIEWTEAMModel old = TB_REVIEWTEAMBll.Instance.GetByID(fid);

                if (old == null)
                {
                    return(JSONhelper.ToJson(new { errCode = -1, errMsg = "保存失败!" }));
                }
                old.FNAME      = context["FNAME"];
                old.FREMARK    = context["FREMARK"];
                old.FBILL_TYPE = context["FBILL_TYPE"].ToInt();
                int a = TB_REVIEWTEAMBll.Instance.Update(old);
                if (a > 0)
                {
                    return(JSONhelper.ToJson(new { errCode = 0 }));
                }
                else
                {
                    return(JSONhelper.ToJson(new { errCode = -1, errMsg = "保存失败!" }));
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message }));
            }
        }
        public string Delete(FormCollection context)
        {
            try
            {
                UserBll.Instance.CheckUserOnlingState();

                var rpm = GetRpm(context);
                TB_REVIEWTEAMModel old = TB_REVIEWTEAMBll.Instance.GetByID(rpm.FID);
                if (old == null)
                {
                    return(JSONhelper.ToJson(new { errCode = -1, errMsg = "删除失败!" }));
                }
                int a = TB_REVIEWTEAMBll.Instance.DeleteByID(rpm.FID);

                if (a > 0)
                {
                    return(JSONhelper.ToJson(new { errCode = 0 }));
                }
                else
                {
                    return(JSONhelper.ToJson(new { errCode = -1, errMsg = "删除失败!" }));
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message }));
            }
        }
Example #4
0
 public int Update(TB_REVIEWTEAMModel model)
 {
     return(TB_REVIEWTEAMDal.Instance.Update(model));
 }