public void GrantFor(string authtype) { string str = ""; if (base.CurrentUser.IsLogin) { object obj2 = new SmoothEnterprise.Database.DataSet().ExecuteScalar("SELECT gid FROM dguser WHERE id='" + base.CurrentUser.ID + "'"); if (obj2 == null) { str = ""; } str = (obj2 == null) ? "" : obj2.ToString(); } string str2 = authtype; if (str2 != null) { if (!(str2 == "50")) { if (!(str2 == "70")) { if (str2 == "90") { this.QUERY_gid.ItemAllDisplayed = true; this.QUERY_gid.ItemNoneDisplayed = true; } return; } } else { if (str != "") { this.QUERY_gid.ExtendWhere = "id='" + str + "'"; this._authwhere = " A.gid IN(SELECT id FROM dggroup WHERE id='{" + str + "}' OR pids LIKE '%{" + str + "}%')"; return; } this.QUERY_gid.ItemNoneDisplayed = true; this.QUERY_gid.ExtendWhere = "1=0"; this._authwhere = " A.id='" + base.CurrentUser.ID + "'"; return; } if (str != "") { this.QUERY_gid.ItemAllDisplayed = true; this.QUERY_gid.RootId = str; this._authwhere = " A.gid IN(SELECT id FROM dggroup WHERE id='{" + str + "}' OR pids LIKE '%{" + str + "}%')"; } else { this.QUERY_gid.ItemNoneDisplayed = true; this.QUERY_gid.ExtendWhere = "1=0"; this._authwhere = " A.id='" + base.CurrentUser.ID + "'"; } } }
//檔案上傳 protected void DdDept_SelectedIndexChanged(object sender, EventArgs e) { DDgid.Items.Clear(); SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); ds.Open(" select * from dggroup where comid='" + DdDept.SelectedValue + "'"); while (!ds.EOF) { DDgid.Items.Add(new ListItem(ds["name"].ToString(), ds["id"].ToString())); ds.MoveNext(); } }
protected void Page_Load(object sender, EventArgs e) { //this.tabtitle_Account.Attributes["tabtitle"] = base.GetLocalResourceObject("tabtitle_Account").ToString(); //this.tabtitle_Information.Attributes["tabtitle"] = base.GetLocalResourceObject("tabtitle_Information").ToString(); this.FIELD_photo.Attributes.Add("onchange", "value==''?" + this.PREVIEW_photo.ClientID + ".src='/lib/img/img-noimage.gif':" + this.PREVIEW_photo.ClientID + ".src=value;"); DataSet set = new DataSet(DataSetType.OpenRead); if (!base.IsPostBack) { this.FIELD_utype.Value = UType.SmoothEnterprise.ToString(); } set.Open("select * from dgrole "); this.FIELD_role.Items.Clear(); for (int i = 0; i < set.Rows.Count; i++) { this.FIELD_role.Items.Add(set.Rows[i]["name"].ToString(), set.Rows[i]["id"].ToString(), set.Rows[i]["isdefault"].ToString() == "Y"); } this.FIELD_utype_SelectedIndexChanged(sender, e); this.FIELD_pwd.Attributes.Add("onChange", this.FIELD_pwd_confirm.ClientID + ".value='';"); if (!this.IsPostBack) { SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); string whereis = ""; string comid = ""; ds.Open("select comid from dguser where id='" + this.CurrentUser.ID + "'"); if (ds["comid"].ToString() != "") { comid = ds["comid"].ToString().ToUpper().Trim(); } ds.Close(); if (comid != "MAT") { whereis = " where comid='" + comid + "'"; DdDept.SelectedValue = comid; DdDept.Enabled = false; } ds.Open(" select * from dggroup " + whereis); while (!ds.EOF) { DDgid.Items.Add(new ListItem(ds["name"].ToString(), ds["id"].ToString())); ds.MoveNext(); } } }
public int GetReminderCount() { int num = 0; try { SmoothEnterprise.Database.DataSet set = new SmoothEnterprise.Database.DataSet(); num = (int)set.ExecuteScalar(" SELECT COUNT(logonid) FROM dguser WHERE ustatus='" + UStatus.Pending.ToString() + "' "); } catch { } return(num); }
private void CreateXML(string requid) { DateTime currentDate = DateTime.Now; long elapsedTicks = currentDate.Ticks; SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); SmoothEnterprise.Database.DataSet rs1 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rs1.Open("select * from dguser where id='" + requid + "'"); string filename; int DTotal = 0; while (!rs1.EOF) { XmlDocument xdoc = new XmlDocument(); xdoc.AppendChild(xdoc.CreateXmlDeclaration("1.0", "UTF-8", "yes")); // 建立根節點物件並加入 XmlDocument 中 (第 0 層) XmlElement rootElement = xdoc.CreateElement("NewDataSet"); xdoc.AppendChild(rootElement); XmlElement eleChild1 = xdoc.CreateElement("NewDataSet"); /* * * ,utype,,,, * ,,,,,,effectdate,expiredate,dsn,gid * ,ucategory,userpath,authcode,sid,optname1,optvalue1,optsyscontrol1 * ,optname2,optvalue2,optsyscontrol2,optname3,optvalue3,optsyscontrol3,inituid * ,initdate,modifydate,modifyuid,comid,empid,levid,erpid*/ XmlElement eleGrandChilds = xdoc.CreateElement("FileType"); eleGrandChilds.InnerText = "ADD"; rootElement.AppendChild(eleGrandChilds); XmlElement eleGrandChild1 = xdoc.CreateElement("id"); eleGrandChild1.InnerText = rs1["id"].ToString().Trim(); rootElement.AppendChild(eleGrandChild1); XmlElement eleGrandChild2 = xdoc.CreateElement("utype"); eleGrandChild2.InnerText = rs1["utype"].ToString().Trim(); rootElement.AppendChild(eleGrandChild2); XmlElement eleGrandChild3 = xdoc.CreateElement("logonid"); eleGrandChild3.InnerText = rs1["logonid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild3); XmlElement eleGrandChild4 = xdoc.CreateElement("name"); eleGrandChild4.InnerText = rs1["name"].ToString().Trim(); rootElement.AppendChild(eleGrandChild4); XmlElement eleGrandChild5 = xdoc.CreateElement("userdomain"); eleGrandChild5.InnerText = rs1["userdomain"].ToString().Trim(); rootElement.AppendChild(eleGrandChild5); XmlElement eleGrandChild6 = xdoc.CreateElement("pwd"); eleGrandChild6.InnerText = rs1["pwd"].ToString().Trim(); rootElement.AppendChild(eleGrandChild6); XmlElement eleGrandChild7 = xdoc.CreateElement("pwdhintid"); eleGrandChild7.InnerText = rs1["pwdhintid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild7); XmlElement eleGrandChild8 = xdoc.CreateElement("pwdhint"); eleGrandChild8.InnerText = rs1["pwdhint"].ToString().Trim(); rootElement.AppendChild(eleGrandChild8); XmlElement eleGrandChild9 = xdoc.CreateElement("pwdanswer"); eleGrandChild9.InnerText = rs1["pwdanswer"].ToString().Trim(); rootElement.AppendChild(eleGrandChild9); XmlElement eleGrandChild10 = xdoc.CreateElement("email"); eleGrandChild10.InnerText = rs1["email"].ToString().Trim(); rootElement.AppendChild(eleGrandChild10); XmlElement eleGrandChild11 = xdoc.CreateElement("remark"); eleGrandChild11.InnerText = rs1["remark"].ToString().Trim(); rootElement.AppendChild(eleGrandChild11); XmlElement eleGrandChild12 = xdoc.CreateElement("ustatus"); eleGrandChild12.InnerText = rs1["ustatus"].ToString().Trim(); rootElement.AppendChild(eleGrandChild12); XmlElement eleGrandChild13 = xdoc.CreateElement("effectdate"); eleGrandChild13.InnerText = rs1["effectdate"].ToString().Trim(); rootElement.AppendChild(eleGrandChild13); XmlElement eleGrandChild14 = xdoc.CreateElement("expiredate"); eleGrandChild14.InnerText = rs1["expiredate"].ToString().Trim(); rootElement.AppendChild(eleGrandChild14); XmlElement eleGrandChild15 = xdoc.CreateElement("dsn"); eleGrandChild15.InnerText = rs1["dsn"].ToString().Trim(); rootElement.AppendChild(eleGrandChild15); XmlElement eleGrandChild16 = xdoc.CreateElement("gid"); eleGrandChild16.InnerText = rs1["gid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild16); XmlElement eleGrandChild17 = xdoc.CreateElement("ucategory"); eleGrandChild17.InnerText = rs1["ucategory"].ToString().Trim(); rootElement.AppendChild(eleGrandChild17); XmlElement eleGrandChild18 = xdoc.CreateElement("userpath"); eleGrandChild18.InnerText = rs1["userpath"].ToString().Trim(); rootElement.AppendChild(eleGrandChild18); /* * ,utype,,,, * ,,,,,,,,, * ,,,,,,, * ,optname2,optvalue2,optsyscontrol2,optname3,optvalue3,optsyscontrol3,inituid * ,initdate,modifydate,modifyuid,comid,empid,levid,erpid*/ XmlElement eleGrandChild19 = xdoc.CreateElement("authcode"); eleGrandChild19.InnerText = rs1["authcode"].ToString().Trim(); rootElement.AppendChild(eleGrandChild19); XmlElement eleGrandChild20 = xdoc.CreateElement("sid"); eleGrandChild20.InnerText = rs1["sid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild20); XmlElement eleGrandChild21 = xdoc.CreateElement("optname1"); eleGrandChild21.InnerText = rs1["optname1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild21); XmlElement eleGrandChild22 = xdoc.CreateElement("optvalue1"); eleGrandChild22.InnerText = rs1["optvalue1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild22); XmlElement eleGrandChild23 = xdoc.CreateElement("optsyscontrol1"); eleGrandChild23.InnerText = rs1["optsyscontrol1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild23); XmlElement eleGrandChild231 = xdoc.CreateElement("comid"); eleGrandChild231.InnerText = rs1["comid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild231); XmlElement eleGrandChild24 = xdoc.CreateElement("empid"); eleGrandChild24.InnerText = rs1["empid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild24); XmlElement eleGrandChild25 = xdoc.CreateElement("levid"); eleGrandChild25.InnerText = rs1["levid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild25); XmlElement eleGrandChild26 = xdoc.CreateElement("erpid"); eleGrandChild26.InnerText = rs1["erpid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild26); //lsit 使用者有那些群 ds.Open("select rid,uid,modifyuid from dgroleuser where uid='" + requid + "'"); //先暫時產生一筆 while (!ds.EOF) { XmlElement eleGrandChild27 = xdoc.CreateElement("rid"); eleGrandChild27.InnerText = ds["rid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild27); XmlElement eleGrandChild28 = xdoc.CreateElement("ruid"); eleGrandChild28.InnerText = ds["uid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild28); XmlElement eleGrandChild29 = xdoc.CreateElement("rmodifyuid"); eleGrandChild29.InnerText = ds["modifyuid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild29); //DTotal++; ds.MoveNext(); } ds.Close(); // XmlElement eleGrandChild28 = xdoc.CreateElement("DTotal"); // eleGrandChild28.InnerText = DTotal.ToString(); // rootElement.AppendChild(eleGrandChild28); filename = rs1["comid"].ToString().Trim() + "dguser" + elapsedTicks.ToString();//rs1["empid"].ToString(); // 將建立的 XML 節點儲存為檔案 xdoc.Save(@"C:\\Admin\\" + filename); xdoc.Clone(); Upload("C:\\Admin\\" + filename, "ftp://" + ftpip + "//" + filename, "mis", "666666"); rs1.MoveNext(); } rs1.Close(); }
protected void BUTTON_save_Click(object sender, EventArgs e) { if (base.IsValid) { try { Regex regex; if (WebConfigurationManager.AppSettings["PasswordCondition"] != null) { regex = new Regex(WebConfigurationManager.AppSettings["PasswordCondition"]); } else { regex = new Regex(""); } if (regex.IsMatch(this.FIELD_pwd.Text)) { //DataSet set = new DataSet(DataSetType.OpenUpdate); SmoothEnterprise.Database.DataSet set = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate); set.Open("select * from dguser where 1=0"); set.Add(); string g = Guid.NewGuid().ToString(); set["id"] = new Guid(g); if (this.FIELD_utype.Value != "") { set["utype"] = new Guid(this.FIELD_utype.Value); } if (this.FIELD_logonid.Text != "") { set["logonid"] = this.FIELD_logonid.Text; } if (this.FIELD_name.Text != "") { set["name"] = this.FIELD_name.Text; } if (this.FIELD_name1.Text != "") { set["name1"] = this.FIELD_name1.Text; } if (this.FIELD_photo.FileBytes.Length > 0) { set["icon"] = new Thumbneil(this.FIELD_photo.FileBytes, 0, 30).OutputBytes(); } if (this.FIELD_pwd.Text != "") { set["pwd"] = Encryption.Encode(this.FIELD_pwd.Text); } if (this.FIELD_email.Text != "") { set["email"] = this.FIELD_email.Text; } if (this.FIELD_gender.SelectedValue.ToString() != "") { set["gender"] = this.FIELD_gender.SelectedValue; } if (this.FIELD_remark.Text != "") { set["remark"] = this.FIELD_remark.Text; } if (this.FIELD_ucategory.Value != "") { set["ucategory"] = new Guid(this.FIELD_ucategory.Value); } if (this.FIELD_ustatus.Value != "") { set["ustatus"] = new Guid(this.FIELD_ustatus.Value); } if (this.FIELD_userdomain.Text != "") { set["userdomain"] = this.FIELD_userdomain.Text; } if (this.FIELD_effectdate.Text != "") { set["effectdate"] = System.Convert.ToDateTime(this.FIELD_effectdate.Text); } if (this.FIELD_expiredate.Text != "") { set["expiredate"] = System.Convert.ToDateTime(this.FIELD_expiredate.Text); } //if (this.FIELD_gid.Value != "") //{ // set["gid"] = new Guid(this.FIELD_gid.Value); set["gid"] = new Guid(DDgid.SelectedValue); //} if (base.CurrentUser.IsLogin) { set["inituid"] = new Guid(base.CurrentUser.ID); } set["initdate"] = DateTime.Now; if (base.CurrentUser.IsLogin) { set["modifyuid"] = new Guid(base.CurrentUser.ID); } set["modifydate"] = DateTime.Now; //herzog Add set["comid"] = DdDept.SelectedValue; set["empid"] = empid.Text; set.Update(); if (this.FIELD_photo.FileBytes.Length > 0) { set.Open("select * from dgimage where 1=0"); set.Add(); set["name"] = this.FIELD_name.Text; set["image"] = this.FIELD_photo.FileBytes; set["sid"] = new Guid(g); if (base.CurrentUser.IsLogin) { set["inituid"] = new Guid(base.CurrentUser.ID); set["modifyuid"] = new Guid(base.CurrentUser.ID); } set["initdate"] = DateTime.Now; set["modifydate"] = DateTime.Now; set.Update(); } set.Open("select * from dgroleuser where 1=0"); for (int i = 0; i < this.FIELD_role.SelectedItems.Length; i++) { set.Add(); set["uid"] = new Guid(g); set["rid"] = new Guid(this.FIELD_role.SelectedItems[i].Value); if (base.CurrentUser.IsLogin) { set["modifyuid"] = new Guid(base.CurrentUser.ID); } set["modifydate"] = DateTime.Now; set.Update(); } set.Close(); SmoothEnterprise.Database.DataSet fs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); fs.Open("select id from dguser where logonid='" + this.FIELD_logonid.Text + "'"); if (!fs.EOF) { CreateXML(fs["id"].ToString()); } fs.Close(); if (sender == this.BUTTON_savenext) { base.Response.Redirect("UserCompanyAdd.aspx"); } else { base.Response.Redirect("UserCompany.aspx"); } } else { this.FIELD_pwd.Text = ""; this.FIELD_pwd_confirm.Text = ""; base.AddError(this, "BUTTON_save_Click", "", base.GetLocalResourceObject("PasswordConditionMessageResource1").ToString()); } } catch (Exception exception) { base.AddError(this, "", "", exception.Message); } } }
protected void BUTTON_save_Click(object sender, EventArgs e) { SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate); rs.Open("SELECT * FROM dguser WHERE id='" + this.FIELD_id.Text + "'"); if (!rs.EOF) { rs["pwd"] = Encryption.Encode(this.FIELD_pwd.Text); if (this.FIELD_pwdhintid.Value != "") { rs["pwdhintid"] = new Guid(this.FIELD_pwdhintid.Value); } else { rs["pwdhintid"] = DBNull.Value; } if (this.FIELD_pwdanswer.Text != "") { rs["pwdanswer"] = Utility.Encryptor(this.FIELD_pwdanswer.Text); } else { rs["pwdanswer"] = DBNull.Value; } /* if (new Guid(this.FIELD_ustatus.Text) == UStatus.ChangePassword) * { * rs["ustatus"] = UStatus.Enable; * }*/ if (base.CurrentUser.IsLogin) { rs["modifyuid"] = new Guid(base.CurrentUser.ID); } rs["ustatus"] = "57DADAB8-44CF-4BAA-A40C-324F9F4533A9"; rs["modifydate"] = DateTime.Now; rs.Update(); } rs.Close(); base.Response.Redirect(((base.BackPageUrl == "") || (base.BackPageUrl.ToLower().IndexOf("security/login.aspx") >= 0)) ? "Logout.aspx" : base.BackPageUrl); /*if (base.IsValid) * { * try * { * Regex regex; * if (WebConfigurationManager.AppSettings["PasswordCondition"] != null) * { * regex = new Regex(WebConfigurationManager.AppSettings["PasswordCondition"]); * } * else * { * regex = new Regex(""); * } * if (regex.IsMatch(this.FIELD_pwd.Text)) * { * bool flag = false; * DataSet set = new DataSet(DataSetType.OpenRead); * int result = 0; * try * { * int.TryParse(WebConfigurationManager.AppSettings["PasswordReuseCount"], out result); * } * catch * { * result = 0; * } * set.Open("select top " + result.ToString() + " logresult from dguserlog where ulogtype='" + ULogType.ChgPwd.ToString() + "' and logresult like '%ChangePassword:%' and uid='" + this.FIELD_id.Text + "' order by logondate desc"); * while (!set.EOF) * { * if (Encryption.Decode(set["logresult"].ToString().Replace("ChangePassword:"******"")).Split(new char[] { ',' })[1] == this.FIELD_pwd.Text) * { * flag = true; * } * set.MoveNext(); * } * if (!flag) * { * DataSet set2 = new DataSet(DataSetType.OpenUpdate); * set2.Open("SELECT * FROM dguser WHERE id='" + this.FIELD_id.Text + "'; "); * if (this.FIELD_pwd.Text != "") * { * set2["pwd"] = Encryption.Encode(this.FIELD_pwd.Text); * } * if (this.FIELD_pwdhintid.Value != "") * { * set2["pwdhintid"] = new Guid(this.FIELD_pwdhintid.Value); * } * else * { * set2["pwdhintid"] = DBNull.Value; * } * if (this.FIELD_pwdanswer.Text != "") * { * set2["pwdanswer"] = Utility.Encryptor(this.FIELD_pwdanswer.Text); * } * else * { * set2["pwdanswer"] = DBNull.Value; * } * if (new Guid(this.FIELD_ustatus.Text) == UStatus.ChangePassword) * { * set2["ustatus"] = UStatus.Enable; * } * if (base.CurrentUser.IsLogin) * { * set2["modifyuid"] = new Guid(base.CurrentUser.ID); * } * set2["modifydate"] = DateTime.Now; * set2.Update(); * set2.Close(); * Utility.UserLogAdd(base.Request, this.FIELD_id.Text, ULogType.ChgPwd.ToString(), "ChangePassword:"******"," + this.FIELD_pwd.Text)); * if (!(new Guid(this.FIELD_ustatus.Text) == UStatus.ChangePassword)) * { * this.BUTTON_cancel_Click(sender, e); * } * } * else * { * this.FIELD_pwd.Text = ""; * this.FIELD_pwd_confirm.Text = ""; * base.AddError(this, "BUTTON_save_Click", "", base.GetLocalResourceObject("PasswordCannotuseMessageResource1").ToString().Replace("#reusecount#", result.ToString())); * } * } * else * { * this.FIELD_pwd.Text = ""; * this.FIELD_pwd_confirm.Text = ""; * base.AddError(this, "BUTTON_save_Click", "", base.GetLocalResourceObject("PasswordConditionMessageResource1").ToString()); * } * } * catch (Exception exception) * { * base.AddError(this, "BUTTON_save_Click", "", exception.Message); * } * }*/ }
//建立XML 檔 //輸入的參數為 link id private void CreateXML(string requid) { DateTime currentDate = DateTime.Now; long elapsedTicks = currentDate.Ticks; SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); SmoothEnterprise.Database.DataSet rs1 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rs1.Open("select * from dguser where id='" + requid + "'"); string filename; int DTotal = 0; while (!rs1.EOF) { XmlDocument xdoc = new XmlDocument(); xdoc.AppendChild(xdoc.CreateXmlDeclaration("1.0", "UTF-8", "yes")); // 建立根節點物件並加入 XmlDocument 中 (第 0 層) XmlElement rootElement = xdoc.CreateElement("NewDataSet"); xdoc.AppendChild(rootElement); XmlElement eleChild1 = xdoc.CreateElement("NewDataSet"); XmlElement eleGrandChilds = xdoc.CreateElement("FileType"); eleGrandChilds.InnerText = "Update"; rootElement.AppendChild(eleGrandChilds); XmlElement eleGrandChild1 = xdoc.CreateElement("id"); eleGrandChild1.InnerText = rs1["id"].ToString().Trim(); rootElement.AppendChild(eleGrandChild1); XmlElement eleGrandChild2 = xdoc.CreateElement("utype"); if (LocComid.SelectedValue != "NA") { eleGrandChild2.InnerText = "64CA1E7D-B15F-43CB-A33A-D29DB9020892"; } else { eleGrandChild2.InnerText = rs1["utype"].ToString().Trim(); } rootElement.AppendChild(eleGrandChild2); XmlElement eleGrandChild3 = xdoc.CreateElement("logonid"); eleGrandChild3.InnerText = rs1["logonid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild3); XmlElement eleGrandChild4 = xdoc.CreateElement("name"); eleGrandChild4.InnerText = rs1["name"].ToString().Trim(); rootElement.AppendChild(eleGrandChild4); XmlElement eleGrandChild5 = xdoc.CreateElement("userdomain"); eleGrandChild5.InnerText = rs1["userdomain"].ToString().Trim(); rootElement.AppendChild(eleGrandChild5); XmlElement eleGrandChild6 = xdoc.CreateElement("pwd"); if (LocComid.SelectedValue != "NA") { eleGrandChild6.InnerText = rs1["pwd"].ToString().Trim(); } else { eleGrandChild6.InnerText = ""; } rootElement.AppendChild(eleGrandChild6); XmlElement eleGrandChild7 = xdoc.CreateElement("pwdhintid"); eleGrandChild7.InnerText = rs1["pwdhintid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild7); XmlElement eleGrandChild8 = xdoc.CreateElement("pwdhint"); eleGrandChild8.InnerText = rs1["pwdhint"].ToString().Trim(); rootElement.AppendChild(eleGrandChild8); XmlElement eleGrandChild9 = xdoc.CreateElement("pwdanswer"); eleGrandChild9.InnerText = rs1["pwdanswer"].ToString().Trim(); rootElement.AppendChild(eleGrandChild9); XmlElement eleGrandChild10 = xdoc.CreateElement("email"); eleGrandChild10.InnerText = rs1["email"].ToString().Trim(); rootElement.AppendChild(eleGrandChild10); XmlElement eleGrandChild11 = xdoc.CreateElement("remark"); eleGrandChild11.InnerText = rs1["remark"].ToString().Trim(); rootElement.AppendChild(eleGrandChild11); XmlElement eleGrandChild12 = xdoc.CreateElement("ustatus"); if (LocComid.SelectedValue != "NA") { eleGrandChild12.InnerText = "76CBA823-E891-45D3-8B6C-4724E6C69D5B"; } else { eleGrandChild12.InnerText = rs1["ustatus"].ToString().Trim(); } rootElement.AppendChild(eleGrandChild12); XmlElement eleGrandChild13 = xdoc.CreateElement("effectdate"); eleGrandChild13.InnerText = rs1["effectdate"].ToString().Trim(); rootElement.AppendChild(eleGrandChild13); XmlElement eleGrandChild14 = xdoc.CreateElement("expiredate"); eleGrandChild14.InnerText = rs1["expiredate"].ToString().Trim(); rootElement.AppendChild(eleGrandChild14); XmlElement eleGrandChild15 = xdoc.CreateElement("dsn"); eleGrandChild15.InnerText = rs1["dsn"].ToString().Trim(); rootElement.AppendChild(eleGrandChild15); XmlElement eleGrandChild16 = xdoc.CreateElement("gid"); if (LocComid.SelectedValue != "NA") { eleGrandChild16.InnerText = "";//因為子廠可能不會有這個人的群組 } else { eleGrandChild16.InnerText = rs1["gid"].ToString().Trim(); } rootElement.AppendChild(eleGrandChild16); XmlElement eleGrandChild17 = xdoc.CreateElement("ucategory"); eleGrandChild17.InnerText = rs1["ucategory"].ToString().Trim(); rootElement.AppendChild(eleGrandChild17); XmlElement eleGrandChild18 = xdoc.CreateElement("userpath"); eleGrandChild18.InnerText = rs1["userpath"].ToString().Trim(); rootElement.AppendChild(eleGrandChild18); /* * ,utype,,,, * ,,,,,,,,, * ,,,,,,, * ,optname2,optvalue2,optsyscontrol2,optname3,optvalue3,optsyscontrol3,inituid * ,initdate,modifydate,modifyuid,comid,empid,levid,erpid*/ XmlElement eleGrandChild19 = xdoc.CreateElement("authcode"); eleGrandChild19.InnerText = rs1["authcode"].ToString().Trim(); rootElement.AppendChild(eleGrandChild19); XmlElement eleGrandChild20 = xdoc.CreateElement("sid"); eleGrandChild20.InnerText = rs1["sid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild20); XmlElement eleGrandChild21 = xdoc.CreateElement("optname1"); eleGrandChild21.InnerText = rs1["optname1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild21); XmlElement eleGrandChild22 = xdoc.CreateElement("optvalue1"); eleGrandChild22.InnerText = rs1["optvalue1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild22); XmlElement eleGrandChild23 = xdoc.CreateElement("optsyscontrol1"); eleGrandChild23.InnerText = rs1["optsyscontrol1"].ToString().Trim(); rootElement.AppendChild(eleGrandChild23); XmlElement eleGrandChild231 = xdoc.CreateElement("comid"); eleGrandChild231.InnerText = rs1["comid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild231); XmlElement eleGrandChild24 = xdoc.CreateElement("empid"); eleGrandChild24.InnerText = rs1["empid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild24); XmlElement eleGrandChild25 = xdoc.CreateElement("levid"); eleGrandChild25.InnerText = rs1["levid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild25); XmlElement eleGrandChild26 = xdoc.CreateElement("erpid"); eleGrandChild26.InnerText = rs1["erpid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild26); //lsit 使用者有那些群組 ds.Open("select rid,uid,modifyuid from dgroleuser where uid='" + requid + "'"); //先暫時產生一筆 if (!ds.EOF) { XmlElement eleGrandChild27 = xdoc.CreateElement("rid"); eleGrandChild27.InnerText = "6D25693F-6B5D-4A5F-8716-D641A335B925"; // ds["rid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild27); XmlElement eleGrandChild28 = xdoc.CreateElement("ruid"); eleGrandChild28.InnerText = ds["uid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild28); XmlElement eleGrandChild29 = xdoc.CreateElement("rmodifyuid"); eleGrandChild29.InnerText = ds["modifyuid"].ToString().Trim(); rootElement.AppendChild(eleGrandChild29); //DTotal++; //ds.MoveNext(); } ds.Close(); // XmlElement eleGrandChild28 = xdoc.CreateElement("DTotal"); // eleGrandChild28.InnerText = DTotal.ToString(); // rootElement.AppendChild(eleGrandChild28); if (LocComid.SelectedValue != "NA") { filename = LocComid.SelectedValue + "dguser" + elapsedTicks.ToString(); // rs1["empid"].ToString(); } else { filename = rs1["comid"].ToString().Trim() + "dguser" + elapsedTicks.ToString(); // rs1["empid"].ToString(); } // 將建立的 XML 節點儲存為檔案 xdoc.Save(@"C:\\Admin\\" + filename); xdoc.Clone(); Upload("C:\\Admin\\" + filename, "ftp://" + ftpip + "//" + filename, username, password); rs1.MoveNext(); } rs1.Close(); }
protected void Page_Load(object sender, EventArgs e) { // this.tabtitle_Account.Attributes["tabtitle"] = base.GetLocalResourceObject("tabtitle_Account").ToString(); // this.tabtitle_Information.Attributes["tabtitle"] = base.GetLocalResourceObject("tabtitle_Information").ToString(); this.FIELD_photo.Attributes.Add("onchange", "value==''?" + this.PREVIEW_photo.ClientID + ".src='/lib/img/img-noimage.gif':" + this.PREVIEW_photo.ClientID + ".src=value;"); DataSet set = new DataSet(DataSetType.OpenRead); try { set.Open("select A.*,B.uid from dgrole A LEFT OUTER JOIN dgroleuser B ON A.id=B.rid and B.uid='" + base.Request.QueryString["id"] + "' "); this.FIELD_role.Items.Clear(); for (int i = 0; i < set.Rows.Count; i++) { this.FIELD_role.Items.Add(set.Rows[i]["name"].ToString(), set.Rows[i]["id"].ToString(), set.Rows[i]["uid"].ToString() != ""); } if (!base.IsPostBack) { set.Open("select * from dguser where id='" + base.Request.QueryString["id"] + "'"); if (!set.EOF) { this.FIELD_utype.Value = set["utype"].ToString(); this.FIELD_logonid.Text = set["logonid"].ToString(); this.FIELD_name.Text = set["name"].ToString(); this.FIELD_name1.Text = set["name1"].ToString(); this.PREVIEW_photo.Src = "UserImage.aspx?id=" + set["id"].ToString() + "&photo=1"; this.FIELD_pwd.Text = set["pwd"].ToString(); this.FIELD_opwd.Text = set["pwd"].ToString(); this.FIELD_pwd_confirm.Text = set["pwd"].ToString(); this.FIELD_email.Text = set["email"].ToString(); this.FIELD_gender.SelectedIndex = this.FIELD_gender.Items.IndexOf(this.FIELD_gender.Items.FindByValue(set["gender"].ToString())); this.FIELD_remark.Text = set["remark"].ToString(); this.FIELD_ucategory.Value = set["ucategory"].ToString(); this.FIELD_ustatus.Value = set["ustatus"].ToString(); this.FIELD_userdomain.Text = set["userdomain"].ToString(); if (set["effectdate"].ToString() != "") { this.FIELD_effectdate.Text = DateTime.Parse(set["effectdate"].ToString()).ToShortDateString(); } if (set["expiredate"].ToString() != "") { this.FIELD_expiredate.Text = DateTime.Parse(set["expiredate"].ToString()).ToShortDateString(); } // this.FIELD_gid.Value = set["gid"].ToString(); SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); string whereis = ""; string comid = ""; ds.Open("select comid from dguser where id='" + this.CurrentUser.ID + "'"); if (ds["comid"].ToString() != "") { comid = ds["comid"].ToString().ToUpper().Trim(); } ds.Close(); if (comid != "MAT") { whereis = " where comid='" + comid + "'"; DdDept.SelectedValue = comid; DdDept.Enabled = false; LocComid.Enabled = false; } ds.Open(" select * from dggroup " + whereis); while (!ds.EOF) { DDgid.Items.Add(new ListItem(ds["name"].ToString(), ds["id"].ToString())); ds.MoveNext(); } ds.Close(); DDgid.SelectedValue = set["gid"].ToString(); DdDept.SelectedValue = set["comid"].ToString().Trim(); empid.Text = set["empid"].ToString(); } else { base.Response.Redirect("User.aspx"); } } } catch { base.Response.Redirect("User.aspx"); } this.FIELD_utype_SelectedIndexChanged(sender, e); this.FIELD_pwd.Attributes.Add("onChange", this.FIELD_pwd_confirm.ClientID + ".value='';"); }