public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; XHD.BLL.ssn_art_menu menu = new XHD.BLL.ssn_art_menu(); XHD.BLL.sys_info info = new XHD.BLL.sys_info(); var cookie = context.Request.Cookies[FormsAuthentication.FormsCookieName]; var ticket = FormsAuthentication.Decrypt(cookie.Value); string CoockiesID = ticket.UserData; XHD.BLL.hr_employee emp = new XHD.BLL.hr_employee(); int emp_id = int.Parse(CoockiesID); DataSet dsemp = emp.GetList("id=" + emp_id); XHD.Model.hr_employee employeeModel = emp.GetModel(emp_id); //当前员工 string empname = string.Empty; string uid = string.Empty; string depid = string.Empty; string roletype = string.Empty; string factory_Id = string.Empty; if (employeeModel != null) { empname = employeeModel.name; //员工姓名 uid = employeeModel.uid; //员工Uid depid = employeeModel.d_id.ToString(); //员工所在部门 factory_Id = employeeModel.factory_Id; //员工所属工厂 roletype = employeeModel.roletype.ToString(); } #region GetSysApp if (request["Action"] == "GetSysApp") { DataSet ds = null; int appid = int.Parse(request["appid"]); if (dsemp.Tables[0].Rows.Count > 0) { if (dsemp.Tables[0].Rows[0]["uid"].ToString() == "admin") { ds = menu.GetList(0, "App_id=" + appid, "Menu_order"); } else { DataSSN.SSN_GetAuthorityByUid getauth = new DataSSN.SSN_GetAuthorityByUid(); string menus = getauth.GetAuthority(emp_id.ToString(), "Menus"); //ds = menu.GetList(0, "App_id=" + appid + " and Menu_id in " + menus + " and menu_type='aft'", "Menu_order"); ds = menu.GetList(0, "App_id=" + appid + " and Id in " + menus + " ", "Menu_order"); } } string strRe = string.Empty; //==============整理返回============================================== strRe = "[" + GetTasksString(emp_id.ToString(), empname, factory_Id, 0, ds.Tables[0]) + "]"; context.Response.Write(strRe); } #endregion #region getUserTree else if (request["Action"] == "getUserTree") { XHD.BLL.Sys_online sol = new XHD.BLL.Sys_online(); XHD.Model.Sys_online model = new XHD.Model.Sys_online(); model.UserName = PageValidate.InputText(empname, 250); model.UserID = emp_id; model.LastLogTime = DateTime.Now; DataSet ds1 = sol.GetList(" UserID=" + emp_id); //添加当前用户信息 if (ds1.Tables[0].Rows.Count > 0) { sol.Update(model, " UserID=" + emp_id); } else { sol.Add(model); } //删除超时用户 //2分钟用户失效,删除 --Robert 2015-11-24 sol.Delete(" LastLogTime<date_sub(now(), interval 2 minute)"); XHD.BLL.hr_department dep = new XHD.BLL.hr_department(); XHD.BLL.hr_post hp = new XHD.BLL.hr_post(); DataSet ds = dep.GetList(0, "factory_Id='" + factory_Id + "'", "d_order"); StringBuilder str = new StringBuilder(); str.Append("["); str.Append(GetTreeString(0, ds.Tables[0], 1, "1=1")); str.Replace(",", "", str.Length - 1, 1); str.Append("]"); context.Response.Write(str); } #endregion #region GetUserInfo else if (request["Action"] == "GetUserInfo") { string dt = XHD.Common.DataToJson.DataToJSON(dsemp); context.Response.Write(dt); } #endregion #region GetOnline else if (request["Action"] == "GetOnline") { XHD.BLL.Sys_online sol = new XHD.BLL.Sys_online(); XHD.Model.Sys_online model = new XHD.Model.Sys_online(); model.UserName = empname; model.UserID = emp_id; model.LastLogTime = DateTime.Now; DataSet ds1 = sol.GetList(" UserID=" + emp_id); //添加当前用户信息 if (ds1.Tables[0].Rows.Count > 0) { sol.Update(model, " UserID=" + emp_id); } else { sol.Add(model); } //} //删除超时用户 //2分钟用户失效,删除 --Robert 2015-11-24 sol.Delete(" LastLogTime<date_sub(now(), interval 2 minute)"); context.Response.Write(XHD.Common.GetGridJSON.DataTableToJSON(sol.GetAllList().Tables[0])); } #endregion #region getinfo else if (request["Action"] == "getinfo") { DataSet ds = info.GetList(" id=2 or id=3"); context.Response.Write(XHD.Common.GetGridJSON.DataTableToJSON(ds.Tables[0])); } #endregion #region changepwd else if (request["Action"] == "changepwd") { DataSet ds = emp.GetPWD(emp_id); XHD.Model.hr_employee model = new XHD.Model.hr_employee(); string oldpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(request["T_oldpwd"], "MD5"); string newpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(request["T_newpwd"], "MD5"); if (ds.Tables[0].Rows[0]["pwd"].ToString() == oldpwd) { model.pwd = newpwd; model.ID = (emp_id); emp.changepwd(model); context.Response.Write("true"); } else { context.Response.Write("false"); } } #endregion #region form else if (request["Action"] == "form") { string eid = PageValidate.InputText(request["id"], 50); if (eid == "epu") { eid = emp_id.ToString(); } DataSet ds = emp.GetList("id=" + int.Parse(eid)); string dt = XHD.Common.DataToJson.DataToJSON(ds); context.Response.Write(dt); } #endregion #region PersonalUpdate保存修改信息 else if (request["Action"] == "PersonalUpdate") { XHD.Model.hr_employee model = new XHD.Model.hr_employee(); model.email = PageValidate.InputText(request["T_email"], 255); model.name = PageValidate.InputText(request["T_name"], 255); model.birthday = PageValidate.InputText(request["T_birthday"], 255); model.sex = PageValidate.InputText(request["T_sex"], 255); model.idcard = PageValidate.InputText(request["T_idcard"], 255); model.tel = PageValidate.InputText(request["T_tel"], 255); model.address = PageValidate.InputText(request["T_Adress"], 255); model.schools = PageValidate.InputText(request["T_school"], 255); model.education = PageValidate.InputText(request["T_edu"], 255); model.professional = PageValidate.InputText(request["T_professional"], 255); model.remarks = PageValidate.InputText(request["T_remarks"], 255); model.title = PageValidate.InputText(request["headurl"], 255); DataRow dr = dsemp.Tables[0].Rows[0]; model.ID = emp_id; bool isup = emp.PersonalUpdate(model); if (isup) { context.Response.Write("true"); } else { context.Response.Write("false"); } C_Sys_log log = new C_Sys_log(); int UserID = emp_id; string UserName = empname; string IPStreet = request.UserHostAddress; string EventTitle = model.name; string EventType = "个人信息修改"; int EventID = emp_id; if (dr["email"].ToString() != request["T_email"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "邮箱", dr["email"].ToString(), request["T_email"], factory_Id); } if (dr["name"].ToString() != request["T_name"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "员工姓名", dr["name"].ToString(), request["T_name"], factory_Id); } if (dr["birthday"].ToString() != request["T_birthday"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "员工生日", dr["birthday"].ToString(), request["T_birthday"], factory_Id); } if (dr["sex"].ToString() != request["T_sex"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "员工性别", dr["sex"].ToString(), request["T_sex"], factory_Id); } if (dr["idcard"].ToString() != request["T_idcard"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "身份证", dr["idcard"].ToString(), request["T_idcard"], factory_Id); } if (dr["tel"].ToString() != request["T_tel"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "手机", dr["tel"].ToString(), request["T_tel"], factory_Id); } if (dr["address"].ToString() != request["T_Adress"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "地址", dr["address"].ToString(), request["T_Adress"], factory_Id); } if (dr["schools"].ToString() != request["T_school"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "毕业学校", dr["schools"].ToString(), request["T_school"], factory_Id); } if (dr["education"].ToString() != request["T_edu"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "学历", dr["education"].ToString(), request["T_edu"], factory_Id); } if (dr["professional"].ToString() != request["T_professional"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "专业", dr["professional"].ToString(), request["T_professional"], factory_Id); } } #endregion #region tree else if (request["Action"] == "tree") { string serchtxt = " 1=1 and factory_Id = '" + factory_Id + "'"; //string authtxt = PageValidate.InputText(request["auth"], 50); //if (!string.IsNullOrEmpty(authtxt)) //{ // Data.GetDataAuth dataauth = new Data.GetDataAuth(); // string txt = dataauth.GetDataAuthByid(authtxt, "Sys_add", emp_id.ToString(), factory_Id); // string[] arr = txt.Split(':'); // switch (arr[0]) // { // case "my": // case "dep": // string did = dsemp.Tables[0].Rows[0]["d_id"].ToString(); // if (string.IsNullOrEmpty(did)) // did = "0"; // authtxt = did; // break; // case "all": // authtxt = "0"; // break; // case "depall": // DataSet dsdep = dep.GetList("factory_Id='" + factory_Id + "'"); // string deptask = GetDepTask(int.Parse(arr[1]), dsdep.Tables[0]); // string intext = arr[1] + "," + deptask; // authtxt = intext.TrimEnd(','); // break; // } //} //context.Response.Write(authtxt); XHD.BLL.hr_department dep = new XHD.BLL.hr_department(); DataSet ds = dep.GetList(0, serchtxt, " d_order"); StringBuilder str = new StringBuilder(); str.Append("["); str.Append(GetTreeString(0, ds.Tables[0], "0")); str.Replace(",", "", str.Length - 1, 1); str.Append("]"); context.Response.Write(str); } #endregion }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; XHD.BLL.ssn_art _art = new XHD.BLL.ssn_art(); XHD.BLL.ssn_authority _authority = new XHD.BLL.ssn_authority(); XHD.BLL.ssn_art_menu _menu = new XHD.BLL.ssn_art_menu(); XHD.BLL.ssn_role _role = new XHD.BLL.ssn_role(); XHD.BLL.ssn_visit _visit = new XHD.BLL.ssn_visit(); C_Sys_log log = new C_Sys_log(); XHD.Model.ssn_art model = new XHD.Model.ssn_art(); var cookie = context.Request.Cookies[FormsAuthentication.FormsCookieName]; var ticket = FormsAuthentication.Decrypt(cookie.Value); string CoockiesID = ticket.UserData; XHD.BLL.hr_employee emp = new XHD.BLL.hr_employee(); int emp_id = int.Parse(CoockiesID); DataSet dsemp = emp.GetList("id=" + emp_id); string empname = string.Empty; string uid = string.Empty; string factory_Id = string.Empty; if (dsemp != null && dsemp.Tables[0].Rows.Count > 0) { empname = dsemp.Tables[0].Rows[0]["name"].ToString(); uid = dsemp.Tables[0].Rows[0]["uid"].ToString(); factory_Id = dsemp.Tables[0].Rows[0]["Factory_Id"].ToString(); } #region 加载数据grid if (request["Action"] == "grid") { int PageIndex = int.Parse(request["page"] == null ? "1" : request["page"]); int PageSize = int.Parse(request["pagesize"] == null ? "30" : request["pagesize"]); string Total = string.Empty; string filedOrder = " Art_order desc,Id desc "; string strWhere = " "; strWhere += " factory_id ='" + factory_Id + "' and is_del=0 "; if (!string.IsNullOrEmpty(request["Art_Menu_Id"])) { strWhere += " and Art_Menu_Id = '" + request["Art_Menu_Id"] + "'"; } DataSet ds = _art.GetList(PageSize, PageIndex, strWhere, filedOrder, out Total); string dt = XHD.Common.GetGridJSON.DataTableToJSON1(ds.Tables[0], Total); context.Response.Write(dt); } #endregion #region 加载员工的所能操作的页面 tree else if (request["Action"] == "tree") { DataSet dk = null; if (uid != "admin") { string serchtxt = " a.factory_Id = '" + factory_Id + "' and a.App_ids='1' "; serchtxt += "and r.empID='" + emp_id + "'"; DataSet ds = _authority.GetListAuth(serchtxt); if (ds != null && ds.Tables[0].Rows.Count > 0) { string menu_ids = ""; foreach (DataRow item in ds.Tables[0].Rows) { menu_ids += item["Menu_ids"].ToString(); } menu_ids = PageValidate.InputText(menu_ids, int.MaxValue).Replace("m", ""); menu_ids = menu_ids.Substring(0, menu_ids.Length - 1); dk = _menu.GetList(0, " factory_Id='" + factory_Id + "' and Id in (" + menu_ids + ")", "Menu_order"); } } else { dk = _menu.GetList(0, " factory_Id='" + factory_Id + "' and app_id=1", "Menu_order"); } StringBuilder str = new StringBuilder(); str.Append("["); str.Append(GetTreeString(0, dk.Tables[0])); str.Replace(",", "", str.Length - 1, 1); str.Append("]"); context.Response.Write(str); } #endregion #region 保存save else if (request["Action"] == "save") { model.Art_title = XHD.Common.PageValidate.InputText(request["T_title"], 250); model.Art_Content = PageValidate.InputText(request["T_content"], int.MaxValue); model.Art_Content = HttpUtility.HtmlDecode(model.Art_Content); model.Art_title_en = GetSpellCode(model.Art_title);; model.image_lst = PageValidate.InputText(request["images"], int.MaxValue); model.Art_order = int.Parse(request["T_Order"]); model.factory_Id = factory_Id; model.Art_Menu_Id = Convert.ToInt32(PageValidate.InputText(request["art_Menu_Id"], 50)); string id = PageValidate.InputText(request["nid"], 50); if (!string.IsNullOrEmpty(id) && id != "null") { DataSet ds = _art.GetList("Id=" + int.Parse(id)); DataRow dr = ds.Tables[0].Rows[0]; model.Id = int.Parse(id); if (_art.Update(model)) { #region 修改访问权限 //查询该文章原来属于哪些角色下 DataSet dm = _visit.GetList(" Factory_Id='" + factory_Id + "' and find_in_set('a" + model.Id + "', Art_id)"); if (dm != null && dm.Tables[0].Rows.Count > 0) { //此次修改的文章以前已分配过角色 string oldRoleId = string.Empty; //原来所属的角色 string newRoleId = string.Empty; for (int i = 0; i < dm.Tables[0].Rows.Count; i++) { if (i == dm.Tables[0].Rows.Count - 1) { oldRoleId += dm.Tables[0].Rows[i]["Role_id"].ToString(); } else { oldRoleId += dm.Tables[0].Rows[i]["Role_id"].ToString() + ','; } } string artId = "a" + model.Id + ","; if (!string.IsNullOrEmpty(request["role_Id"].ToString())) { newRoleId = request["role_Id"].ToString(); newRoleId = newRoleId.Substring(0, newRoleId.Length - 1); _visit.UpdateN(oldRoleId, newRoleId, artId, factory_Id, model.Art_Menu_Id.Value, emp_id); } else { _visit.UpdateN(oldRoleId, "", artId, factory_Id, model.Art_Menu_Id.Value, emp_id); } log.Add_log(emp_id, empname, request.UserHostAddress, "访问权限修改", "访问权限修改", model.Id, "访问权限修改", oldRoleId, newRoleId, factory_Id); } else { //若所修改的文章原来没有分配角色,若传进来的role_Id不为空,则进行添加 if (!string.IsNullOrEmpty(request["role_Id"].ToString())) { string roleId = request["role_Id"].ToString(); roleId = roleId.Substring(0, roleId.Length - 1); string[] listRole = roleId.Split(','); foreach (var item in listRole) { DataSet df = _visit.GetList("Role_id='" + item + "'and Menu_ids='" + model.Art_Menu_Id + "' and Factory_Id='" + factory_Id + "'"); if (df != null && df.Tables[0].Rows.Count > 0) { //修改 int rId = Convert.ToInt32(df.Tables[0].Rows[0]["id"].ToString()); string art_id = df.Tables[0].Rows[0]["Art_id"].ToString(); art_id += "a" + model.Id + ","; _visit.Updates(rId, art_id); } else { //保存 XHD.Model.ssn_visit modelVisit = new XHD.Model.ssn_visit(); modelVisit.Factory_Id = factory_Id; modelVisit.Role_id = Convert.ToInt32(item); modelVisit.App_ids = "1"; modelVisit.Menu_ids = model.Art_Menu_Id.ToString(); modelVisit.Art_id = "a" + model.Id + ","; modelVisit.Create_id = emp_id; modelVisit.Create_date = DateTime.Now; _visit.Add(modelVisit); } } } } #endregion #region 日志 int UserID = emp_id; string UserName = empname; string IPStreet = request.UserHostAddress; string EventTitle = "ssn资料修改"; string EventType = "ssn资料修改"; int EventID = model.Id; if (dr["Art_title"].ToString() != request["T_title"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "资料名", dr["Art_title"].ToString(), request["T_title"].ToString(), factory_Id); } if (dr["Art_Content"].ToString() != request["T_content"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "内容", dr["Art_Content"].ToString(), model.Art_Content, factory_Id); } if (dr["image_lst"].ToString() != request["images"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "图片", dr["image_lst"].ToString(), request["images"].ToString(), factory_Id); } if (dr["Art_Menu_Id"].ToString() != request["art_Menu_Id"]) { log.Add_log(UserID, UserName, IPStreet, EventTitle, EventType, EventID, "页面Id", dr["Art_Menu_Id"].ToString(), request["art_Menu_Id"].ToString(), factory_Id); } #endregion context.Response.Write("2"); //修改成功 } else { context.Response.Write("3"); //修改失败 } } else { model.is_del = 0; model.Creater_Uid = uid; model.Creater_Name = empname; model.Create_Date = DateTime.Now; model.Creater_Id = emp_id; int artId = _art.Add(model); if (artId > 0) { #region 保存访问权限 if (!string.IsNullOrEmpty(request["role_Id"].ToString())) { string roleId = request["role_Id"].ToString(); roleId = roleId.Substring(0, roleId.Length - 1); string[] listRole = roleId.Split(','); foreach (var item in listRole) { //查询该角色是否已有分配的文章记录 DataSet df = _visit.GetList("Role_id='" + item + "'and Menu_ids='" + model.Art_Menu_Id + "' and Factory_Id='" + factory_Id + "'"); if (df != null && df.Tables[0].Rows.Count > 0) { //若已经记录,则修改 int rId = Convert.ToInt32(df.Tables[0].Rows[0]["id"].ToString()); string art_id = df.Tables[0].Rows[0]["Art_id"].ToString(); art_id += "a" + artId + ","; if (_visit.Updates(rId, art_id)) { context.Response.Write("1"); //保存成功 } else { _art.Delete(artId); context.Response.Write("0"); //保存失败 } } else { //若没有记录,则保存 XHD.Model.ssn_visit modelVisit = new XHD.Model.ssn_visit(); modelVisit.Factory_Id = factory_Id; modelVisit.Role_id = Convert.ToInt32(item); modelVisit.App_ids = "1"; modelVisit.Menu_ids = model.Art_Menu_Id.ToString(); modelVisit.Art_id = "a" + artId + ","; modelVisit.Create_id = emp_id; modelVisit.Create_date = DateTime.Now; if (_visit.Add(modelVisit)) { context.Response.Write("1"); //保存成功 } else { _art.Delete(artId); context.Response.Write("0"); //保存失败 } } } } else { context.Response.Write("1"); //保存成功 } #endregion } else { context.Response.Write("0"); //保存失败 } } } #endregion #region form else if (request["Action"] == "form") { string artId = PageValidate.InputText(request["nid"], 50); string dt; if (PageValidate.IsNumber(artId)) { DataSet ds = _art.GetList("Id=" + artId); dt = XHD.Common.DataToJson.DataToJSON(ds); } else { dt = "{}"; } context.Response.Write(dt); } #endregion #region 除del else if (request["Action"] == "del") { string artId = PageValidate.InputText(request["id"], 50); bool num = _art.Delete(Convert.ToInt32(artId)); if (num) { context.Response.Write("true"); } } #endregion #region 文章修改时获得查看权限 getRoleLiit else if (request["Action"] == "getRoleLiit") { string dt = string.Empty; string artId = PageValidate.InputText(request["nid"], 50); artId = "a" + artId; DataSet ds = _visit.GetList(" Factory_Id='" + factory_Id + "' and find_in_set('" + artId + "', Art_id)"); if (ds != null && ds.Tables[0].Rows.Count > 0) { dt = XHD.Common.GetGridJSON.DataTableToJSON1(ds.Tables[0], "Total"); } else { dt = "{'Rows':[{'id':-9999}],'Total':'Total'}"; } context.Response.Write(dt); } #endregion #region GetRole 获得所有角色 else if (request["Action"] == "GetRole") { string dt = string.Empty; DataSet ds = _role.GetList(" Factory_Id='" + factory_Id + "'"); if (ds != null && ds.Tables[0].Rows.Count > 0) { dt = XHD.Common.GetGridJSON.DataTableToJSON1(ds.Tables[0], "Total"); } else { dt = "{'Rows':[{'id':-9999}],'Total':'Total'}"; } context.Response.Write(dt); } #endregion #region 产文章图片 else if (request["Action"] == "album") { string photo = request["photo"]; //文件路径goods_gallery 商品相册表 string nowfileName1 = string.Empty; if (!string.IsNullOrEmpty(photo)) { photo = photo.Substring(photo.LastIndexOf('\\') + 1); string sExt1 = photo.Substring(photo.LastIndexOf(".")).ToLower(); DateTime now1 = DateTime.Now; nowfileName1 = XHD.Common.TimeParser.GenerateTimeStamp(DateTime.Now) + sExt1; } if (request.Files.Count > 0 && (!string.IsNullOrEmpty(photo))) { HttpPostedFile uploadFile = request.Files[0]; ////生成缩略图 //SmallImg(uploadFile.InputStream, uploadFile.FileName, context, nowfileName1); ////生成主图 //MainImg(uploadFile.InputStream, uploadFile.FileName, context, nowfileName1); uploadFile.SaveAs(context.Server.MapPath(@"~/file/ssn_artImg/" + nowfileName1)); } context.Response.Write("file/ssn_artImg/" + nowfileName1); } #endregion #region 移除图片 else if (request["Action"] == "remove") { string src = request["srcvalue"]; string file = System.Web.HttpContext.Current.Server.MapPath("../" + src); if (System.IO.File.Exists(file)) { File.Delete(file); } } #endregion #region 判断标题是否重复 else if (request["Action"] == "validate") { string title = request["T_title"]; string id = request["T_cid"]; string artMenu_Id = request["art_Menu_Id"]; if (string.IsNullOrEmpty(id) || id == "null") { id = "0"; } DataSet ds = _art.GetList("Art_title = '" + PageValidate.InputText(title, 255) + "' and Art_Menu_Id='" + artMenu_Id + "' and factory_Id='" + factory_Id + "' and Id!=" + int.Parse(id) + " and is_del=0"); if (ds.Tables[0].Rows.Count > 0) { context.Response.Write("false"); } else { context.Response.Write("true"); } } #endregion //#region 获取文章图片 //else if (request["Action"] == "formGallery") //{ // string goods_id = request["goods_id"]; // if (!string.IsNullOrEmpty(goods_id)) // { // DataSet ds = null; // if (request["type"] == "1") // ds = gallery.GetList(" goods_id='" + goods_id + "'"); // else if (request["type"] == "2") // ds = gallery.GetListCopy(" goods_id='" + goods_id + "'"); // string dt = Common.GetGridJSON.DataTableToJSON(ds.Tables[0]); // context.Response.Write(dt); // } //} //#endregion }