Ejemplo n.º 1
0
        /// <summary>
        /// 编辑单位
        /// </summary>
        /// <returns></returns>
        public ActionResult Edit()
        {
            string MeasureName = WebUtil.GetFormValue <string>("MeasureName");
            string CompanyID   = WebUtil.GetFormValue <string>("CompanyID");
            string SN          = WebUtil.GetFormValue <string>("SN");
            string MeasureNum  = WebUtil.GetFormValue <string>("MeasureNum");

            MeasureEntity entity = new MeasureEntity();

            entity.MeasureName = MeasureName;
            entity.CompanyID   = CompanyID;
            entity.SN          = SN;
            entity.MeasureNum  = MeasureNum;

            MeasureProvider provider = new MeasureProvider(CompanyID);
            int             line     = provider.EditMeasure(entity);
            DataResult      result   = new DataResult();

            if (line > 0)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "单位修改成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "单位修改失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
Ejemplo n.º 2
0
 public ActionResult Create(string Num, string Name)
 {
     if (Num.IsEmpty())
     {
         MeasureEntity entity = new MeasureEntity();
         entity.MeasureNum  = SequenceProvider.GetSequence(typeof(MeasureEntity));
         entity.MeasureName = Name;
         entity.SN          = SequenceProvider.GetSequence(typeof(MeasureEntity));
         MeasureProvider provider = new MeasureProvider();
         int             line     = provider.AddMeasure(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("Key", "1000");
             this.ReturnJson.AddProperty("Value", "添加成功");
         }
         else
         {
             this.ReturnJson.AddProperty("Key", "1001");
             this.ReturnJson.AddProperty("Value", "添加失败");
         }
     }
     else
     {
         MeasureProvider provider = new MeasureProvider();
         int             line     = provider.EditMeasure(Num, Name);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("Key", "1000");
             this.ReturnJson.AddProperty("Value", "编辑成功");
         }
         else
         {
             this.ReturnJson.AddProperty("Key", "1001");
             this.ReturnJson.AddProperty("Value", "编辑失败");
         }
     }
     return(Content(this.ReturnJson.ToString()));
 }