///// <summary> ///// 修改及添加数据方法 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> protected void btnSave_serverClick(Object sender, EventArgs e) { PODLabelPartDef item = new PODLabelPartDef(); string familyId = this.CmbFamily.InnerDropDownList.SelectedValue.ToString().Trim(); string partNo = this.dPartNo.Text; item.family = familyId; item.partNo = partNo.Trim(); //partNo.Trim().ToUpper(); item.editor = this.HiddenUsername.Value; item.udt = DateTime.Now; string oldPartNo = this.hidPartNo.Value.Trim(); string oldFamily = this.HidFamily.Value.Trim(); try { ipodlabel.UpdatePODLabelPart(item, oldPartNo, oldFamily); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } ShowPODLabelPartList(); this.UpdatePanel2.Update(); partNo = replaceSpecialChart(partNo); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + partNo + "');", true); }
/// <summary> /// 添加podlabelpart数据 /// </summary> /// <param name="obj"></param> public void AddPODLabelPart(PODLabelPartDef obj) { PODLabelPartDef PODLabel = obj; try { IPartRepository iplr = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); PODLabelPartDef item = new PODLabelPartDef(); item.family = obj.family; item.partNo = obj.partNo; item.editor = obj.editor; item.cdt = obj.cdt; item.udt = obj.udt; iplr.AddPODLabelPart(item); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 通过partNo和family修改podlabelpart数据 /// </summary> /// <param name="obj"></param> /// <param name="PartNo"></param> /// <param name="Family"></param> public void UpdatePODLabelPart(PODLabelPartDef obj, string PartNo, string Family) { IList<PODLabelPartDef> listPodPd = new List<PODLabelPartDef>(); try { if (obj.partNo.Equals(PartNo)) { List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT075", erpara); throw ex; } else { listPodPd = this.GetPODLabelPartListByPartNo(obj.partNo); if (listPodPd.Count > 0) { List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT075", erpara); throw ex; } else { IList<PODLabelPartDef> listPodPd1 = new List<PODLabelPartDef>(); listPodPd1 = this.GetListByPartNoAndFamily(obj.partNo, obj.family); if (listPodPd1 != null && listPodPd1.Count > 0) { PODLabelPartDef podGetLst = listPodPd1.First(); this.UpdatePODLabelPart(obj, podGetLst.partNo); } else { obj.cdt = DateTime.Now; this.AddPODLabelPart(obj); } } } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 更新podlabel数据 /// </summary> /// <param name="obj"></param> /// <param name="PartNo"></param> public void UpdatePODLabelPart(PODLabelPartDef obj, string PartNo) { try { IPartRepository iplr = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); iplr.UpdatePODLabelPart(obj, PartNo); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }