// // GET: /FMM/ClientConfigAttribute/Detail public async Task <ActionResult> Detail(string clientName, string attributeName) { using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { MethodReturnResult <ClientConfigAttribute> result = await client.GetAsync(new ClientConfigAttributeKey() { ClientName = clientName, AttributeName = attributeName }); if (result.Code == 0) { ClientConfigAttributeViewModel viewModel = new ClientConfigAttributeViewModel() { ClientName = result.Data.Key.ClientName, AttributeName = result.Data.Key.AttributeName, Value = result.Data.Value, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
public async Task <ActionResult> Save(ClientConfigAttributeViewModel model) { using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { ClientConfigAttribute obj = new ClientConfigAttribute() { Key = new ClientConfigAttributeKey() { ClientName = model.ClientName, AttributeName = model.AttributeName }, Value = model.Value, Editor = User.Identity.Name, EditTime = DateTime.Now, }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.ClientConfigAttribute_Save_Success , obj.Key); } return(Json(rst)); } }
public async Task <ActionResult> SaveModify(ClientConfigAttributeViewModel model) { using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { MethodReturnResult <ClientConfigAttribute> result = await client.GetAsync(new ClientConfigAttributeKey() { ClientName = model.ClientName, AttributeName = model.AttributeName }); if (result.Code == 0) { result.Data.Value = model.Value; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.ClientConfigAttribute_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
public IEnumerable <SelectListItem> GetPrinterNameList() { IList <ClientConfigAttribute> lst = new List <ClientConfigAttribute>(); string hostName = HttpContext.Current.Request.UserHostName; string attributeName = "PrinterName"; using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.ClientName='{0}' AND Key.AttributeName LIKE '{1}%'" , hostName , attributeName), OrderBy = "Key.AttributeName" }; MethodReturnResult <IList <ClientConfigAttribute> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { lst = result.Data; } } return(from item in lst select new SelectListItem { Text = item.Value, Value = item.Value }); }
public IEnumerable <SelectListItem> GetLabelCodeList() { string hostName = HttpContext.Current.Request.UserHostName; string attributeName = "PrintLabelCode"; string defaultLabel = string.Empty; //获取设置的默认值。 using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { MethodReturnResult <ClientConfigAttribute> result = client.Get(new ClientConfigAttributeKey() { ClientName = hostName, AttributeName = attributeName }); if (result.Code <= 0 && result.Data != null) { defaultLabel = result.Data.Value; } } //获取打印标签数据。 IList <PrintLabel> lst = new List <PrintLabel>(); using (PrintLabelServiceClient client = new PrintLabelServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Type='{0}' AND IsUsed=1", Convert.ToInt32(EnumPrintLabelType.Box)) }; MethodReturnResult <IList <PrintLabel> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lst = result.Data; } } return(from item in lst select new SelectListItem { Text = string.Format("{0}[{1}]", item.Key, item.Name), Value = item.Key, Selected = item.Key == defaultLabel }); }
public async Task <ActionResult> Delete(string clientName, string attributeName) { MethodReturnResult result = new MethodReturnResult(); using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { result = await client.DeleteAsync(new ClientConfigAttributeKey() { ClientName = clientName, AttributeName = attributeName }); if (result.Code == 0) { result.Message = string.Format(FMMResources.StringResource.ClientConfigAttribute_Delete_Success , attributeName); } return(Json(result)); } }
public async Task <ActionResult> Query(ClientConfigAttributeQueryViewModel model) { if (ModelState.IsValid) { using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { where.AppendFormat(" {0} Key.ClientName = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.ClientName); if (!string.IsNullOrEmpty(model.AttributeName)) { where.AppendFormat(" {0} Key.AttributeName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.AttributeName); } } PagingConfig cfg = new PagingConfig() { OrderBy = "Key", Where = where.ToString() }; MethodReturnResult <IList <ClientConfigAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
// // GET: /FMM/ClientConfigAttribute/ public async Task <ActionResult> Index(string clientName) { using (ClientConfigServiceClient client = new ClientConfigServiceClient()) { MethodReturnResult <ClientConfig> result = await client.GetAsync(clientName ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "ClientConfig")); } ViewBag.ClientConfig = result.Data; } using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.ClientName = '{0}'" , clientName), OrderBy = "Key.ClientName,Key.AttributeName" }; MethodReturnResult <IList <ClientConfigAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new ClientConfigAttributeQueryViewModel() { ClientName = clientName })); }
public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize) { if (ModelState.IsValid) { int pageNo = currentPageNo ?? 0; int pageSize = currentPageSize ?? 20; if (Request["PageNo"] != null) { pageNo = Convert.ToInt32(Request["PageNo"]); } if (Request["PageSize"] != null) { pageSize = Convert.ToInt32(Request["PageSize"]); } using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <ClientConfigAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
/// <summary> /// 取得标签清单 /// </summary> /// <param name="materialCode">产品代码</param> /// <returns></returns> public IEnumerable <SelectListItem> GetLabelCodeList(string materialCode) { string hostName = HttpContext.Current.Request.UserHostName; string attributeName = "PrintLabelCode"; string defaultLabel = string.Empty; //获取设置的默认值。 using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient()) { MethodReturnResult <ClientConfigAttribute> result = client.Get(new ClientConfigAttributeKey() { ClientName = hostName, AttributeName = attributeName }); if (result.Code <= 0 && result.Data != null) { defaultLabel = result.Data.Value; } } //获取产品打印标签数据 IList <PrintLabel> printLabellst = new List <PrintLabel>(); using (PrintLabelServiceClient client = new PrintLabelServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Type = '{0}' AND IsUsed = 1 AND EXISTS( FROM MaterialPrintSet as p WHERE p.Key.LabelCode = self.Key AND p.Key.MaterialCode = '{1}' )", Convert.ToInt32(EnumPrintLabelType.Lot), materialCode) }; //MaterialPrintSet f = new MaterialPrintSet(); //f.Key.LabelCode = ""; MethodReturnResult <IList <PrintLabel> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { printLabellst = result.Data; } } return(from item in printLabellst select new SelectListItem { Text = string.Format("{0}[{1}]", item.Key, item.Name), Value = item.Key, Selected = item.Key == defaultLabel }); // IList<MaterialPrintSet> lst = new List<MaterialPrintSet>(); // using (MaterialPrintSetServiceClient client = new MaterialPrintSetServiceClient()) // { // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // Where = string.Format("Type='{0}'", Convert.ToInt32(EnumPrintLabelType.Lot)) // }; // MethodReturnResult<IList<MaterialPrintSet>> result = client.Get(ref cfg); // if (result.Code <= 0 && result.Data != null) // { // lst = result.Data; // } // } // return from item in lst // select new SelectListItem // { // Text = string.Format("{0}[{1}]", item.Key, item.Name), // Value = item.Key.LabelCode, // Selected = item.Key.LabelCode == defaultLabel // }; }