public void UpdateSysSettingInfo(SysSettingInfo setValue, SysSettingInfo condition) { IList<SysSettingInfo> ret = new List<SysSettingInfo>(); try { IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); iPartRepository.UpdateSysSettingInfo(setValue, condition); } catch (Exception) { throw; } }
public void AddSysSettingInfo(SysSettingInfo item) { IList<SysSettingInfo> ret = new List<SysSettingInfo>(); try { IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); iPartRepository.AddSysSettingInfo(item); } catch (Exception) { throw; } }
public IList<SysSettingInfo> GetSysSettingListByCondition(SysSettingInfo sysSettingCondition) { IList<SysSettingInfo> ret = new List<SysSettingInfo>(); try { IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); ret = iPartRepository.GetSysSettingInfoes(sysSettingCondition); } catch (Exception) { throw; } return ret; }
private Boolean ShowListByType() { type = this.cmbSysSettingName.SelectedValue; try { SysSettingInfo sysSettingCondition = new SysSettingInfo(); if (type != "ALL") { sysSettingCondition.name = type; } IList<SysSettingInfo> dataList = iSysSetting.GetSysSettingListByCondition(sysSettingCondition); if (dataList == null || dataList.Count == 0) { bindTable(null, DEFAULT_ROWS); } else { bindTable(dataList, DEFAULT_ROWS); } } catch (FisException ex) { bindTable(null, DEFAULT_ROWS); showErrorMessage(ex.mErrmsg); return false; } catch (Exception ex) { //show error bindTable(null, DEFAULT_ROWS); showErrorMessage(ex.Message); return false; } return true; }
protected void btnSave_ServerClick(Object sender, EventArgs e) { string id = this.HidID.Value.Trim(); string nameValue = this.dName.Text.Trim(); string valueValue = this.dValue.Text.Trim(); string descValue = this.dDescr.Text.Trim(); try { SysSettingInfo condition = new SysSettingInfo(); if (id != "") { condition.id = Convert.ToInt32(id); } else { condition.name = nameValue; condition.value = valueValue; } IList<SysSettingInfo> sysSettingList = iSysSetting.GetSysSettingListByCondition(condition); SysSettingInfo addEditInfo = new SysSettingInfo(); if (sysSettingList.Count == 0) { addEditInfo.name = nameValue; addEditInfo.value = valueValue; addEditInfo.description = descValue; iSysSetting.AddSysSettingInfo(addEditInfo); } else { addEditInfo.name = nameValue; addEditInfo.value = valueValue; addEditInfo.description = descValue; iSysSetting.UpdateSysSettingInfo(addEditInfo, condition); } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } initcmbSysSettingNameList(); //this.updatePanel1.Update(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();", true); }
private void initcmbSysSettingNameList() { SysSettingInfo sysSettingCondition = new SysSettingInfo(); if (type == "") { this.cmbSysSettingName.Items.Clear(); this.cmbSysSettingName.Items.Add(string.Empty); this.cmbSysSettingName.Items.Add("ALL"); } else { this.cmbSysSettingName.Items.Clear(); this.cmbSysSettingName.Items.Add(string.Empty); sysSettingCondition.name = type; } IList<SysSettingInfo> sysSettingInfoList = iSysSetting.GetSysSettingListByCondition(sysSettingCondition); IList<ListItem> inneritem = new List<ListItem>(); foreach(SysSettingInfo info in sysSettingInfoList) { ListItem item = new ListItem(); item.Text = info.name; item.Value = info.name; inneritem.Add(item); this.cmbSysSettingName.Items.Add(item); } this.cmbSysSettingName.SelectedIndex = 1; ShowListByType(); }
public void SetSysSetting(string name, string value, string hostname, string editor) { try { List<string> erpara = new List<string>(); IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); SysSettingInfo conf = new SysSettingInfo(); SysSettingInfo info = new SysSettingInfo(); info.value = value; info.description = "PCs in Carton"; conf.name = name; partRepository.UpdateSysSettingInfo(info,conf); return ; } 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("(CombinPoInCarton)GetSysSetting, name:" + name); } }
/// <summary> /// 获取setting相关值,未得到则置default值 /// </summary> /// <param name="name"></param> /// <param name="defValue"></param> /// <param name="hostname"></param> /// <param name="editor"></param> /// <returns></returns> public string GetSysSettingSafe(string name, string defValue, string hostname, string editor) { try { List<string> erpara = new List<string>(); IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<string> valueList = new List<string>(); valueList = partRepository.GetValueFromSysSettingByName(name); if (valueList.Count == 0) { SysSettingInfo info = new SysSettingInfo(); info.name = name; info.value = defValue; info.description = "PCs in Carton"; partRepository.AddSysSettingInfo(info); valueList.Add(defValue); } return valueList[0]; } 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("(CombinPoInCarton)GetSysSetting, name:" + name); } }
public ArrayList Save(List<string> SNList, List<string> PNList, List<string> errList, string Editor, string Station, string customer) { logger.Debug("(ReturnUsedKeysImpl)Save start" + " [editor]:" + Editor + " [station]:" + Station + " [customer]:" + customer); //FisException ex; List<string> erpara = new List<string>(); ArrayList retvaluelist = new ArrayList(); string ECOAReturnStatus = "0"; var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); var currentRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>(); IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); try { ///生成group id SqlTransactionManager.Begin(); IUnitOfWork Number_uof = new UnitOfWork();//使用自己的UnitOfWork string prestr = ""; string maxnum = ""; bool addflag = false; INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>(); maxnum = numControl.GetMaxNumber("GroupID", prestr + "{0}"); if (string.IsNullOrEmpty(maxnum)) { maxnum = "001"; addflag = true; } else { if (maxnum.Substring(6, 3).ToUpper() == "999") { FisException fe = new FisException("CHK867", new string[] { }); //流水号已满! throw fe; } else { int count = Int32.Parse(maxnum.Substring(6, 3)); count = count + 1; maxnum = (count).ToString().PadLeft(3, '0'); } } DateTime dd = DateTime.Now; string Groupid = dd.Year.ToString().Substring(2,2) + dd.Month.ToString().PadLeft(2, '0') + dd.Day.ToString().PadLeft(2, '0') + maxnum; NumControl item = new NumControl(); item.NOType = "GroupID"; item.Value = Groupid; item.NOName = ""; item.Customer = "HP"; numControl.SaveMaxNumber(item, addflag, prestr + "{0}"); Number_uof.Commit(); //立即提交UnitOfWork更新NumControl里面的最大值 SqlTransactionManager.Commit();//提交事物,释放行级更新锁 ///////////////////////////////////////////////// IUnitOfWork work = new UnitOfWork(); for (int i = 0; i < SNList.Count; i++) { IProduct CurrentProduct = null; if (errList[i] == "Pass") { string custSn = SNList[i]; CurrentProduct = productRepository.GetProductByCustomSn(custSn); if (CurrentProduct == null) { continue; } string line = CurrentProduct.Status.Line; StationStatus Status = StationStatus.Pass; var productLog = new ProductLog { Model = CurrentProduct.Model, Status = Status, Editor = Editor, Line = line, Station = Station, Cdt = DateTime.Now }; CurrentProduct.AddLog(productLog); /////////update product status var newStatus = new ProductStatus(); newStatus.Status = Status; newStatus.StationId = Station; newStatus.Editor = Editor; newStatus.Line = line; newStatus.TestFailCount = 0; if (!string.IsNullOrEmpty(CurrentProduct.Status.ReworkCode) && productRepository.IsLastReworkStation(CurrentProduct.Status.ReworkCode, Station, (int)Status)) { newStatus.ReworkCode = ""; IMES.DataModel.Rework r = new IMES.DataModel.Rework(); r.ReworkCode = CurrentProduct.Status.ReworkCode; r.Editor = Editor; r.Status = "3"; r.Udt = DateTime.Now; productRepository.UpdateReworkConsideredProductStatusDefered(work, r, CurrentProduct.ProId); } else { newStatus.ReworkCode = CurrentProduct.Status.ReworkCode; } newStatus.ProId = CurrentProduct.ProId; CurrentProduct.UpdateStatus(newStatus); productRepository.Update(CurrentProduct, work); ECOAReturnStatus = "1"; } dm.EcoareturnInfo item1 = new dm.EcoareturnInfo(); item1.custsn = SNList[i]; item1.partNo = PNList[i]; item1.message = errList[i]; item1.status = ECOAReturnStatus; item1.line = CurrentProduct.Status.Line; item1.groupNo = Groupid; item1.editor = Editor; currentRepository.InsertEcoareturn(item1); } work.Commit(); dm.SysSettingInfo condition = new dm.SysSettingInfo(); condition.name = "ReturnECOAURL"; IList<dm.SysSettingInfo> tmp = ipartRepository.GetSysSettingInfoes(condition); if (tmp.Count == 0 || tmp[0].value == "") { FisException fe = new FisException("CHK962", new string[] { }); //未设置ReturnECOAURL throw fe; } retvaluelist.Add(Groupid); return retvaluelist; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw e; } finally { logger.Debug("(ReturnUsedKeysImpl)Save end" + " [editor]:" + Editor + " [station]:" + Station + " [customer]:" + customer); } }