コード例 #1
0
 public ActionResult Delete(string Num)
 {
     MeasureProvider provider = new MeasureProvider();
     int line = provider.DeleteMeasure(Num);
     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());
 }
コード例 #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());
 }
コード例 #3
0
 public ActionResult GetMeasure()
 {
     string name = WebUtil.GetFormValue<string>("name",string.Empty);
     int pageIndex = WebUtil.GetFormValue<int>("pageIndex",1);
     int pageSize = WebUtil.GetFormValue<int>("pageSize", 10);
     PageInfo pageInfo = new PageInfo() { PageIndex=1,PageSize=pageSize };
     MeasureProvider provider = new MeasureProvider();
     MeasureEntity entity = new MeasureEntity();
     entity.MeasureName = name;
     List<MeasureEntity> listResult = provider.GetList(entity, ref pageInfo);
     listResult = listResult.IsNull() ? new List<MeasureEntity>() : listResult;
     string json = ConvertJson.ListToJson<MeasureEntity>(listResult);
     this.ReturnJson.AddProperty("List",json);
     this.ReturnJson.AddProperty("RowCount",pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
コード例 #4
0
ファイル: BaseHelper.cs プロジェクト: ZhangHanLong/gitwms
 /// <summary>
 /// 产品单位
 /// </summary>
 /// <param name="MeasureNum"></param>
 /// <returns></returns>
 public static string GetMeasureNameList(string MeasureNum)
 {
     MeasureProvider provider = new MeasureProvider();
     List<MeasureEntity> list = provider.GetList();
     StringBuilder sb = new StringBuilder();
     string template = "<option value='{0}' {1}>{2}</option>";
     sb.AppendFormat(template, "", "", "请选择单位");
     if (!list.IsNullOrEmpty())
     {
         foreach (MeasureEntity measure in list)
         {
             sb.AppendFormat(template, measure.MeasureNum, measure.MeasureNum == MeasureNum ? "selected='selected'" : string.Empty, measure.MeasureName);
         }
     }
     return sb.ToString();
 }