public void UpdateHoldRule(HoldRuleInfo item) { logger.Debug("(HoldRule)UpdateHoldRule starts"); try { iHoldRepository.UpdateHoldRule(item); } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(HoldRule)UpdateHoldRule end"); } }
public void InsertHoldRule(HoldRuleInfo item) { logger.Debug("(HoldRule)InsertHoldRule starts"); try { if (!string.IsNullOrEmpty(item.Family) && !string.IsNullOrEmpty(item.Model)) { IList<Model> checkModelList = iModelRepository.GetModelListByModel(item.Family, item.Model); if (checkModelList.Count == 0 || checkModelList == null) { throw new Exception("This Model:[" + item.Model.ToString() + "] is not Exists in This Family :[" + item.Family.ToString() + "]"); } } //else if (!string.IsNullOrEmpty(item.Model)) //{ // Model checkModel = iModelRepository.Find(item.Model); // if (checkModel == null) // { // throw new Exception("This Model :[" + item.Model.ToString() + "] is not Exists"); // } //} HoldRuleInfo checkInfo = new HoldRuleInfo(); if (item.Line != "") { checkInfo.Line = item.Line; } if (item.Family != "") { checkInfo.Family = item.Family; } if (item.Model != "") { checkInfo.Model = item.Model; } if (item.CUSTSN != "") { checkInfo.CUSTSN = item.CUSTSN; } if (item.CheckInStaion != "") { checkInfo.CheckInStaion = item.CheckInStaion; } IList<HoldRuleInfo> checkInfoList = iHoldRepository.GetHoldRule(checkInfo); if (checkInfoList != null && checkInfoList.Count != 0) { throw new Exception("This Info is Exists"); } iHoldRepository.InsertHoldRule(item); } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(HoldRule)InsertHoldRule end"); } }
public void InsertMultiCustSNHoldRule(IList<string> custSnList, HoldRuleInfo item) { logger.Debug("(HoldRule)InsertMultiCustSNHoldRule starts"); try { if (!string.IsNullOrEmpty(item.Family) && !string.IsNullOrEmpty(item.Model)) { IList<Model> checkModelList = iModelRepository.GetModelListByModel(item.Family, item.Model); if (checkModelList.Count == 0 || checkModelList == null) { throw new Exception("This Model:[" + item.Model.ToString() + "] is not Exists in This Family :[" + item.Family.ToString() + "]"); } } //else if (!string.IsNullOrEmpty(item.Model)) //{ // Model checkModel = iModelRepository.Find(item.Model); // if (checkModel == null) // { // throw new Exception("This Model :[" + item.Model.ToString() + "] is not Exists"); // } //} if (iHoldRepository.ExistHoldRuleByCustSn(custSnList)) { throw new Exception("Input custSn is Exists"); } iHoldRepository.InsertMultiCustSNHoldRule(custSnList,item); } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(HoldRule)InsertMultiCustSNHoldRule end"); } }
public IList<HoldRuleInfo> GetHoldRule(HoldRuleInfo condition) { logger.Debug("(HoldRule)GetHoldRule starts"); try { return iHoldRepository.GetHoldRule(condition); } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(HoldRule)GetHoldRule end"); } }
protected void Save_ServerClick(Object sender, EventArgs e) { try { IList<HoldRuleInfo> holdRuleList = null; string line = this.cmbLine.SelectedItem.Value.ToString(); string family = this.cmbFamily.SelectedItem.Value.ToString(); string model = this.txtModel.Text.ToString().Trim().ToUpper(); string custsn = this.hfCUSTSN.Value.ToString().Trim(); //string custsnList = this.hfCUSTSN.Value.ToString(); string checkinstation = this.cmbCheckINStation.SelectedItem.Value.ToString(); string holdstation = this.cmbHoldStation.SelectedItem.Value.ToString(); string holdcode = this.cmbHoldCode.SelectedItem.Value.ToString(); string holdDescr = this.txtHoldDescr.Text.ToString().Trim().ToUpper(); string id = this.hidDeleteID.Value; IList<string> inputCUSTSNList = new List<string>(); string[] strList = custsn.Split(','); foreach (string item in strList) { if (item == "") { continue; } inputCUSTSNList.Add(item.ToUpper()); } HoldRuleInfo holdInfo = new HoldRuleInfo(); holdInfo.Line = line; holdInfo.Family = family; holdInfo.Model = model; holdInfo.CUSTSN = custsn; holdInfo.CheckInStaion = checkinstation; holdInfo.HoldStaion = holdstation; holdInfo.HoldCode = holdcode; holdInfo.HoldDescr = holdDescr; holdInfo.Editor = UserId; holdInfo.Cdt = DateTime.Now; holdInfo.Udt = DateTime.Now; if (inputCUSTSNList.Count == 0) { if (!string.IsNullOrEmpty(id)) { holdInfo.ID = int.Parse(id); iHoldRule.UpdateHoldRule(holdInfo); } else { iHoldRule.InsertHoldRule(holdInfo); } holdRuleList = iHoldRule.GetHoldRule(new HoldRuleInfo { Line = line, Family = family, Model = model, CUSTSN = custsn }); } else { if (!string.IsNullOrEmpty(id)) { holdInfo.ID = int.Parse(id); iHoldRule.UpdateHoldRule(holdInfo); } else { iHoldRule.InsertMultiCustSNHoldRule(inputCUSTSNList, holdInfo); } holdRuleList = iHoldRule.GetHoldRule(new HoldRuleInfo { Line = line, Family = family, Model = model }); } int ID = holdRuleList[0].ID; bindTable(holdRuleList, DEFAULT_ROWS); initlineTop(); initfamilyTop(); initmodelTop(); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + ID + "');", true);// } catch (FisException ex) { showErrorMessage(ex.mErrmsg); // showAlertErrorMessage(msgHasExistRecord); } catch (Exception ex) { showErrorMessage(ex.Message); bindTable(null, DEFAULT_ROWS); //this.hidRecordCount.Value = "0"; } finally { hideWait(); } }
protected void Query_ServerClick(Object sender, EventArgs e) { try { string line = this.cmbLineTop.SelectedItem.Value.ToString(); string family = this.cmbFamilyTop.SelectedItem.Value.ToString(); string model = this.cmbModelTop.SelectedItem.Value.ToString(); string custsn = this.txtCUSTSNTop.Text.Trim(); string custsblistquery = this.HiddenSNQuery.Value.Trim().ToUpper(); // string custsblistquery = "5CG4525MGQ,5CG5434H94,5CG5434HC9"; IList<string> inputCUSTSNList = new List<string>(); string[] strList = custsblistquery.Split(','); foreach (string item in strList) { if (item == "") { continue; } inputCUSTSNList.Add(item.ToUpper()); } if (inputCUSTSNList.Count > 0 && string.IsNullOrEmpty(custsn)) { IList<HoldRuleInfo> holdRuleList = new List<HoldRuleInfo>(); foreach (string sn in inputCUSTSNList) { HoldRuleInfo condition = new HoldRuleInfo(); condition.CUSTSN = sn; IList<HoldRuleInfo> holdlist=iHoldRule.GetHoldRule(condition); foreach (HoldRuleInfo info in holdlist) { holdRuleList.Add(info); } } bindTable(holdRuleList, DEFAULT_ROWS); } else { HoldRuleInfo condition = new HoldRuleInfo(); if (line != "") { condition.Line = line; } if (family != "") { condition.Family = family; } if (model != "") { condition.Model = model; } if (custsn != "") { condition.CUSTSN = custsn; } IList<HoldRuleInfo> holdRuleList = iHoldRule.GetHoldRule(condition); bindTable(holdRuleList, DEFAULT_ROWS); } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); bindTable(null, DEFAULT_ROWS); //this.hidRecordCount.Value = "0"; } catch (Exception ex) { showErrorMessage(ex.Message); bindTable(null, DEFAULT_ROWS); //this.hidRecordCount.Value = "0"; } finally { hideWait(); } }