private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { UCPS_tqsbclbmain ucTop = new UCPS_tqsbclbmain(); ucTop.InitColumns(); ucTop.InitData(); ucTop.hidbarmange(); FormBase dlg = showControl(ucTop); if (dlg.DialogResult == DialogResult.OK) { PS_tqsbclb obj = ucTop.SelectObject(); if (obj != null) { // List<PS_tqsb> listsb=new List<PS_tqsb>(); IList<PS_tqsbclb> list = Client.ClientHelper.PlatformSqlMap.GetList<PS_tqsbclb>("where ParentID='" +obj.ID+ "'order by xh"); int i = 0; foreach (PS_tqsbclb pl in list) { i++; PS_tqsb pt = null;// Client.ClientHelper.PlatformSqlMap.GetOne<PS_tqsb>("where tqid='" + parentID + "'and sbid='" + pl.ID + "'"); //if (pt==null) { pt=new PS_tqsb(); pt.tqID = parentID; pt.sbNumber = Convert.ToInt16(pl.sl); pt.sbCode = getcode(); pt.sbID +=i; pt.sbModle = pl.xh; pt.sbName = pl.mc; pt.sbType = pl.bh; pt.C1 = pl.S1; Client.ClientHelper.PlatformSqlMap.Create<PS_tqsb>(pt); } //else //{ // pt.tqID = 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<PS_tqsb>(pt); //} //listsb.Add(pt); } //Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(listsb,null,null); } } RefreshData(" where tqID='" + parentID + "' order by sbCode"); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(PS_tqsb newobj) { if (parentID == null) return; newobj.tqID = parentID; newobj.sbNumber = 1; newobj.sbCode = getcode(); }