/// <summary> ///取得所有的SMTLine记录 /// </summary> /// <returns>返回数据库中所有存在的SMTLine记录</returns> public IList<SMTLineDef> GetAllSMTLineInfo() { try { List<SMTLineDef> retLst = new List<SMTLineDef>(); IMBRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); IList<SMTLineDef> getData = itemRepository.GetSMTLineList(); if (getData != null) { for (int i = 0; i < getData.Count; i++) { SMTLineDef data = getData[i]; SMTLineDef item = new SMTLineDef(); item.Line = data.Line; item.ObjectiveTime = data.ObjectiveTime; item.StartTime = (System.DateTime)data.StartTime; item.EndTime = (System.DateTime)data.EndTime; item.Remark = data.Remark; item.Editor = data.Editor; item.Cdt = (System.DateTime)data.Cdt; item.Udt = (System.DateTime)data.Udt; retLst.Add(item); } } return retLst; } catch(FisException fex) { logger.Error(fex.Message); throw fex; } catch(System.Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 删除选中的一条SMTLineDef记录 /// </summary> /// <param name="item">被选中的SMTLineDef</param> public void DeleteOneSMTLine(SMTLineDef item) { try { IMBRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); itemRepository.RemoveSMTLine(item); } catch (FisException fex) { logger.Error(fex.Message); throw fex; } catch (System.Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 更新选中记录, /// 当此记录中assembly在其他的记录中存在时,抛出异常 /// </summary> /// <param name="newItem"></param> /// <param name="oldLine"></param> public void UpdateOneSMTLine(SMTLineDef newItem, string oldLine) { try { IMBRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); //新Line与存在记录的Line的名称相同,则提示业务异常 SMTLineDef newObj = new SMTLineDef(); newObj.Line = newItem.Line; IList<SMTLineDef> exists = itemRepository.GetExistSMTLine(newObj); /* ITC-1361-0187, Jessica Liu, 2012-9-5 if (exists != null && exists.Count > 0) { List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT152", erpara); //Line已经存在,不能保存! throw ex; } */ SMTLineDef tempObj = new SMTLineDef(); tempObj.Line = oldLine; IList<SMTLineDef> oldexists = itemRepository.GetExistSMTLine(tempObj); if (oldexists == null || oldexists.Count <= 0) { List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT082", erpara); throw ex; } SMTLineDef tempItem = new SMTLineDef(); tempItem.Line = newItem.Line; tempItem.ObjectiveTime = newItem.ObjectiveTime; tempItem.StartTime = (System.DateTime)newItem.StartTime; tempItem.EndTime = (System.DateTime)newItem.EndTime; tempItem.Remark = newItem.Remark; tempItem.Editor = newItem.Editor; tempItem.Cdt = Convert.ToDateTime(newItem.Cdt); tempItem.Udt = DateTime.Now; itemRepository.ChangeSMTLine(tempItem, tempObj); } catch (FisException fex) { logger.Error(fex.Message); throw fex; } catch (System.Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// 添加一条符合条件的SMTLineDef记录, /// 当所添加的记录中的assembly在其他记录中存在时,抛出异常 /// </summary> /// <param name="item"></param> public void AddOneSMTLine(SMTLineDef item) { try { IMBRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); //Line与存在记录的Line的名称相同,则提示业务异常 SMTLineDef newObj = new SMTLineDef(); newObj.Line = item.Line; IList<SMTLineDef> exists = itemRepository.GetExistSMTLine(newObj); if (exists != null && exists.Count > 0) { List<string> erpara = new List<string>(); FisException ex; //ITC-1361-0185, Jessica Liu, 2012-9-5 //ex = new FisException("DMT066", erpara); //???? ex = new FisException("DMT152", erpara); //Line已经存在,不能保存! throw ex; } SMTLineDef newItem = new SMTLineDef(); newItem.Line = item.Line; newItem.ObjectiveTime = item.ObjectiveTime; newItem.StartTime = (System.DateTime)item.StartTime; newItem.EndTime = (System.DateTime)item.EndTime; newItem.Remark = item.Remark; newItem.Editor = item.Editor; itemRepository.AddSMTLine(newItem); } catch (FisException fex) { logger.Error(fex.Message); throw; } catch (System.Exception e) { logger.Error(e.Message); throw; } }
protected void btnDelete_ServerClick(object sender, EventArgs e) { string oldLine = this.dOldLine.Value.Trim(); try { SMTLineDef smtline = new SMTLineDef(); smtline.Line = oldLine; //调用删除方法. iSMTObjectiveTime.DeleteOneSMTLine(smtline); } catch(FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch(System.Exception ex) { showErrorMessage(ex.Message); return; } //按照SMTLine list加载表格中的数据 showListBySMTLineList(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();DeleteComplete();HideWait();", true); }
protected void btnSave_ServerClick(object sender, EventArgs e) { SMTLineDef smtline = new SMTLineDef(); smtline.Line = this.ttLineValue.Value.Trim(); smtline.ObjectiveTime = Convert.ToDecimal(this.ttObTime.Text.Trim()); //ITC-1361-0191, Jessica Liu, 2012-9-6 smtline.StartTime = Convert.ToDateTime(this.dStartTime.Value.Trim()); smtline.EndTime = Convert.ToDateTime(this.dEndTime.Value.Trim()); //ITC-1361-0218, Jessica Liu, 2012-9-13 smtline.Remark = this.ttRemark.Text.ToUpper().Trim(); smtline.Editor = this.HiddenUserName.Value; ; string oldLine = this.dOldLine.Value.Trim(); try { //调用更新方法,可能抛出异常 iSMTObjectiveTime.UpdateOneSMTLine(smtline, oldLine); } catch(FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch(System.Exception ex) { //IList<IMES.DataModel.SMTLineDef> datalst = iSMTObjectiveTime.GetAllSMTLineInfo(); //bindTable(datalst, DEFAULT_ROWS); showErrorMessage(ex.Message); return; } //按照SMTLine list加载表格中的数据 showListBySMTLineList(); this.updatePanel2.Update(); //string currentAssmebly = replaceSpecialChart(assembly); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + this.ttLineValue.Value.Trim() + "');HideWait();", true); }
protected void btnAdd_ServerClick(object sender, EventArgs e) { SMTLineDef smtline = new SMTLineDef(); smtline.Line = this.ttLineValue.Value.Trim(); smtline.ObjectiveTime = Convert.ToDecimal(this.ttObTime.Text.Trim()); //ITC-1361-0191, Jessica Liu, 2012-9-6 smtline.StartTime = Convert.ToDateTime(this.dStartTime.Value.Trim()); smtline.EndTime = Convert.ToDateTime(this.dEndTime.Value.Trim()); //ITC-1361-0218, Jessica Liu, 2012-9-13 smtline.Remark = this.ttRemark.Text.ToUpper().Trim(); smtline.Editor = this.HiddenUserName.Value; System.DateTime cdt = DateTime.Now;; //string timeStr = cdt.ToString(); smtline.Cdt = cdt; smtline.Udt = cdt; //string id = ""; try { //调用添加的方法,可能抛出异常... //id=iSMTObjectiveTime.AddOneSMTLine(smtline); iSMTObjectiveTime.AddOneSMTLine(smtline); } catch(FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch(System.Exception ex) { showErrorMessage(ex.Message); return; } //按照SMTLine list加载表格中的数据 showListBySMTLineList(); this.updatePanel2.Update(); //string assemblyId = replaceSpecialChart(adaptor.assemb); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + this.ttLineValue.Value.Trim() + "');HideWait();", true); }