/// <summary> /// 获取COMSettingInfo /// </summary> /// <param name="hostname">hostname</param> /// <returns></returns> public IList<COMSettingDef> GetWeightSettingInfo(string hostname) { IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>(); IList<COMSettingInfo> UnitWeighSettingInfo = new List<COMSettingInfo>(); UnitWeighSettingInfo = iPalletRepository.FindCOMSettingByName(hostname); IList<COMSettingDef> UnitWeighInfoList = new List<COMSettingDef>(); foreach (COMSettingInfo wsInfo in UnitWeighSettingInfo) { COMSettingDef wsd = new COMSettingDef(); wsd.id = wsInfo.id; wsd.name = wsInfo.name; wsd.commport = wsInfo.commPort; wsd.baudRate = wsInfo.baudRate; wsd.rthreshold = wsInfo.rthreshold.ToString(); wsd.sthreshold = wsInfo.sthreshold.ToString(); wsd.handshaking = wsInfo.handshaking.ToString(); wsd.editor = wsInfo.editor; wsd.cdt = wsInfo.cdt.ToString("yyyy-MM-dd hh:mm:ss"); wsd.udt = wsInfo.udt.ToString("yyyy-MM-dd hh:mm:ss"); UnitWeighInfoList.Add(wsd); } if (UnitWeighInfoList == null || UnitWeighInfoList.Count <= 0) { return null; } return UnitWeighInfoList; }
protected void btnDelete_ServerClick(object sender, EventArgs e) { try { COMSettingDef def = new COMSettingDef(); def.id = Convert.ToInt32(this.dOldId.Value.Trim()); //调用删除方法. iws.RemoveWeightSettingItem(def); } catch (FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch (System.Exception ex) { showErrorMessage(ex.Message); return; } //按照ac adaptor list加载表格中的数据. //... showList(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "delete", "resetTableHeight();DeleteComplete();HideWait();", true); }
public IList<COMSettingDef> GetAllWeightSettingItems() { IList<COMSettingDef> dataList = new List<COMSettingDef>(); try { IList<COMSettingInfo> voList = itemRepository.GetAllCOMSetting(); if(voList!=null) { foreach (COMSettingInfo inf in voList) { COMSettingDef po = new COMSettingDef(); po.id = inf.id; po.name = inf.name; po.commport = inf.commPort; po.baudRate = inf.baudRate; po.rthreshold = inf.rthreshold.ToString() ; po.sthreshold = inf.sthreshold.ToString(); po.handshaking = inf.handshaking.ToString(); po.editor = inf.editor; po.cdt = inf.cdt.ToString("yyyy-MM-dd hh:mm:ss") ; po.udt = inf.udt.ToString("yyyy-MM-dd hh:mm:ss"); dataList.Add(po); } } } catch(Exception) { throw; } return dataList; }
protected void btnSave_ServerClick(object sender, EventArgs e) { COMSettingDef def = new COMSettingDef(); string name = this.ttName.Text.Trim(); def.name = name; def.commport = this.ttCommport.Text.Trim(); def.rthreshold = this.ttRThreshold.Text.Trim(); def.baudRate = this.ttBaudRate.Text.Trim(); def.handshaking = this.ttHandshaking.Text.Trim(); def.sthreshold = this.ttSThreshold.Text.Trim(); def.editor = this.HiddenUserName.Value.Trim(); //issuecode //ITC-1361-0062 itc210012 2012-2-15 if (!String.IsNullOrEmpty(this.dOldId.Value.Trim())) { def.id = Convert.ToInt32(this.dOldId.Value.Trim()); } int id =0; try { id=iws.AddOrUpdateWeightSettingItem(def); } catch (FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch (System.Exception ex) { showErrorMessage(ex.Message); return; } showList(); this.updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + id + "');HideWait();", true); }