public void SetGt(ICollection<sd_gt> gts) { gtlist = new List<itemobj>(); foreach (sd_gt gt in gts) { itemobj obj =new itemobj(gt); comboBoxEdit10.Properties.Items.Add(obj); comboBoxEdit11.Properties.Items.Add(obj); gtlist.Add(obj); } RowData = new sd_gtsb(); rowData.sbNumber = 1; }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { UCsd_gtsbclbMain ucTop = new UCsd_gtsbclbMain(); ucTop.InitColumns(); ucTop.InitData(); ucTop.hidbarmange(); FormBase dlg = showControl(ucTop); if (dlg.DialogResult == DialogResult.OK) { sd_gtsbclb obj = ucTop.SelectObject(); if (obj != null) { // List<sd_gtsb> listsb=new List<sd_gtsb>(); IList<sd_gtsbclb> list = Client.ClientHelper.PlatformSqlMap.GetList<sd_gtsbclb>("where ParentID='" + obj.ID + "'order by xh"); int i = 0; foreach (sd_gtsbclb pl in list) { i++; sd_gtsb pt = Client.ClientHelper.PlatformSqlMap.GetOne<sd_gtsb>("where gtid='" + parentID + "'and sbid='" + pl.ID + "'"); if (pt == null) { pt = new sd_gtsb(); pt.gtID = parentID; //pt.sbNumber = Convert.ToInt16(pl.sl); // pt.sbCode = pl.xh; pt.sbID = pl.ID; pt.sbModle = pl.xh; pt.sbName = pl.mc; pt.sbType = obj.zl; pt.C1 = pl.S1; Client.ClientHelper.PlatformSqlMap.Create<sd_gtsb>(pt); } else { pt.gtID = parentID; // pt.sbNumber = Convert.ToInt16(pl.sl); // pt.sbCode = getcode() + i; pt.sbID = pl.ID; pt.sbModle = pl.xh; pt.sbName = pl.mc; pt.sbType = obj.zl; pt.C1 = pl.S1; Client.ClientHelper.PlatformSqlMap.Update<sd_gtsb>(pt); } //listsb.Add(pt); } //Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(listsb,null,null); } } RefreshData(" where gtID='" + parentID + "' order by sbCode"); }
private void save() { int begin = comboBoxEdit10.SelectedIndex; int end = comboBoxEdit11.SelectedIndex; //int bh =1; if (string.IsNullOrEmpty(comboBoxEdit2.Text)) { MsgBox.ShowTipMessageBox("请选择设备种类"); comboBoxEdit2.Focus(); return; } //if (string.IsNullOrEmpty(comboBoxEdit3.Text)) { // MsgBox.ShowTipMessageBox("请选择设备型号"); // comboBoxEdit3.Focus(); // return; //} //if (!int.TryParse(comboBoxEdit1.Text, out bh)) { // bh = 1; //} //if (bh<0||bh > 999) { // MsgBox.ShowTipMessageBox("编号范围000-999"); // return; //} //if ((bh + end - begin) > 999) { // MsgBox.ShowTipMessageBox("终止编号不能大于999"); // return; //} List<sd_gtsb> gtsblist = new List<sd_gtsb>(); //for (int i = begin; i <= end; i++) { // sd_gt gt= gtlist[i].Gt; // sd_gtsb gtsb = new sd_gtsb(); // Ebada.Core.ConvertHelper.CopyTo(RowData,gtsb); // gtsb.gtID = gt.gtID; // gtsb.sbID =gt.CreateID()+i; // gtsb.sbCode = bh.ToString("000"); // gtsblist.Add(gtsb); //} DataTable dt = gridControl1.DataSource as DataTable; if (dt != null && dt.Rows.Count > 0) { for (int i = begin; i <= end; i++) { sd_gt gt = gtlist[i].Gt; int j = 0; foreach (DataRow dr in dt.Rows) { if (dr["type"] == null) continue; sd_gtsb gtsb = new sd_gtsb(); gtsb.sbName = dr["name"].ToString(); gtsb.sbModle = dr["sbgg"].ToString(); if (dr["sl"] != null && (dr["sl"].ToString().Trim())!="") gtsb.sbNumber = Convert.ToInt16( dr["sl"]); gtsb.sbID = gtsb.CreateID(); gtsb.gtID = gt.gtID; gtsb.sbID = gt.CreateID() + i; j++; gtsb.sbCode = j.ToString("000"); gtsb.sbType = dr["type"].ToString(); if (gtsb.sbName == "") continue; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 gtsblist.Add(gtsb); } } } Ebada.Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(gtsblist, null, null); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(sd_gtsb newobj) { if (parentID == null) return; newobj.gtID = parentID; newobj.sbCode = getCode(); }