void btn_Click(object sender, EventArgs e) { UserRegedit ur = new UserRegedit(); ur.MyPK = this.MyPK; ur.RetrieveFromDBSources(); ur.FK_Emp = WebUser.No; ur.CfgKey = this.EnsName + "_SearchAttrs"; Entity en = BP.DA.ClassFactory.GetEns(this.EnsName).GetNewEntity; Attr attr = en.EnMap.GetAttrByKey(this.AttrKey); string cfgVal = ur.MVals; AtPara ap = new AtPara(cfgVal); string old_Val = ap.GetValStrByKey(this.AttrKey); string keys = "@" + this.AttrKey + "="; if (attr.IsEnum) { SysEnums ses = new SysEnums(attr.UIBindKey); foreach (SysEnum item in ses) { if (this.Pub1.GetCBByID("CB_" + item.IntKey).Checked == false) { continue; } keys += "." + item.IntKey + "."; } if (ur.MVals.Contains("@" + this.AttrKey)) { ur.MVals = ur.MVals.Replace("@" + this.AttrKey + "=" + old_Val, keys); } else { ur.MVals = ur.MVals + keys; } ur.DirectUpdate(); } else { if (attr.UIBindKey == "BP.Port.Depts") { DataTable dt; if (WebUser.No == "admin") { dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept "); } else { dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')"); } foreach (DataRow dr in dt.Rows) { if (this.Pub1.GetCBByID("CB_" + dr[0].ToString()).Checked == false) { continue; } keys += "." + dr[0].ToString() + "."; } } else { Entities ens = BP.DA.ClassFactory.GetEns(attr.UIBindKey); ens.RetrieveAll(); foreach (Entity item in ens) { if (this.Pub1.GetCBByID("CB_" + item.GetValStrByKey(attr.UIRefKeyValue)).Checked == false) { continue; } keys += "." + item.GetValStrByKey(attr.UIRefKeyValue) + "."; } } if (ur.MVals.Contains("@" + this.AttrKey)) { ur.MVals = ur.MVals.Replace("@" + this.AttrKey + "=" + old_Val, keys); } else { ur.MVals = ur.MVals + keys; } ur.DirectUpdate(); } keys = keys.Replace("@" + this.AttrKey + "=", ""); this.WinClose(keys); }
void btn_Click(object sender, EventArgs e) { UserRegedit ur = new UserRegedit(); ur.MyPK = this.MyPK; ur.RetrieveFromDBSources(); ur.FK_Emp = WebUser.No; ur.CfgKey = this.EnsName + "_SearchAttrs"; Entity en = BP.En.ClassFactory.GetEns(this.EnsName).GetNewEntity; Attr attr = en.EnMap.GetAttrByKey(this.AttrKey); string cfgVal = ur.MVals; AtPara ap = new AtPara(cfgVal); string old_Val = ap.GetValStrByKey(this.AttrKey); string keys = "@" + this.AttrKey + "="; if (attr.IsEnum) { SysEnums ses = new SysEnums(attr.UIBindKey); foreach (SysEnum item in ses) { if (this.Pub1.GetCBByID("CB_" + item.IntKey).Checked == false) { continue; } keys += "." + item.IntKey + "."; } if (ur.MVals.Contains("@" + this.AttrKey)) { ur.MVals = ur.MVals.Replace("@" + this.AttrKey + "=" + old_Val, keys); } else { ur.MVals = ur.MVals + keys; } ur.DirectUpdate(); } else { Entities ens = BP.En.ClassFactory.GetEns(attr.UIBindKey); ens.RetrieveAll(); foreach (Entity item in ens) { if (this.Pub1.GetCBByID("CB_" + item.GetValStrByKey(attr.UIRefKeyValue)).Checked == false) { continue; } keys += "." + item.GetValStrByKey(attr.UIRefKeyValue) + "."; } if (ur.MVals.Contains("@" + this.AttrKey)) { ur.MVals = ur.MVals.Replace("@" + this.AttrKey + "=" + old_Val, keys); } else { ur.MVals = ur.MVals + keys; } ur.DirectUpdate(); } keys = keys.Replace("@" + this.AttrKey + "=", ""); this.WinClose(keys); }