private void DefaultBuilder(string id) { #region Variable var strSQL = new StringBuilder(); var dt = new DataTable(); #endregion #region Procedure #region SQLQuery strSQL.Append("SELECT "); strSQL.Append("Name,Detail "); strSQL.Append("FROM "); strSQL.Append("Jobs "); strSQL.Append("WHERE "); strSQL.Append("UID="+id+";"); #endregion dt = clsSQL.Bind(strSQL.ToString(), dbType, cs); if (dt != null && dt.Rows.Count > 0) { lblName.Text = dt.Rows[0]["Name"].ToString(); lblDetail.Text = dt.Rows[0]["Detail"].ToString(); } else { clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); } #endregion }
private void DefaultBuilder(string id) { #region Variable var strSQL = new StringBuilder(); var dt = new DataTable(); #endregion #region Procedure #region SQLQuery strSQL.Append("SELECT "); strSQL.Append("Name,Detail "); strSQL.Append("FROM "); strSQL.Append("Jobs "); strSQL.Append("WHERE "); strSQL.Append("UID=" + id + ";"); #endregion dt = clsSQL.Bind(strSQL.ToString(), dbType, cs); if (dt != null && dt.Rows.Count > 0) { lblName.Text = dt.Rows[0]["Name"].ToString(); lblDetail.Text = dt.Rows[0]["Detail"].ToString(); } else { clsColorBox clsColorBox = new clsColorBox(); clsColorBox.Refresh(); } #endregion }
protected void btLogin_Click(object sender, EventArgs e) { #region Variable var clsSQL = new clsSQL(); var clsDefault = new clsDefault(); var clsColorBox = new clsColorBox(); #endregion #region Procedure if (clsSecurity.LoginChecker( clsSQL.CodeFilter(txtUsername.Text), clsSQL.CodeFilter(txtPassword.Text), cbEnableCookie.Checked)) { //ucColorBox.Redirect(Request.RawUrl, "เข้าสู่ระบบแล้ว"); Response.Redirect(Request.RawUrl); } else { var script = "document.getElementById('dvUCLogon').scrollIntoView(true);"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ucColorBoxScroller", script, true); ucColorBox.Alert("Login Alert", "ไม่พบข้อมูลที่คุณกรอก", AlertImage: global::ucColorBox.Alerts.Fail); lblLogin.Text = clsDefault.AlertMessageColor("ไม่พบข้อมูลที่คุณกรอก", clsDefault.AlertType.Warn); } #endregion }
protected void Page_Load(object sender, EventArgs e) { #region Variable Builder DateTime dttm = DateTime.Now; DayOfWeek = (int)dttm.DayOfWeek; for (int d = 0; d < 7; d++) { int dow = (int)dttm.AddDays(d).DayOfWeek; int day = dttm.AddDays(d).Day; Day[dow] = day.ToString(); } if (clsLanguage.LanguageCurrent == "th-TH") { SpecialtyText = "เชี่ยวชาญ"; DepartmentText = "ประจำ"; EducationText = "ประวัติการศึกษา"; DayText[0] = "อาทิตย์"; DayText[1] = "จันทร์"; DayText[2] = "อังคาร"; DayText[3] = "พุธ"; DayText[4] = "พฤหัส"; DayText[5] = "ศุกร์"; DayText[6] = "เสาร์"; } else { SpecialtyText = "Specialty"; DepartmentText = "Center"; EducationText = "Education"; DayText[0] = "Sunday"; DayText[1] = "Monday"; DayText[2] = "Tuesday"; DayText[3] = "Wednesday"; DayText[4] = "Thursday"; DayText[5] = "Friday"; DayText[6] = "Saturday"; } #endregion if (!IsPostBack) { if (Request.Browser.IsMobileDevice) { var clsColorBox = new clsColorBox(); clsColorBox.Show("/MobileApplication.aspx", width: "90%", height: "90%"); } DefaultBuilder(); BindSearch(); CarouselBuilder(); DoctorBuilder(); IntroPageBuilder(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDefault(); if (Request.QueryString["id"] != null) { var clsColorBox = new clsColorBox(); clsColorBox.Show("/Management/" + webManage + "?id=" + Request.QueryString["id"].ToString() + "&command=edit", iframe: 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); } }
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); } }
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); } }
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); } }