// event handler for the load event for the page protected void Page_Load(object sender, EventArgs e) { // clear any existing error messages lblError.Text = ""; // if this is the first time the page has been displayed if (IsPostBack == false) { // populate the list DisplayOrders(); } //on load get the current state from the session Sec = (clsSecurity)Session["Sec"]; //if the object is null then it needs initialising if (Sec == null) { //initialise the object Sec = new clsSecurity(); //update the session Session["Sec"] = Sec; } //set the state of the linsk based on the cureent state of authentication SetLinks(Sec.Authenticated); }
//clsOrderCollection OrderBook = new clsOrderCollection(); protected void Page_Load(object sender, EventArgs e) { //get the security data from the session Sec = (clsSecurity)Session["Sec"]; //if it is null then this is the first run of the site if (Sec == null) { //initialise the object Sec = new clsSecurity(); //save it to the session Session["Sec"] = Sec; } //create an object clsCustomer customer = new clsCustomer(); Boolean Found = false; //get customerNo by email Found = customer.GetCustomerNoByEmail(Sec.UserEMail); //Get CustomerNo CustomerNo = customer.CustomerNo; //Check if login if (CustomerNo == 0) { lblError.Text = "Please Sign-In first."; } else { DisplayAllOrders(CustomerNo); } }
//dateReviewed protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; //if the cart is null then we need to initialise it if (MyCart == null) { MyCart = new clsCart(); } txtEmail.Text = Sec.UserEMail; reviewId = Convert.ToString(Request.QueryString["reviewId"].Trim()); email = Convert.ToString(Request.QueryString["Email"].Trim()); description = Convert.ToString(Request.QueryString["Description"].Trim()); rating = Convert.ToString(Request.QueryString["Rating"].Trim()); productId = Convert.ToString(Request.QueryString["ProductId"].Trim()); dateReviewed = Convert.ToString(Request.QueryString["DateReviewed"].Trim()); lblReviewId.Text = reviewId; txtEmail.Text = email; txtDescription.Text = description.ToUpper(); txtRating.Text = Convert.ToString(rating); txtProductId.Text = Convert.ToString(productId); txtDateReviewed.Text = dateReviewed.ToUpper(); }
public SecurityController() { _clsSecurity = new clsSecurity(); _clsGlobal = new clsGlobal(); _clsCRM = new clsCRM(); _clsAsset = new clsAsset(); }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; //upon loading the page you need to read in the cart from the session object MyCart = (clsCart)Session["MyCart"]; //you also need to get the product id from the query string InventoryId = Convert.ToInt32(Request.QueryString["InventoryId"].Trim()); Name = Convert.ToString(Request.QueryString["Name"].Trim()); Price = Convert.ToDecimal(Request.QueryString["Price"].Trim()); Description = Convert.ToString(Request.QueryString["Description"].Trim()); active = Convert.ToBoolean(Request.QueryString["Active"].Trim()); txtName.Text = Convert.ToString(Name); txtPrice.Text = Convert.ToString(Price); txtDescription.Text = Convert.ToString(Description); if (active == true) { chkAge.Visible = true; Label5.Visible = true; } else { chkAge.Visible = false; Label5.Visible = false; } }
protected void btnSignUp_Click(object sender, EventArgs e) { //create a new instance of the security class clsSecurity Sec = new clsSecurity(); //var to store the data string Name = txtName.Text; string Phone = txtPhone.Text; string Email = txtEmail.Text; string Username = txtUsername.Text; string Password = txtPassword.Text; string PasswordConfirm = txtConfirm.Text; string PasswordType = txtPaymentType.Text; string SecurityMsg = txtSecurityMsg.Text; //validate the data lblError.Text = Sec.SignUp(Name, Phone, Email, Username, Password, PasswordConfirm, PasswordType, SecurityMsg); //if the username isnt taken //if there is no error if (lblError.Text == "") { //go to sign up success page Response.Redirect("HomePage.aspx"); } else { //show error lblError.Text = lblError.Text; } Session["Sec"] = Sec; }
protected void Page_Load(object sender, EventArgs e) { //if this is the first time the page is displayed if (IsPostBack == false) { //update the list box // lblError.Text = DisplayInventories("") + " records in the database"; } //on load get the current state from the session Sec = (clsSecurity)Session["Sec"]; //if the object is null then it needs initialising if (Sec == null) { //initialize the object Sec = new clsSecurity(); //update the session Session["Sec"] = Sec; } //set the state of the link based on the current state of authentication SetLinks(Sec.Authenticated); }
protected void btnSignUp_Click(object sender, EventArgs e) { //create a new instance of the security class clsSecurity Sec = new clsSecurity(); clsCustomer customer = new clsCustomer(); //try to sign up using the supplied credentials string Outcome = Sec.SignUp(txtEMail.Text, txtPassword1.Text, txtPassword2.Text, false); string Outcome1 = ""; //If the Valid result is OK if (Outcome == "An email has been sent to your account allowing you to activate the account") { //Valid the information for customer Outcome1 = customer.Valid(1, txtEMail.Text, txtFirstName.Text, txtLastName.Text, txtPostcode.Text, txtTelephone.Text, ddlTitle.SelectedValue); //If the Valid result is OK if (Outcome1 == "") { ////Get the AccountNo //int AccountNo = Sec.GetAccountNoByEmail(txtEMail.Text); //insert customer details and stroe the value for primary key int PrimaryKey = customer.Add(txtEMail.Text, txtFirstName.Text, txtLastName.Text, txtPostcode.Text, txtTelephone.Text, ddlTitle.SelectedValue); //put the value for primary key into tblAccount Sec.UpdateCustomerNo(txtEMail.Text, PrimaryKey); } } //report the outcome of the operation lblError.Text = Outcome + Outcome1; //store the object in the session objec for other pages to access Session["Sec"] = Sec; }
protected void Page_Load(object sender, EventArgs e) { //get the temp pw from the query string TempPW = Request.QueryString["TempPW"]; //get the email address from the query string EMail = Request.QueryString["EMail"]; //if the temp password isn't null if (TempPW != null) { //initialise the sceurity object Sec = new clsSecurity(); //hide the current password label and text box (this is a user who has forgotten their password) lblCurrentPassword.Visible = false; txtCurrentPassword.Visible = false; } else { //get the security state from the session Sec = (clsSecurity)Session["Sec"]; //if it isn't authenticated if (IsAuthenticated(Sec) == false) { //redirect back to the main page as the user hasn't got permission to use this page Response.Redirect("Default.aspx"); } } }
Boolean IsAuthenticated(clsSecurity Sec) { //tests to see if the current login is authenticated to use this page //var to store the state of authentication assume all is well i.e. true Boolean Auth = true; //if the security object is not null if (Sec != null) { //if the user isn't authenticated if (Sec.Authenticated == false) { //set state to false Auth = false; } } else { //else set authenticated to false Auth = false; } //return the authentication state return(Auth); }
//variables to store the values of the fields being passed from the FindCustomer page protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; SellerShopLineID = Convert.ToInt32(Request.QueryString["SellerShopLineId"].Trim()); productName = Convert.ToString(Request.QueryString["ProductName"].Trim()); lblProductName.Text = Convert.ToString(productName); lblProductId.Text = Convert.ToString(mSellerShopLineId); }
//variables to store the values of the fields being passed from the FindCustomer page protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; ShopID = Convert.ToInt32(Request.QueryString["ShopId"].Trim()); shopName = Convert.ToString(Request.QueryString["ShopName"].Trim()); lblShopName.Text = Convert.ToString(shopName); lblShopId.Text = Convert.ToString(mShopId); }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; MyCartList = (clsCartItem)Session["MyCartList"]; txtOrderTotal.Text = Session["Ordertotal"].ToString(); MyCart.Email = Sec.UserEMail; txtEmail.Text = Sec.UserEMail; txtDatePurchased.Text = DateTime.Now.Date.ToString("dd/MM/yyyy"); }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; InventoryId = Convert.ToInt32(Request.QueryString["InventoryId"].Trim()); txtProductId.Text = InventoryId.ToString(); txtEmail.Text = Sec.UserEMail; txtDateReviewed.Text = DateTime.Now.Date.ToString("dd/MM/yyyy"); }
protected void btnReSet_Click(object sender, EventArgs e) { //create an instance of the security class clsSecurity Sec = new clsSecurity(); //initiate the password re-set process string Outcome = Sec.ReSet(txtEMail.Text); //update the session variable Session["Sec"] = Sec; //display the outcome of the operation lblError.Text = Outcome; }
protected void btnSignUp_Click(object sender, EventArgs e) { //create a new instance of the security class clsSecurity Sec = new clsSecurity(); //try to sign up using the supplied credentials string Outcome = Sec.SignUp(txtEMail.Text, txtPassword1.Text, txtPassword2.Text, false); //report the outcome of the operation lblError.Text = Outcome; //store the object in the session objec for other pages to access Session["Sec"] = Sec; }
protected void Page_Load(object sender, EventArgs e) { //get the email from the query string string EMail = Request.QueryString["EMail"]; //get the temp password from the query string string TempPW = Request.QueryString["TempPW"]; //create an instance of the security class clsSecurity Sec = new clsSecurity(); //activate the account lblError.Text = Sec.ActivateAccount(EMail, TempPW); }
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e) { //display the change password form frmChangePassword Change = new frmChangePassword(); //set the mode using a specific user Change.SetMode(Sec, Sec.UserEMail); //show the form as a dialogue Change.ShowDialog(); //get the state of the scurity once done Sec = Change.Sec; }
private void btnAdd_Click(object sender, EventArgs e) { //create an instance of the security class clsSecurity Sec = new clsSecurity(); //get the new users details string EMail = txtEMail.Text; string Password1 = txtEMail.Text; string Password2 = txtPassword2.Text; //try to sign up the new user lblError.Text = Sec.SignUp(EMail, Password1, Password2, true); }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; //if the cart is null then we need to initialise it if (MyCart == null) { MyCart = new clsCart(); } txtEmail.Text = Sec.UserEMail; }
private void reSetPasswordToolStripMenuItem_Click(object sender, EventArgs e) { //resets the password //create a instance of the chnage passord form frmChangePassword Change = new frmChangePassword(); //set the mode to change any user password (admin only) Change.SetMode(Sec, ""); //show the form as a dialogue Change.ShowDialog(); //get the new security state Sec = Change.Sec; }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; //if the cart is null then we need to initialise it if (MyCart == null) { MyCart = new clsCart(); } txtEmail.Text = Sec.UserEMail; txtDateReviewed.Text = DateTime.Now.Date.ToString("dd/MM/yyyy"); }
protected void Page_Load(object sender, EventArgs e) { //get the security data from the session Sec = (clsSecurity)Session["Sec"]; //if it is null then this is the first run of the site if (Sec == null) { //initialise the object Sec = new clsSecurity(); //save it to the session Session["Sec"] = Sec; } }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; Int32 Index; //upon loading the page you need to read in the cart from the session object MyCart = (clsCart)Session["MyCart"]; //get the index of the item to remove Index = Convert.ToInt32(Request.QueryString["Index"]); //remove the item in the query string MyCart.Products.RemoveAt(Index); //go back to view cart Response.Redirect("ViewCart.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { clsSecurity clsSecurity = new clsSecurity(); if (clsSecurity.LoginGroup.ToLower() != "admin" && clsSecurity.LoginGroup.ToLower() != "hr") { ucColorBox1.Redirect("/", "กรุณาล็อคอินก่อน", PreloaderImage: ucColorBox.Preloaders.Recycle); } MenuBuilder(); } }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; //upon loading the page you need to read in the cart from the session object MyCart = (clsCart)Session["MyCart"]; //if the cart is null then we need to initialise it if (MyCart == null) { MyCart = new clsCart(); } //then you can display how many items are in your cart userEmail = Convert.ToString(Request.QueryString["Email"]); }
protected void Page_Load(object sender, EventArgs e) { //get the security data from the session Sec = (clsSecurity)Session["Sec"]; //if it is null then this is the first run of the site if (Sec == null) { //initialise the object Sec = new clsSecurity(); //save it to the session Session["Sec"] = Sec; } lblComfirmText.Text = "Are you sure you want to cancel the order?"; }
protected void Page_Load(object sender, EventArgs e) { //on load get the current state from the session Sec = (clsSecurity)Session["Sec"]; //if the object is null then it needs initialising if (Sec == null) { //initialise the object Sec = new clsSecurity(); //update the session Session["Sec"] = Sec; } //set the state of the linsk based on the cureent state of authentication SetLinks(Sec.Authenticated); }
protected void Page_Load(object sender, EventArgs e) { //get the security data from the session Sec = (clsSecurity)Session["Sec"]; //if it is null then this is the first run of the site if (Sec == null) { //initialise the object Sec = new clsSecurity(); //save it to the session Session["Sec"] = Sec; } lblResultOfQuote.Text = "Congratulations, order was created. Our staff will collect your package next working day with invoice."; }
protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; SellerShopLineID = Convert.ToInt32(Request.QueryString["SellerShopLineId"].Trim()); productName = Convert.ToString(Request.QueryString["ProductName"].Trim()); email = Convert.ToString(Request.QueryString["Email"].Trim()); description = Convert.ToString(Request.QueryString["Description"].Trim()); quantity = Convert.ToString(Request.QueryString["Quantity"].Trim()); price = Convert.ToString(Request.QueryString["Price"].Trim()); txtEmail.Text = email.ToString(); txtProductName.Text = productName.ToString(); txtPrice.Text = price.ToString(); }
private void setDefault() { #region Variable var clsSQL = new clsSQL(); #endregion #region Procedure lblHeader.Text = clsGlobal.ApplicationName+" v."+clsGlobal.ApplicationVersion; lblSubHeader.Text = "ศูนย์รวมบริหารและจัดการเซิฟเวอร์สำหรับรีโมท"; lblFooterDetail.Text = string.Format("Server : {0}", clsSQL.getAppSettingServerName(clsGlobal.cs)); ttDefault.SetToolTip(btMinimize, "ย่อหน้าต่าง"); ttDefault.SetToolTip(btClose, "ออกจากโปรแกรม"); ttDefault.SetToolTip(btMove, "ย้ายตำแหน่งหน้าต่าง"); ttDefault.SetToolTip(btReport, "ดูรายงาน"); if (!getAdminChecker()) btReport.Visible = false; txtUsername.Text = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName+@"\"+clsGlobal.WindowsLogonBuilder(); var savePassword = System.Configuration.ConfigurationManager.AppSettings["savePassword"]; if (savePassword.Trim() != "") { var clsSecurity = new clsSecurity(); txtPassword.Text = clsSecurity.Decrypt(savePassword); } if (clsGlobal.ServerMode) { try { txtUsername.Enabled = false; txtPassword.Enabled = false; lvServerList.Visible = false; tbContent.RowStyles[1].Height = 0; tmDefault.Enabled = true; tmDefault.Start(); } catch(Exception ex) { try { wsDefault.ServiceSoapClient wsDefault = new wsDefault.ServiceSoapClient(); wsDefault.MailSend(System.Configuration.ConfigurationManager.AppSettings["mailTo"], clsGlobal.ApplicationName, "<h2>" + clsGlobal.IPAddress() + "</h2>" + ex.Message, "*****@*****.**", System.Configuration.ConfigurationManager.AppSettings["siteCode"] + " : " + clsGlobal.ApplicationName, "", "", "", false); } catch (Exception) { } } } else { lvSession.Visible = false; tbContent.RowStyles[0].Height = 0; tmClient.Enabled = true; tmClient.Start(); } #endregion }
private void setSavePassword() { if (txtPassword.Text.Trim() != "") { var clsData = new clsDataNative(); var clsSecurity = new clsSecurity(); clsData.AppConfigUpdater("savePassword", clsSecurity.Encrypt(txtPassword.Text.Trim())); } }
protected void btSave_Click(object sender, EventArgs e) { clsSecurity security = new clsSecurity(); clsIO IO = new clsIO(); string strDetailSub = string.Empty; string strDetail = txtDetail.Text.Replace("<p>", ""); strDetail = strDetail.Replace("</p>", ""); string PicFull = "null"; string PicThumb = "null"; string pathPhoto = "/Images/Article/"; string pathImages = @"\Images\Article\"; string outError; //upload Photo to server if (txtImanges.HasFile) { //Full Images if (IO.UploadPhoto(txtImanges, pathPhoto, "f_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 5120, 0, 0, "", 0, out outError, out PicFull) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicFull = pathImages + "" + PicFull; } //Thumb Images if (IO.UploadPhoto(txtImanges, pathPhoto, "t_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 1024, 100, 100, "", 0, out outError, out PicThumb) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicThumb = pathImages + "" + PicThumb; } } else { PicFull = lblImagesFull.Text.Trim(); PicThumb = lblImagesThumb.Text.Trim(); } //insert data to database try { if (txtDetail.Text.Length >= 200) { strDetailSub = "<p>" + strDetail.Substring(0, 200) + ".....</p>"; } else { strDetailSub = "<p>" + strDetail + ".....</p>"; } //Insert new Article if (string.IsNullOrEmpty(lblUID.Text) == true) { Article tbarticle = new Article(); //Assign values for insert into database tbarticle.Subject = txtSubject.Text.Trim(); tbarticle.Detail = txtDetail.Text; tbarticle.PicFull = PicFull; tbarticle.PicThumbnail = PicThumb; tbarticle.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); tbarticle.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); tbarticle.Remark = txtRemark.Text.Trim(); tbarticle.CWhen = DateTime.Now; tbarticle.CUser = Convert.ToInt32(security.LoginUID); tbarticle.MWhen = DateTime.Now; tbarticle.MUser = Convert.ToInt32(security.LoginUID); tbarticle.StatusFlag = rdbActive.Checked == true ? "A" : "D"; tbarticle.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); tbarticle.DetailSub = strDetailSub; tbarticle.NumberDislike = 0; tbarticle.NumberLike = 0; tbarticle.NumberView = 0; tbarticle.Score = 0; tbarticle.SampleSize = 0; tbarticle.MetaKeywords = txtMetaKeywords.Text.Trim(); tbarticle.MetaDescription = txtMetaDescription.Text.Trim(); //Insert data of Event to database db.Articles.InsertOnSubmit(tbarticle); } else //Update existing Event { var tbarticle = from a in db.Articles where a.UID == Convert.ToInt32(lblUID.Text.Trim()) select a; foreach (Article a in tbarticle) { a.Subject = txtSubject.Text.Trim(); a.Detail = txtDetail.Text; a.PicFull = PicFull; a.PicThumbnail = PicThumb; a.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); a.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); a.Remark = txtRemark.Text.Trim(); a.MWhen = DateTime.Now; a.MUser = Convert.ToInt32(security.LoginUID); a.StatusFlag = rdbActive.Checked == true ? "A" : "D"; a.MetaKeywords = txtMetaKeywords.Text.Trim(); a.MetaDescription = txtMetaDescription.Text.Trim(); try { a.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); } catch (Exception ex) { ex.ToString(); } a.DetailSub = strDetailSub; } } db.SubmitChanges(); clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "closeWindow", "<script language='javascript'>parent.$.colorbox.close();</script>"); } catch (Exception ex) { clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + ex.ToString() + "')", true); } }
private void MenuBuilder() { ucMenuMega.Item item = new ucMenuMega.Item(); clsSecurity clsSecurity = new clsSecurity(); item = new ucMenuMega.Item(); item.UID = 1; //item.ParentUID = 1; item.Name = "จัดการข้อมูลเว็บไซต์"; item.Detail = ""; item.URL = ""; ucMenuMega1.Items.Add(item); item = new ucMenuMega.Item(); item.UID = 27; item.ParentUID = 1; item.Name = "IntroPage Manage"; item.Detail = ""; item.URL = "IntroPage.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } /* item = new ucMenuMega.Item(); item.UID = 11; item.ParentUID = 1; item.Name = "Template Manage"; item.Detail = ""; item.URL = "Template.aspx"; ucMenuMega1.Items.Add(item); */ item = new ucMenuMega.Item(); item.UID = 12; item.ParentUID = 1; item.Name = "Content Manage"; item.Detail = ""; item.URL = "Content.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 13; item.ParentUID = 1; item.Name = "Medical Center Manage"; item.Detail = ""; item.URL = "MedicalCenterGroup.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 14; item.ParentUID = 1; item.Name = "Service Manage"; item.Detail = ""; item.URL = "ServiceGroup.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 15; item.ParentUID = 1; item.Name = "Slider Manage"; item.Detail = ""; item.URL = "Slider.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 26; item.ParentUID = 1; item.Name = "Highlight Manage"; item.Detail = ""; item.URL = "Highlight.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 16; item.ParentUID = 1; item.Name = "E-Mail Template"; item.Detail = ""; item.URL = "EmailTemplate.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 17; item.ParentUID = 1; item.Name = "E-Mail Manage"; item.Detail = ""; item.URL = "EmailList.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 2; //item.ParentUID = 1; item.Name = "จัดการข้อมูลการติดต่อกับลูกค้า"; item.Detail = ""; item.URL = ""; ucMenuMega1.Items.Add(item); item = new ucMenuMega.Item(); item.UID = 21; item.ParentUID = 2; item.Name = "User Manage"; item.Detail = ""; item.URL = "User.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 22; item.ParentUID = 2; item.Name = "Inquire Manage"; item.Detail = ""; item.URL = "Inquiry.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 23; item.ParentUID = 2; item.Name = "Doctor Appointment Manage"; item.Detail = ""; item.URL = "DoctorAppointment.aspx"; if (clsSecurity.LoginChecker("admin")) { ucMenuMega1.Items.Add(item); } item = new ucMenuMega.Item(); item.UID = 24; item.ParentUID = 2; item.Name = "Jobs Manage"; item.Detail = ""; item.URL = "Jobs.aspx"; ucMenuMega1.Items.Add(item); item = new ucMenuMega.Item(); item.UID = 25; item.ParentUID = 2; item.Name = "Jobs History Manage"; item.Detail = ""; item.URL = "JobsHistory.aspx"; ucMenuMega1.Items.Add(item); }
/// <summary> /// บันทึก Log การส่งอีเมล์จากระบบ Template /// </summary> /// <param name="UID">EmailTemplateUID</param> /// <param name="From">จากเมล์</param> /// <param name="To">ถึงเมล์</param> /// <param name="Cc">แนบเมล์</param> /// <param name="Bcc">ไม่เปิดเผยเมล์</param> /// <param name="Result">ผลการส่ง</param> /// <returns>true=บันทึกสำเร็จ , false=บันทึกไม่สำเร็จ</returns> private bool SendTemplateLog(string UID, string From, string To, string Cc, string Bcc, string Result) { #region Variable bool rtnValue = false; clsSQL clsSQL = new clsSQL(); clsSecurity clsSecurity=new clsSecurity(); clsNet clsNet = new clsNet(); string outSQL; #endregion #region SQL Query if(clsSQL.Insert( "EmailTemplateLog", new string[,]{ {"UID",clsSQL.GetNewID("UID","EmailTemplateLog","",dbType,cs).ToString()}, {"EmailTemplateUID",UID}, {"EmailFrom","'"+clsSQL.CodeFilter(From)+"'"}, {"EmailTo","'"+clsSQL.CodeFilter(To)+"'"}, {"EmailCc","'"+clsSQL.CodeFilter(Cc)+"'"}, {"EmailBcc","'"+clsSQL.CodeFilter(Bcc)+"'"}, {"Result","'"+clsSQL.CodeFilter(Result)+"'"}, {"CWhen","GETDATE()"}, {"CUser","0"}, {"CIP","'"+clsNet.IPGet()+"'"}, {"CHostname","'"+clsNet.ComNameGet()+"'"}}, new string[,]{{}}, dbType, cs, out outSQL)) { rtnValue = true; } #endregion return rtnValue; }
private void ContentBuilder() { #region Variable StringBuilder strSQL = new StringBuilder(); StringBuilder strScript = new StringBuilder(); DataTable dt = new DataTable(); bool foundChecker = false; int dtIndex=0; clsSQL clsSQL = new clsSQL(); clsLanguage clsLanguage = new clsLanguage(); clsSecurity clsSecurity = new clsSecurity(); #endregion #region SQL Query strSQL.Append("SELECT "); strSQL.Append("Language.UID LanguageUID,"); strSQL.Append("Language.Name LanguageName,"); strSQL.Append("Content.UID,"); strSQL.Append("Content.Name,"); strSQL.Append("Content.Detail,"); strSQL.Append("Content.Content "); strSQL.Append("FROM "); strSQL.Append("Content "); strSQL.Append("INNER JOIN Language ON Content.LanguageUID=Language.UID "); strSQL.Append("AND Language.Active='1' "); strSQL.Append("WHERE "); strSQL.Append("Content.Active='1' "); strSQL.Append("AND Content.Name='"+_contentName.Trim()+"' "); strSQL.Append("ORDER BY "); strSQL.Append("Language.Sort ASC"); #endregion dt = clsSQL.Bind(strSQL.ToString(), dbType, cs); if (dt != null && dt.Rows.Count > 0) { strScript.Append("<div class='" + (clsSecurity.LoginChecker("Admin") ? "dvContent" : "dvContentNormal") + "'>"); #region Find Language for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["LanguageName"].ToString() == clsLanguage.LanguageCurrent) { foundChecker = true; dtIndex=i; #region Content Builder if (dt.Rows[i]["Content"] != DBNull.Value) { strScript.Append(dt.Rows[i]["Content"].ToString()); } #endregion break; } } #endregion #region Default Builder if (!foundChecker) { if (dt.Rows[0]["Content"] != DBNull.Value) { strScript.Append(dt.Rows[0]["Content"].ToString()); } } #endregion #region Admin Builder if (clsSecurity.LoginChecker("Admin")) { strScript.Append("<div class='dvContentMenu'>"); strScript.Append("<a href='/Management/ContentManage.aspx?id="+dt.Rows[dtIndex]["UID"].ToString()+"&command=edit' "); strScript.Append("title='แก้ไขข้อมูล' "); if (_modalRefreshOnClose) { strScript.Append("class='cbIFrameRefreshOnClose'"); } else { strScript.Append("class='cbIFrame'"); } strScript.Append(">"); strScript.Append("<span class='Icon16 Edit' />"); strScript.Append("</a>"); strScript.Append("</div>"); } #endregion strScript.Append("</div>"); lblContent.Text = strScript.ToString(); } }
protected void btSave_Click(object sender, EventArgs e) { clsSecurity security = new clsSecurity(); clsIO IO = new clsIO(); string strDetailSub = string.Empty; string strDetail = txtDetail.Text.Replace("<p>", ""); strDetail = strDetail.Replace("</p>", ""); string PicFull = "null"; string PicThumb = "null"; string pathPhoto = "/Images/Package/"; string pathImages = @"\Images\Package\"; string outError; //upload Photo to server if (txtImgFull.HasFile) { //Full Images if (IO.UploadPhoto(txtImgFull, pathPhoto, "f_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 4096, 0, 0, "", 0, out outError, out PicFull) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicFull = pathImages + "" + PicFull; } } else { PicFull = lblImagesFull.Text.Trim(); } if (txtImgThum.HasFile) { //Thumb Images if (IO.UploadPhoto(txtImgThum, pathPhoto, "t_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 2048, 0, 0, "", 0, out outError, out PicThumb) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicThumb = pathImages + "" + PicThumb; } } else { PicThumb = lblImagesThumb.Text.Trim(); } //insert data to database try { if (txtDetail.Text.Length >= 200) { strDetailSub = "<p>" + strDetail.Substring(0, 200) + ".....</p>"; } else { strDetailSub = "<p>" + strDetail + ".....</p>"; } //Insert new Package if (string.IsNullOrEmpty(lblUID.Text) == true) { Package tbpackage = new Package(); //Assign values for insert into database tbpackage.PackageName = txtSubject.Text.Trim(); tbpackage.Detail = txtDetail.Text; tbpackage.PicFull = PicFull; tbpackage.PicThumbnail = PicThumb; tbpackage.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); if (!string.IsNullOrEmpty(txtDateTo.Text)) { tbpackage.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); } else { tbpackage.ActiveDateTo = null; } tbpackage.Remark = txtRemark.Text.Trim(); tbpackage.CWhen = DateTime.Now; tbpackage.CUser = Convert.ToInt32(security.LoginUID); tbpackage.MWhen = DateTime.Now; tbpackage.MUser = Convert.ToInt32(security.LoginUID); tbpackage.StatusFlag = rdbActive.Checked == true ? "A" : "D"; tbpackage.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); tbpackage.DepartmentUID = Convert.ToInt32(ddlDepartment.SelectedValue); tbpackage.DetailSub = strDetailSub; tbpackage.MetaKeywords = txtMetaKeywords.Text.Trim(); tbpackage.MetaDescription = txtMetaDescription.Text.Trim(); tbpackage.PackageCode = txtPackagecode.Text.Trim(); if (!string.IsNullOrEmpty(txtUnitPrice.Text)) { tbpackage.UnitPrice = Convert.ToDouble(txtUnitPrice.Text.Trim()); } else { tbpackage.UnitPrice = 0; } //Insert data of Event to database db.Packages.InsertOnSubmit(tbpackage); } else //Update existing Event { var tbpackage = from p in db.Packages where p.UID == Convert.ToInt32(lblUID.Text.Trim()) select p; foreach (Package p in tbpackage) { p.PackageName = txtSubject.Text.Trim(); p.Detail = txtDetail.Text; p.PicFull = PicFull; p.PicThumbnail = PicThumb; p.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); if (!string.IsNullOrEmpty(txtDateTo.Text)) { p.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); } else { p.ActiveDateTo = null; } p.Remark = txtRemark.Text.Trim(); p.MWhen = DateTime.Now; p.MUser = Convert.ToInt32(security.LoginUID); p.StatusFlag = rdbActive.Checked == true ? "A" : "D"; try { p.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); p.DepartmentUID = Convert.ToInt32(ddlDepartment.SelectedValue); } catch (Exception ex) { ex.ToString(); } p.DetailSub = strDetailSub; p.MetaKeywords = txtMetaKeywords.Text.Trim(); p.MetaDescription = txtMetaDescription.Text.Trim(); p.PackageCode = txtPackagecode.Text.Trim(); if (!string.IsNullOrEmpty(txtUnitPrice.Text)) { p.UnitPrice = Convert.ToDouble(txtUnitPrice.Text.Trim()); } else { p.UnitPrice = 0; } } } db.SubmitChanges(); clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "closeWindow", "<script language='javascript'>parent.$.colorbox.close();</script>"); } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + ex.ToString() + "')", true); } }
protected void btSave_Click(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); clsSecurity security = new clsSecurity(); clsIO IO = new clsIO(); string strDetailSub = string.Empty; string strDetail = txtDetail.Text.Replace("<p>", ""); strDetail = strDetail.Replace("</p>", ""); string PicFull = "null"; string PicThumb = "null"; string pathPhoto = "/Images/Event/"; string pathImages = @"\Images\Event\"; string outError; //upload Photo to server if(txtImgFull.HasFile) { //Full Images if (IO.UploadPhoto(txtImgFull, pathPhoto, "f_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 5120, 0, 0, "", 0, out outError, out PicFull) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicFull = pathImages + "" + PicFull; } } else { PicFull = lblImagesFull.Text.Trim(); } if (txtImgThum.HasFile) { //Thumb Images if (IO.UploadPhoto(txtImgThum, pathPhoto, "t_pic" + DateTime.Now.ToString("yyyyMMddHHmmss"), 2048, 0, 0, "", 0, out outError, out PicThumb) == false) { ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + outError.ToString() + "')", true); return; } else { PicThumb = pathImages + "" + PicThumb; } } else { PicThumb = lblImagesThumb.Text.Trim(); } //insert data to database try { if (txtDetail.Text.Length >= 200) { strDetailSub = "<p>" + strDetail.Substring(0, 200) + ".....</p>"; } else { strDetailSub = "<p>" + strDetail + ".....</p>"; } //Insert new Event if (string.IsNullOrEmpty(lblUID.Text) == true) { Event tbevent = new Event(); //Assign values for insert into database tbevent.Subject = txtSubject.Text.Trim(); tbevent.Detail = txtDetail.Text; tbevent.PicFull = PicFull; tbevent.PicThumbnail = PicThumb; tbevent.DepartmentUID = 1; tbevent.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); tbevent.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); tbevent.Remark = txtRemark.Text.Trim(); tbevent.CWhen = DateTime.Now; tbevent.CUser = Convert.ToInt32(security.LoginUID); tbevent.MWhen = DateTime.Now; tbevent.MUser = Convert.ToInt32(security.LoginUID); tbevent.StatusFlag = rdbActive.Checked == true ? "A" : "D"; tbevent.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); tbevent.DetailSub = strDetailSub; tbevent.MetaKeywords = txtMetaKeywords.Text.Trim(); tbevent.MetaDescription = txtMetaDescription.Text.Trim(); //Insert data of Event to database db.Events.InsertOnSubmit(tbevent); } else //Update existing Event { var tbEvent = from ev in db.Events where ev.UID == Convert.ToInt32(lblUID.Text.Trim()) select ev; foreach (Event ev in tbEvent) { ev.Subject = txtSubject.Text.Trim(); ev.Detail = txtDetail.Text; ev.PicFull = PicFull; ev.PicThumbnail = PicThumb; ev.DepartmentUID = 1; ev.ActiveDateFrom = Convert.ToDateTime(txtDateFrom.Text); ev.ActiveDateTo = Convert.ToDateTime(txtDateTo.Text); ev.Remark = txtRemark.Text.Trim(); ev.MWhen = DateTime.Now; ev.MUser = Convert.ToInt32(security.LoginUID); ev.StatusFlag = rdbActive.Checked == true ? "A" : "D"; ev.MetaKeywords = txtMetaKeywords.Text.Trim(); ev.MetaDescription = txtMetaDescription.Text.Trim(); try { ev.LanguageUID = Convert.ToInt32(ddlLanguage.SelectedValue); } catch(Exception ex) { ex.ToString(); } ev.DetailSub = strDetailSub; } } db.SubmitChanges(); clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "closeWindow", "<script language='javascript'>parent.$.colorbox.close();</script>"); } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + ex.ToString() + "')", true); } }