protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _userDAL.GetRole4UserMenu(_user.UserID, Convert.ToInt32(Request["Menu_ID"])); this.LinkCancel.Attributes.Add("onclick", "return ConfirmQuestion('Bạn có chắc muốn xóa?','ctl00_MainContent_grdListCate');"); if (Page.Request.Params["status"] != null) { if (CommonLib.IsNumeric(Page.Request.Params["status"].ToString())) { status = int.Parse(Page.Request.Params["status"].ToString()); } } if (Page.Request.Params["Tab"] != null) { if (CommonLib.IsNumeric(Page.Request.Params["Tab"].ToString())) { tab = int.Parse(Page.Request.Params["Tab"].ToString()); } } //LangID = PopulateItem(cat_id).Lang_ID; try { pageback = int.Parse(Session["PageFromID"].ToString()); } catch {; } if (!IsPostBack) { CheckPermission(); //if () //{ if (Request["BackID"] != null && Request["BackID"] != "") { int page_index = 0; try { page_index = int.Parse(Session["PageIndex_DetailCAT"].ToString()); } catch {; } pages.PageIndex = page_index; } LoadData(status); //} } } } }
public void ProcessRequest(HttpContext context) { HPCBusinessLogic.NguoidungDAL _userDAL = new NguoidungDAL(); SSOLib.ServiceAgent.T_Users _user = null; string prefixText = context.Request.QueryString["q"]; _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); string userid = _user.UserID.ToString();// HPCSecurity.CurrentUser.Identity.ID.ToString(); StringBuilder sb = new StringBuilder(); T_ButdanhDAL _DAL = new T_ButdanhDAL(); DataSet _ds; _ds = _DAL.Bin_T_ButdanhDynamic(userid, prefixText, false); if (_ds.Tables[0].Rows.Count > 0) { for (int _i = 0; _i < _ds.Tables[0].Rows.Count; _i++) { sb.Append(string.Format("{0}|{1}", _ds.Tables[0].Rows[_i]["BD_Name"].ToString(), _ds.Tables[0].Rows[_i]["BD_ID"].ToString())).Append(Environment.NewLine); } } else { sb.Append(string.Format("{0}|{1}", prefixText, "0")).Append(Environment.NewLine); } context.Response.Write(sb.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _NguoidungDAL.GetRole4UserMenu(_user.UserID, MenuID); btnUpload.Enabled = _Role.R_Write; btnDelete.Enabled = _Role.R_Delete; if (!IsPostBack) { if (Session["CurrentPage"] != null) { pageappro.PageIndex = int.Parse(Session["CurrentPage"].ToString()); LoadDataApprovied(); } else { LoadDataApprovied(); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _userDAL.GetRole4UserMenu(_user.UserID, Convert.ToInt32(Request["Menu_ID"])); if (!IsPostBack) { //HPCBusinessLogic.DAL.T_ThantoanTinbai obj = new HPCBusinessLogic.DAL.T_ThantoanTinbai(); //obj.GetLuongtoithieu(); //txt_luong.Text = obj.GetLuongtoithieu().ToString(); loadRole(); LoadCombox(); LoadTacgia(); type = int.Parse(cbo_types.SelectedValue); } } } }
protected void lb_Exit_Click(object sender, EventArgs e) { Session["capchaimgvna"] = null; string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { UltilFunc ulti = new UltilFunc(); string sqlupdate = " update T_TinBai set Nguoi_Khoa=0 where Nguoi_Khoa=" + user.UserID; ulti.ExecSql(sqlupdate); string sqlupdateT_news = " UPDATE T_News SET News_EditorID=0,News_Lock =0 WHERE News_EditorID=" + user.UserID; ulti.ExecSql(sqlupdateT_news); string sqlupdateUserLogin = "******" + user.UserName + "'"; ulti.ExecSql(sqlupdateUserLogin); } Session.RemoveAll(); Session.Clear(); Session.Abandon(); Page.Response.Cookies.Clear(); Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); FormsAuthentication.SignOut(); Page.Response.Cookies.Remove("hpcinfomation"); Page.Response.Cookies["hpcinfomation"].Expires = DateTime.Now.AddMilliseconds(-1); UltilFunc.Log_Action(user.UserID, user.UserFullName, DateTime.Now, 0, "Thoát khỏi hệ thống"); Page.Response.Redirect(Global.ApplicationPath + "/Login.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (!IsPostBack) { if (Session["CurrentPage"] != null) { pages.PageIndex = int.Parse(Session["CurrentPage"].ToString()); BindList_Layout(); } else { BindList_Layout(); } } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Expires = -1; try { string strParram = context.Request.QueryString["userid"] == null ? "" : context.Request.QueryString["userid"].ToString(); string[] parramList = strParram.Split(','); if (parramList[0].ToString() != "") { user = DAL.GetUserByUserName(parramList[0].ToString()); } if (parramList[1].ToString() != "") { _maquangcao = int.Parse(parramList[1].ToString()); } HttpPostedFile postedFile = context.Request.Files["Filedata"]; string tempPath = ""; tempPath = System.Configuration.ConfigurationManager.AppSettings["FolderQuangCao"] + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; string filename = postedFile.FileName; string[] sArrTenfile = null; char[] cat = { '.' }; sArrTenfile = filename.ToString().Trim().Split(cat); string _extenfile = GetDateTimeStringUnique() + "." + sArrTenfile[1].ToString(); string _tenfilegoc = UltilFunc.RemoveSign4VietnameseString(Path.GetFileNameWithoutExtension(filename)) + "." + _extenfile.ToString(); _tenfilegoc = _tenfilegoc.Replace(" ", ""); string _PathFileAtt = tempPath + _tenfilegoc; if (ImageExtention("." + _extenfile)) { // Upload FTP string ftpuser = ConfigurationManager.AppSettings["FTP_Username"].ToString(); string password = ConfigurationManager.AppSettings["FTP_Password"].ToString(); string ftpServer = ConfigurationManager.AppSettings["FTP_Server"].ToString(); FtpClient ftp = new FtpClient(ftpServer, ftpuser, password, ""); BinaryReader b = new BinaryReader(postedFile.InputStream); byte[] binData = b.ReadBytes(postedFile.ContentLength); ftp.UploadFile(binData, _PathFileAtt); //end T_FileQuangCao _obj = new T_FileQuangCao(); _obj = SetItem(_PathFileAtt, _tenfilegoc); _dalqc.Sp_InsertT_FileQuangCao(_obj); } } catch (Exception ex) { context.Response.Write("Error: " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (_user == null) { Response.Redirect(HPCComponents.Global.ApplicationPath + "/login.aspx", true); } else { this.txt_FromDate.Text = DateTime.Now.Date.AddDays(-7).ToString("dd/MM/yyyy"); this.txtToDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); } }
private T_Congviec SetItem(string noidung_, string sotu_, string ngayHT_, string nguoinhan_, string tieudecv) { HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); T_Congviec _obj = new T_Congviec(); _obj.Ma_Congviec = 0; _obj.Noidung_Congviec = UltilFunc.SqlFormatText(noidung_); _obj.Sotu = Convert.ToInt16(sotu_); _obj.NgayTao = DateTime.Now; _obj.NgayHoanthanh = UltilFunc.ToDate(ngayHT_, "dd/MM/yyyy"); _obj.NguoiNhan = Convert.ToDouble(nguoinhan_); _obj.Tencongviec = tieudecv; _obj.NguoiTao = _user.UserID; _obj.NguoiGiaoViec = _user.UserID; return(_obj); }
protected void Page_Load(object sender, EventArgs e) { strNumberArg = Request.QueryString["vType"].ToString(); if (Request.QueryString["vKey"] != null) { strKeyLogo = Request.QueryString["vKey"].ToString(); } user = DAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (user == null) { Show("Phiên làm việc hết hiệu lực !"); Response.Redirect(Global.ApplicationPath + "/login.aspx", true); } if (!this.IsPostBack) { ListImages(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (!IsPostBack) { DisplayData(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (!IsPostBack) { LoadCombox(); type = int.Parse(cbo_types.SelectedValue); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); ActiverPermission(); if (!IsPostBack) { LoadComboBox(); LoadData(this.txtPageIndex.Text.Trim()); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (UltilFunc.IsNumeric(Request["Menu_ID"])) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _userDAL.GetRole4UserMenu(_user.UserID, Convert.ToInt32(Request["Menu_ID"])); this.LinkCancel.Attributes.Add("onclick", "return ConfirmQuestion('" + CommonLib.ReadXML("lbBanmuonxoa") + "','ctl00_MainContent_grdListCate');"); if (Page.Request.Params["id"] != null) { if (CommonLib.IsNumeric(Page.Request.Params["id"].ToString())) { cat_id = int.Parse(Page.Request.Params["id"].ToString()); } } lblTenPhongsu.Text = PopulateItem(cat_id).Cat_Album_Name; LangID = PopulateItem(cat_id).Lang_ID; if (!IsPostBack) { if (CheckPermission(cat_id)) { if (Request["BackID"] != null && Request["BackID"] != "") { int page_index = 0; try { page_index = int.Parse(Session["PageIndex_DetailCAT"].ToString()); } catch {; } pages.PageIndex = page_index; } LoadData(cat_id); } } } } }
public DataTable GetRecords(string prefixText, string contextKey) { DataTable _dt = new DataTable(); HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); string _sql = string.Empty; _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); UltilFunc ulti = new UltilFunc(); if (int.Parse(contextKey) != 3) { _sql = "select top 20 Ma_Nguoidung, LTRIM(RTRIM(TenDaydu))+case when Loai=1 then ' -- (CTV)' when Loai=0 then '' end as Ten_Dangnhap from T_Nguoidung where (Trangthai_Xoa=0 or Trangthai_Xoa is null) and TenDaydu LIKE N'%" + prefixText.Trim() + "%' and Ten_Dangnhap is not null "; _dt = ulti.ExecSqlDataSet(_sql).Tables[0]; } else { string _where = " IsDeleted = 0 and UserFullName LIKE N'%" + prefixText.Trim() + "%'"; _dt = _NguoidungDAL.GetT_User_Dynamic(_where).Tables[0]; } return(_dt); }
protected void Page_Load(object sender, EventArgs e) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _userDAL.GetRole4UserMenu(_user.UserID, Convert.ToInt32(Request["Menu_ID"])); if (!IsPostBack) { int tab_id = 0; if (Request["Tab"] != null) { tab_id = Convert.ToInt32(Request["Tab"].ToString()); if (tab_id == 0) { this.TabContainer1.ActiveTabIndex = 0; this.TabContainer1_ActiveTabChanged(sender, e); } if (tab_id == 1) { this.TabContainer1.ActiveTabIndex = 1; this.TabContainer1_ActiveTabChanged(sender, e); } } else { this.TabContainer1.ActiveTabIndex = 0; this.TabContainer1_ActiveTabChanged(sender, e); } LoadComboBox(); } } } }
public string GetLatestNumberOfEmails() { T_Users _user = new T_Users(); HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); string doituong = string.Empty; try { _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); DataTable dt = new DataTable(); if (_user != null) { dt = HPCDataProvider.Instance().GetStoreDataSet("sp_gettotal_tinbai", new string[] { "@UserID" }, new object[] { _user.UserID }).Tables[0]; if (dt != null && dt.Rows.Count > 0) { doituong = dt.Rows[0]["Total"].ToString() + ';' + dt.Rows[0]["MenuLink"].ToString(); } } } catch { } return(doituong); }
protected void Page_Load(object sender, EventArgs e) { _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (_user != null) { if (!Page.IsPostBack) { int id = int.Parse(Page.Request.QueryString["ID"].ToString()); T_News obj = new T_News(); T_NewsDAL dal = new T_NewsDAL(); ChuyenmucDAL caDal = new ChuyenmucDAL(); obj = dal.load_T_news(id); if (obj.CAT_ID > 0) { this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.CAT_ID.ToString())).Ten_ChuyenMuc; } else { this.litCatName.Text = ""; } this.litDanNhap.Text = obj.News_Sub_Title.ToString(); this.litTittle.Text = obj.News_Tittle.ToString(); this.LitSummery.Text = CleanHTMLFont(CleanHTMLSummary(obj.News_Summary.ToString())); this.litContent.Text = CleanHTMLFont(obj.News_Body.ToString()); if (obj.News_Status == 6) { this.LitDatePublisher.Text = obj.News_DateEdit.ToString("dd/MM/yyyy HH:mm") + " (GMT + 7)"; } string count = this.litContent.Text; this.LitCount.Text = UltilFunc.WordCount(count) + " từ "; } } else { Response.Redirect("~/Errors/AccessDenied.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } this.litImageIcon.Text = "<img src=\" ../Dungchung/Images/Hethong.png \" style=\"border: 0px; height: 20px\">"; this.litTitleMenuName.Text = GetMenuName(Convert.ToInt32(Page.Request["Menu_ID"].ToString())); } } string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { Ma_QTBT = UltilFunc.GetColumnValuesOne("T_NguoidungQTBT", "Ma_QTBT", "Ma_Nguoidung=" + user.UserID); litMenu.Text = BindNavigation(Convert.ToInt32(user.UserID)); litUserName.Text = user.UserFullName; lb_Exit.Visible = true; } else { lb_Exit.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); if (_user != null) { if (!IsPostBack) { try { double _ID = 0; if (Request["id"] != null) { _ID = Convert.ToDouble(Request["id"]); } if (_ID > 0) { _obj = DAL.GetOneFromT_Photo_EventsByID(_ID); Image1.ImageUrl = ConfigurationManager.AppSettings["tinpathbdt"].ToString() + _obj.Photo_Medium; } } catch { } } } }
protected void Page_Load(object sender, EventArgs e) { #region --Show/hide language link if (!string.IsNullOrEmpty(Convert.ToString(Session["culture"]))) { _lang = Convert.ToString(Session["culture"]); if (_lang == "en") { lbtVietnam.Visible = true; lbtEnglish.Visible = false; lblXinChao = "Hello"; lblDoimatkhau = "Change password"; lb_Exit.Text = "[ Exit ]"; } else { lbtEnglish.Visible = true; lbtVietnam.Visible = false; lb_Exit.Text = "[Thoát hệ thống ]"; } } else { Session["culture"] = "vi"; lbtVietnam.Visible = false; lbtEnglish.Visible = true; lb_Exit.Text = "[Thoát hệ thống ]"; } #endregion -- if (!IsPostBack) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } this.litImageIcon.Text = "<img src=\" ../Dungchung/Images/Hethong.png \" style=\"border: 0px; height: 20px\">"; this.litTitleMenuName.Text = GetMenuName(Convert.ToInt32(Page.Request["Menu_ID"].ToString()), _lang); } } string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { Ma_QTBT = UltilFunc.GetColumnValuesOne("T_NguoidungQTBT", "Ma_QTBT", "Ma_Nguoidung=" + user.UserID); if (Ma_QTBT == 0) { FuncAlert.AlertJS(this, "Người dùng chưa được phân quyền vào quy trình biên tập!"); return; } litMenu.Text = BindNavigation(Convert.ToInt32(user.UserID)); litUserName.Text = user.UserFullName; lb_Exit.Visible = true; } else { lb_Exit.Visible = false; Page.Response.Redirect("~/login.aspx", true); } } }
protected void Save_Click() { int Menu_ID = 0; string NoiDung = string.Empty; string SoTu = string.Empty; string NgayHT = string.Empty; string NguoiNhan = string.Empty; string tieudecv = string.Empty; string ip = string.Empty; try { System.Globalization.CultureInfo mProvider = new System.Globalization.CultureInfo("en-US", false); if (mContext.Request.QueryString["mn_id"] != "undefined") { Menu_ID = int.Parse(mContext.Request.QueryString["mn_id"], mProvider); } if (mContext.Request.QueryString["nguoinhan"] != "undefined") { NguoiNhan = mContext.Request.QueryString["nguoinhan"].ToString(); } if (mContext.Request.QueryString["tieudecv"] != "undefined") { tieudecv = mContext.Request.QueryString["tieudecv"].ToString(); } if (mContext.Request.QueryString["noidung"] != "undefined") { NoiDung = mContext.Request.QueryString["noidung"].ToString(); } if (mContext.Request.QueryString["sotu"] != "undefined") { SoTu = mContext.Request.QueryString["sotu"].ToString(); } if (mContext.Request.QueryString["ngayht"] != "undefined") { NgayHT = mContext.Request.QueryString["ngayht"].ToString(); } if (mContext.Request.QueryString["ip"] != "undefined") { ip = mContext.Request.QueryString["ip"].ToString(); } HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _user; T_RolePermission _Role = null; _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _NguoidungDAL.GetRole4UserMenu(_user.UserID, Menu_ID); #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = ip; action.NgayThaotac = DateTime.Now; #endregion CongviecDAL _cvDAL = new CongviecDAL(); T_Congviec _cv = SetItem(NoiDung, SoTu, NgayHT, NguoiNhan, tieudecv); double _return = _cvDAL.InsertT_Congviec(_cv); action.Thaotac = "[Thêm mới công việc]-->[mã công việc:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); mContext.Response.Write("1"); } catch { mContext.Response.Write("0"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); try { string[] sArrProdID = null; char[] sep = { '?' }; string[] sArrVkey = null; string strUserID = ""; char[] sep2 = { ',' }; sArrProdID = context.Request.QueryString["user"].ToString().Trim().Split(sep); sArrVkey = sArrProdID[0].ToString().Trim().Split(sep2); user = DAL.GetUserByUserName(sArrVkey[0].ToString()); strUserID = user.UserID.ToString(); int _Trang = 0; double _Sobao = 0; int _Index = 0; if (sArrVkey[1].ToString() != "") { _Trang = int.Parse(sArrVkey[1].ToString()); } if (sArrVkey[2].ToString() != "") { _Sobao = double.Parse(sArrVkey[2].ToString()); } if (sArrVkey[3].ToString() != "") { _Index = int.Parse(sArrVkey[3].ToString()); } HttpPostedFile postedFile = context.Request.Files["Filedata"]; string tempPath = System.Configuration.ConfigurationManager.AppSettings["UploadPath"].ToString() + "PDF/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; //Create forder CreateFolderByUserName(tempPath); string savepath = context.Server.MapPath("/" + tempPath); string filename = postedFile.FileName; string[] sArrTenfile = null; char[] cat = { '.' }; sArrTenfile = filename.ToString().Trim().Split(cat); string _extenfile = GetDateTimeStringUnique() + "." + sArrTenfile[1].ToString(); string _tenfilegoc = UltilFunc.RemoveSign4VietnameseString(Path.GetFileNameWithoutExtension(filename)) + _extenfile; _tenfilegoc = _tenfilegoc.Replace(" ", ""); postedFile.SaveAs(savepath + @"\" + _tenfilegoc); int startchar = tempPath.Substring(1, tempPath.Length - 1).IndexOf("/"); startchar += 1; string _PathFile = tempPath.Substring(startchar, tempPath.Length - startchar); string _savePath = _PathFile + "" + _tenfilegoc; HPCBusinessLogic.DAL.TinBaiDAL _DAL = new HPCBusinessLogic.DAL.TinBaiDAL(); T_Publish_Pdf _obj = new T_Publish_Pdf(); _obj = SetItem(_savePath, _Trang, _Sobao, _Index); _DAL.InsertT_Publish_PDF(_obj); context.Response.Write(tempPath + "/" + _tenfilegoc); context.Response.StatusCode = 200; } catch (Exception ex) { context.Response.Write("Error: " + ex.Message); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); try { string[] sArrProdID = null; char[] sep = { '?' }; string[] sArrVkey = null; string strUserID = ""; char[] sep2 = { ',' }; sArrProdID = context.Request.QueryString["user"].ToString().Trim().Split(sep); sArrVkey = sArrProdID[0].ToString().Trim().Split(sep2); user = DAL.GetUserByUserName(sArrVkey[0].ToString()); strUserID = user.UserID.ToString(); int matinbai = 0; if (sArrVkey[1].ToString() != "") { matinbai = int.Parse(sArrVkey[1].ToString()); } HttpPostedFile postedFile = context.Request.Files["Filedata"]; string tempPath = System.Configuration.ConfigurationManager.AppSettings["UploadPath"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/"; //Create forder CreateFolderByUserName(tempPath); string savepath = context.Server.MapPath("/" + tempPath); string filename = postedFile.FileName; string[] sArrTenfile = null; char[] cat = { '.' }; sArrTenfile = filename.ToString().Trim().Split(cat); string _extenfile = GetDateTimeStringUnique() + "." + sArrTenfile[1].ToString(); string _tenfilegoc = UltilFunc.RemoveSign4VietnameseString(Path.GetFileNameWithoutExtension(filename)) + "." + _extenfile.ToString(); _tenfilegoc = _tenfilegoc.Replace(" ", ""); postedFile.SaveAs(savepath + @"\" + _tenfilegoc); int startchar = tempPath.Substring(1, tempPath.Length - 1).IndexOf("/"); startchar += 1; string _PathFile = tempPath.Substring(startchar, tempPath.Length - startchar); string _savePath = _PathFile + "" + _tenfilegoc; AnhDAL _DAL = new AnhDAL(); T_Anh _obj = new T_Anh(); _obj = SetItem(_savePath, _tenfilegoc, _tenfilegoc); int _MaAnhReturn = _DAL.InsertUpdateT_Anh(_obj); if (matinbai > 0 && _MaAnhReturn > 0) { TinBaiAnhDAL _daltinanh = new TinBaiAnhDAL(); T_Tinbai_Anh _objTA = new T_Tinbai_Anh(); _objTA.ID = 0; _objTA.Ma_Anh = _MaAnhReturn; _objTA.Ma_TinBai = matinbai; _objTA.ChuThich = ""; _daltinanh.InsertUpdateTin_Anh(_objTA); } context.Response.Write(tempPath + "/" + filename); context.Response.StatusCode = 200; } catch (Exception ex) { context.Response.Write("Error: " + ex.Message); } }