public ActionResult _CodeMasterMultiSelectBox(com.Sconit.CodeMaster.CodeMaster code, string controlName, string controlId, string checkedValues, bool?isProcurement) { ViewBag.ControlName = controlName; ViewBag.ControlId = controlId; IList <CodeDetail> codeDetailList = null; codeDetailList = systemMgr.GetCodeDetails(code); if (isProcurement.HasValue && isProcurement.Value) //订单类型,直送供应商不显示 { codeDetailList = codeDetailList.Where(c => (c.Description == "CodeDetail_OrderType_ScheduleLine") || (c.Description == "CodeDetail_OrderType_Transfer") || (c.Description == "CodeDetail_OrderType_Procurement")).ToList(); } foreach (var codeDetail in codeDetailList) { codeDetail.ChineDescription = systemMgr.TranslateCodeDetailDescription(codeDetail.Description); } ViewBag.CodeDetails = codeDetailList; if (!string.IsNullOrWhiteSpace(checkedValues)) { ViewBag.CheckedValues = checkedValues.Split(',').ToList(); } ViewBag.CodeDetails = codeDetailList; return(PartialView()); }
public ActionResult _CodeMasterComboBox(com.Sconit.CodeMaster.CodeMaster code, string controlName, string controlId, string selectedValue, bool?enable, bool?isChange ) { ViewBag.ControlName = controlName; ViewBag.ControlId = controlId; ViewBag.Enable = enable; ViewBag.Code = code; ViewBag.isChange = isChange; //IList<CodeDetail> codeDetailList = new List<CodeDetail>(); //if (selectedValue != null && selectedValue.Trim() != string.Empty) //{ // codeDetailList = base.genericMgr.FindAll<CodeDetail>("from CodeDetail as c where c.Code = ? and c.Value = ?", new object[] { code, selectedValue }); //} IList <CodeDetail> codeDetailList = null; if (selectedValue == null || selectedValue.Trim() == string.Empty) { codeDetailList = systemMgr.GetCodeDetails(code); } else { codeDetailList = systemMgr.GetCodeDetails(code).Where(p => p.Value == selectedValue).ToList(); } return(PartialView(base.Transfer2DropDownList(code, codeDetailList, selectedValue))); }
public ActionResult _CodeMasterAjaxLoading(string text, com.Sconit.CodeMaster.CodeMaster code) { //IList<CodeDetail> codeDetailList = new List<CodeDetail>(); //string hql = "from CodeDetail as c where c.Code = ?"; //IList<object> paraList = new List<object>(); //paraList.Add(code); //if (!string.IsNullOrEmpty(text)) //{ // hql += " and c.Value like ?"; // paraList.Add(text + "%"); //} IList <CodeDetail> codeDetailList = null; if (text == "") { codeDetailList = systemMgr.GetCodeDetails(code); } else { codeDetailList = systemMgr.GetCodeDetails(code).Where(p => p.Value == text).ToList(); } //genericMgr.FindAll<CodeDetail>(hql, paraList.ToArray(), firstRow, maxRow); IList <SelectListItem> itemList = Mapper.Map <IList <CodeDetail>, IList <SelectListItem> >(codeDetailList); foreach (var item in itemList) { item.Text = systemMgr.TranslateCodeDetailDescription(item.Text); } return(new JsonResult { Data = new SelectList(itemList, "Value", "Text") }); }
public string GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster code, string value) { if (codeMasterCache == null) { LoadCodeDetailCache(); } if (codeMasterCache.ContainsKey(code)) { CodeDetail codeDetail = codeMasterCache[code].Where(det => det.Value == value).SingleOrDefault(); if (codeDetail != null) { string desc = Resources.CodeDetail.ResourceManager.GetString(codeDetail.Description); if (desc != null) { return(desc); } else { return(codeDetail.Description); //throw new TechnicalException("Description define not correct of codeMaster [" + code + "] and value [" + value + "]."); } } else { //throw new TechnicalException("CodeMaster [" + code + "] does not contain value [" + value + "]."); return(Resources.CodeDetail.Errors_CodeDetail_ValueNotFound); } } else { throw new TechnicalException("CodeMaster [" + code + "] does not exist."); } }
public CodeDetail GetDefaultCodeDetail(com.Sconit.CodeMaster.CodeMaster code) { if (codeMasterCache == null) { LoadCodeDetailCache(); } return((from cd in codeMasterCache[code] where cd.IsDefault == true select cd).SingleOrDefault()); }
public IList <CodeDetail> GetCodeDetails(com.Sconit.CodeMaster.CodeMaster code, bool?includeBlankOption, string blankOptionDescription, string blankOptionValue) { IList <CodeDetail> codeDetailList = this.GetCodeDetails(code); if (includeBlankOption.HasValue && includeBlankOption.Value) { CodeDetail blankCodeDetail = new CodeDetail(); blankCodeDetail.Description = blankOptionDescription != null ? blankOptionDescription : string.Empty; blankCodeDetail.Value = blankOptionValue != null ? blankOptionValue : string.Empty; codeDetailList.Insert(0, blankCodeDetail); } return(codeDetailList); }
public IList <CodeDetail> GetCodeDetails(com.Sconit.CodeMaster.CodeMaster code) { if (codeMasterCache == null) { LoadCodeDetailCache(); } IList <CodeDetail> returnList = new List <CodeDetail>(); foreach (CodeDetail codeDetail in codeMasterCache[code]) { returnList.Add(ObjectMapperManager.DefaultInstance.GetMapper <CodeDetail, CodeDetail>().Map(codeDetail)); } return(returnList); }
public ActionResult _CodeMasterDropDownList(com.Sconit.CodeMaster.CodeMaster code, string controlName, string controlId, string selectedValue, string ajaxActionName, bool?isSupplier, //string[] parentCascadeControlNames, string[] cascadingControlNames, bool?includeBlankOption, string blankOptionDescription, string blankOptionValue, bool?enable, bool?isConsignment, bool?isShowNA, int?orderType) { IList <CodeDetail> codeDetailList = systemMgr.GetCodeDetails(code, includeBlankOption, blankOptionDescription, blankOptionValue); //IList<object> para = new List<object>(); //para.Add(com.Sconit.CodeMaster.CodeMaster.OrderStatus); //para.Add((int)com.Sconit.CodeMaster.OrderStatus.Create); //codeDetailList = systemMgr.GetCodeDetails(code, includeBlankOption, blankOptionDescription, blankOptionValue); //IList<CodeDetail> codeDetail = base.genericMgr.FindAll<CodeDetail>("from CodeDetail c where c.Code = ? and c.Value=?", para.ToArray()); //if (codeDetail.Count > 0) //{ // codeDetailList.Remove(codeDetail[0]); //} // if (codeDetailList != null && codeDetailList.Count > 0) // { // codeDetailList = codeDetailList.Where(q => q.Value != ((int)com.Sconit.CodeMaster.OrderStatus.Create).ToString()).ToList(); // } //} //else //{ if (isSupplier != null && isSupplier.Value) { codeDetailList = codeDetailList.Where(q => q.Value != ((int)com.Sconit.CodeMaster.OrderStatus.Create).ToString()).ToList(); } //base.genericMgr.FindAll<CodeDetail>("from CodeDetail c where c.code = 'OrderStatus' and c.value in ('1','2')"); //systemMgr.GetCodeDetails(code, includeBlankOption, blankOptionDescription, blankOptionValue); //采购路线中的结算方式 不显示寄售结算 if (isConsignment != null) { if (code == com.Sconit.CodeMaster.CodeMaster.BillTerm) { if ((bool)isConsignment) { // codeDetailList = base.genericMgr.FindAll<CodeDetail>("from CodeDetail c where c.Description in ('" + "CodeDetail_BillTerm_BAC" + "','" + "CodeDetail_BillTerm_NA" + "','" + "CodeDetail_BillTerm_BAR" + "') order by c.Sequence"); codeDetailList = codeDetailList.Where(p => p.Value == ((int)com.Sconit.CodeMaster.OrderBillTerm.ConsignmentBilling).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderBillTerm.NA).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderBillTerm.ReceivingSettlement).ToString()).ToList(); } else { codeDetailList = codeDetailList.Where(p => p.Value != ((int)com.Sconit.CodeMaster.OrderBillTerm.ConsignmentBilling).ToString()).ToList(); } if (isShowNA != null) { if (!(bool)isShowNA) { codeDetailList = codeDetailList.Where(p => p.Value != ((int)com.Sconit.CodeMaster.OrderBillTerm.NA).ToString()).ToList(); //IList<CodeDetail> codeDetail = base.genericMgr.FindAll<CodeDetail>("from CodeDetail c where c.Description = ?", "CodeDetail_BillTerm_NA"); //if (codeDetail.Count > 0) //{ // codeDetailList.Remove(codeDetail[0]); //} } } } } //收货和发货的OrderType 不显示销售和生产 if (code == com.Sconit.CodeMaster.CodeMaster.OrderType) { //if (controlName == "GoodsReceiptOrderType" || controlName == "IpOrderType") //{ // IList<CodeDetail> codeDetail = base.genericMgr.FindAll<CodeDetail>("from CodeDetail c where c.Description = ? or c.Description=?", // new object[] { "CodeDetail_OrderType_Distribution", "CodeDetail_OrderType_Production" }); // if (codeDetail.Count > 0) // { // for (int i = 0; i < codeDetail.Count; i++) // { // codeDetailList.Remove(codeDetail[i]); // } // } //} if (orderType != null) { codeDetailList = systemMgr.GetCodeDetails(code); if (orderType.Value == (int)com.Sconit.CodeMaster.OrderType.Production) { codeDetailList = codeDetailList.Where(p => p.Value == ((int)com.Sconit.CodeMaster.OrderType.Production).ToString()).ToList(); // base.genericMgr.FindAll<CodeDetail>("from CodeDetail as c where c.Code = ? and c.Value = ?", new object[] { com.Sconit.CodeMaster.CodeMaster.OrderType.ToString(), (int)com.Sconit.CodeMaster.OrderType.Production }); } if (orderType.Value == (int)com.Sconit.CodeMaster.OrderType.Procurement) { if (isSupplier != null && isSupplier.Value) { codeDetailList = codeDetailList.Where(p => p.Value == ((int)com.Sconit.CodeMaster.OrderType.Procurement).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.CustomerGoods).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.SubContract).ToString()).ToList(); //base.genericMgr.FindAll<CodeDetail>("from CodeDetail as c where c.Code = ? and c.Value in (?,?,?)", new object[] { com.Sconit.CodeMaster.CodeMaster.OrderType.ToString(), (int)com.Sconit.CodeMaster.OrderType.Procurement, (int)com.Sconit.CodeMaster.OrderType.CustomerGoods, (int)com.Sconit.CodeMaster.OrderType.SubContract }); } else { codeDetailList = codeDetailList.Where(p => p.Value == ((int)com.Sconit.CodeMaster.OrderType.Procurement).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.CustomerGoods).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.Transfer).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.SubContractTransfer).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.ScheduleLine).ToString()).ToList(); // codeDetailList = base.genericMgr.FindAll<CodeDetail>("from CodeDetail as c where c.Code = ? and c.Value in (?,?,?,?,?,?)", new object[] { com.Sconit.CodeMaster.CodeMaster.OrderType.ToString(), (int)com.Sconit.CodeMaster.OrderType.Procurement, (int)com.Sconit.CodeMaster.OrderType.SubContract, (int)com.Sconit.CodeMaster.OrderType.CustomerGoods, (int)com.Sconit.CodeMaster.OrderType.Transfer, (int)com.Sconit.CodeMaster.OrderType.SubContractTransfer, (int)com.Sconit.CodeMaster.OrderType.ScheduleLine }); } } if (orderType.Value == (int)com.Sconit.CodeMaster.OrderType.Distribution) { codeDetailList = codeDetailList.Where(p => p.Value == ((int)com.Sconit.CodeMaster.OrderType.Distribution).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.Transfer).ToString() || p.Value == ((int)com.Sconit.CodeMaster.OrderType.SubContractTransfer).ToString()).ToList(); //base.genericMgr.FindAll<CodeDetail>("from CodeDetail as c where c.Code = ? and c.Value in (?,?,?)", new object[] { com.Sconit.CodeMaster.CodeMaster.OrderType.ToString(), (int)com.Sconit.CodeMaster.OrderType.Distribution, (int)com.Sconit.CodeMaster.OrderType.Transfer, (int)com.Sconit.CodeMaster.OrderType.SubContractTransfer }); } #region empty codedetail CodeDetail emptyCodeDetail = new CodeDetail(); emptyCodeDetail.Value = blankOptionValue; emptyCodeDetail.Description = blankOptionDescription; codeDetailList.Insert(0, emptyCodeDetail); #endregion } } ViewBag.ControlName = controlName; ViewBag.ControlId = controlId; //ViewBag.SelectedValue = selectedValue; ViewBag.AjaxActionName = ajaxActionName; ViewBag.Enable = enable; // codeDetailList.Add(new CodeDetail()); //ViewBag.CascadingControlNames = cascadingControlNames; //ViewBag.ParentCascadeControlNames = parentCascadeControlNames; if (code == com.Sconit.CodeMaster.CodeMaster.FlowStrategy) { codeDetailList = codeDetailList.Where(c => c.Description != "CodeDetail_FlowStrategy_NA").ToList(); } return(PartialView(base.Transfer2DropDownList(code, codeDetailList, selectedValue))); }
public string GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster code, int value) { return(GetCodeDetailDescription(code, value.ToString())); }