void gridViewOperation_AfterAdd(JH_yearks obj) { if (type1 == "2") return; string[] dws = obj.c1.Split("、".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); StringBuilder sb =new StringBuilder(); bool hasgds = false; bool hasbds = false; foreach (var s in dws) { if (s == org.OrgName) continue; sb.Append("'" + s + "',"); } IList<mOrg> list = new List<mOrg>(); if (sb.Length > 2) { string str= sb.ToString(0,sb.Length -1); list = Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where orgname in (" + str + ")"); } if (list.Count > 0) { List<JH_yearks> listadd = new List<JH_yearks>(); foreach (var o in list) { IList<mOrg> list2 =Client.ClientHelper.PlatformSqlMap.GetList<mOrg>("where parentid='"+o.OrgID+"'"); if (list2.Count > 0) { foreach(var o2 in list2){ listadd.Add(createjh(o2, obj)); } } else { listadd.Add(createjh(o,obj)); } } Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(listadd.ToArray(), null, null); } }
void gridViewOperation_AfterDelete(JH_yearks obj) { Client.ClientHelper.PlatformSqlMap.DeleteByWhere<JH_yearks>("where c2='" + obj.ID + "'"); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(JH_yearks newobj) { newobj.ParentID = parentID; newobj.单位分类 = type1; if (org != null) { newobj.单位代码 = org.OrgCode; newobj.单位名称 = org.OrgName; newobj.c1 = org.OrgName; } newobj.计划种类 = "常规计划"; newobj.计划分类 = type2; newobj.预计时间 = DateTime.Today; newobj.预计时间2 = DateTime.Today; }
JH_yearks createjh(mOrg o,JH_yearks s) { JH_yearks jh = new JH_yearks(); ConvertHelper.CopyTo(s, jh); jh.ID = jh.CreateID(); jh.单位代码 = o.OrgCode; jh.单位名称 = o.OrgName; jh.c2 = s.ID; jh.单位分类 = "9";//下发任务 return jh; }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(JH_yearks newobj) { }
void ks_RowDoubleClicked(object sender, JH_yearks obj) { if (parentID == null) { MsgBox.ShowAskMessageBox("请先选择计划月份"); return; } foreach (JH_monthks jh in gridViewOperation.BindingList) { if (obj.ID == jh.c2) return; } JH_monthks addjh = new JH_monthks(); //ConvertHelper.CopyTo(obj, addjh); Type t = addjh.GetType(); Type t2 = obj.GetType(); foreach (PropertyInfo p in t.GetProperties()) { p.SetValue(addjh, t2.GetProperty(p.Name).GetValue(obj, null), null); } addjh.ID = addjh.CreateID(); addjh.c2 = obj.ID; addjh.ParentID = parentID; addjh.完成标记 = "未完成";//xjq add addjh.完成时间 = DateTime.Now; Client.ClientHelper.PlatformSqlMap.Create<JH_monthks>(addjh); gridViewOperation.BindingList.Add(addjh); if (obj.计划种类.Contains("一")) { obj.可选标记 = "否"; Client.ClientHelper.PlatformSqlMap.Update<JH_yearks>(obj); } }