protected void gvData_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { TextBox txtOldnoQty = (TextBox)gvData.Rows[e.RowIndex].FindControl("txtOldNoQty"); TextBox txtNewnoQty = (TextBox)gvData.Rows[e.RowIndex].FindControl("txtNewNoQty"); int rtn = 0; if (txtNewnoQty.Text != "" && txtOldnoQty.Text != "") { //int.Parse(Request["id"]) rtn = PH_RateCalc.PH_RateCaclAdj_TransportInsert(AppCode.strConnDB, gvData.DataKeys[e.RowIndex].Value.ToString(), int.Parse(Request["id"]), int.Parse(txtOldnoQty.Text)); if (rtn > 0) { rtn = PH_RateCalc.PH_RateCaclAdj_TransportInsert(AppCode.strConnDB, gvData.DataKeys[e.RowIndex].Value.ToString(), int.Parse(Request["id"]), int.Parse(txtNewnoQty.Text)); } } string message = rtn > 0 ? "Save Data Successfull" : "Save Data Not Successfull"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertmsg", "alert('" + message + "');", true); gvData.EditIndex = -1; DataBindTrans(true); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
private void DataBindDDl() { try { DataSet ds = PH_RateCalc.PH_RateCalc_DateWeekSelAll(AppCode.strConnDB); ddlDateWeek.DataTextField = "dateweek"; ddlDateWeek.DataValueField = "dateweek"; ddlDateWeek.DataSource = ds; ddlDateWeek.DataBind(); /*DataTable dt = PH_UserVendor.PH_UserVendor_SelectAll(AppCode.strConnDB); * ddlVendorCode.DataTextField = "vendor_code"; * ddlVendorCode.DataValueField = "vendor_code"; * ddlVendorCode.DataSource = dt; * ddlVendorCode.DataBind();*/ DataTable dt = PH_HaulierInfo.PH_Haulier_SelAll(AppCode.strConnDB); ddlHaluier.DataTextField = "haulier_abbr"; ddlHaluier.DataValueField = "haulier_abbr"; ddlHaluier.DataSource = dt; ddlHaluier.DataBind(); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnAddSubmit_Click(object sender, EventArgs e) { try { DataSet ds = (DataSet)ViewState["DataRateCalc"]; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { int iSucc = 0, iErr = 0, iRtn = 0; foreach (DataRow dr in ds.Tables[0].Rows) { iRtn = PH_RateCalc.PH_RateCalc_TransporationCalc(AppCode.strConnDB, dr, ddlDateWeek.SelectedItem.Text); if (iRtn > 0) { iSucc++; } else { iErr++; } } lblErr.Text = iSucc + "/" + ds.Tables[0].Rows.Count + " Haulier , Calculate Completed"; DataBindHaulier(); } else { lblErr.Text = "No Data Calculate."; } } catch (Exception ex) { PH_ExceptionManager.WriteError("btnAddSubmit_Click>> " + ex.Message); lblErr.Text = ex.Message; } }
protected void btnFillter_Click(object sender, EventArgs e) { try { if (txtFillVendorName.Text == "") { if (ViewState["RateCardInfo"] == null) { DataBindData(false); } DataTable dt = (DataTable)ViewState["RateCardInfo"]; DataView dv = dt.DefaultView; dv.RowFilter = new System.Text.StringBuilder(string.Empty).Append(" vendor_name like '%" + txtFillVendorName.Text + "%'").ToString(); gvData.DataSource = dv; gvData.DataBind(); } else { DataBindData(true); } } catch (Exception ex) { PH_ExceptionManager.WriteError("btnFillter_Click >> " + ex.Message); } }
private void GenMenu() { try { DataTable dtMenu = PHCode_Menu.PHCode_Menu_SelByRole(AppCode.strConnDB, eStatus.RoleId); foreach (Control ctr in this.Controls) { if (ctr.GetType().Name == "HtmlAnchor") { var results = (from m in dtMenu.AsEnumerable() where m.Field <string>("Menu_Name") == ((System.Web.UI.HtmlControls.HtmlAnchor)ctr).Name select m).FirstOrDefault(); if (results != null && results["Menu_Name"].ToString() != "") { ((System.Web.UI.HtmlControls.HtmlAnchor)ctr).Visible = true; ((System.Web.UI.HtmlControls.HtmlAnchor)ctr).HRef += GetQuery(); } else { ((System.Web.UI.HtmlControls.HtmlAnchor)ctr).Visible = false; } //lbl.Text += results["Menu_Name"]; } } } catch (Exception ex) { PH_ExceptionManager.WriteError(" GenMenu >> " + ex.Message); } }
protected void btnLogin_Click(object sender, EventArgs e) { Session["s_forceChangeMsg"] = ""; try { PrimaryHaul_WSFlow.PHCore_Status status = PrimaryHaul_WSFlow.PHCore_Login.UserSignIn(AppCode.strConnDB, txtUserName.Text, txtPassword.Text); if (status.UserStatus == "D") { lblErr.Text = "Please contact System Administrator"; } else { if (status.Status == PrimaryHaul_WSFlow.PHCore_Status.SignInStatus.Success) { storeUser(status); Session["s_forceChange"] = ""; Session["s_userID"] = status.UserId; if (status.RoleId.ToString() == "VD") { Response.Redirect("report_venderlog.aspx?r=" + status.RoleId + "&id=" + status.UserId, false); } else if (status.RoleId.ToString() == "HL") { Response.Redirect("haulier_upload.aspx?r=" + status.RoleId + "&id=" + status.UserId, false); } else { Response.Redirect("index.aspx?r=" + status.RoleId + "&id=" + status.UserId, false); } } else if (status.Status == PrimaryHaul_WSFlow.PHCore_Status.SignInStatus.PasswordExpired) { storeUser(status); if (txtPassword.Text == "P@ssw0rd") { Session["s_forceChangeMsg"] = "password was reset. Please enter new password."; } else { Session["s_forceChangeMsg"] = "your password has expired. Please enter new password."; } Session["s_forceChange"] = "changepassword.aspx?r=" + status.RoleId + "&p=" + PH_EncrptHelper.MD5Encryp(txtPassword.Text) + "&id=" + status.UserId; Response.Redirect("changepassword.aspx?r=" + status.RoleId + "&p=" + PH_EncrptHelper.MD5Encryp(txtPassword.Text) + "&id=" + status.UserId, false); } else { lblErr.Text = "User Name or Password incorrect"; } } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
private void DataBindPageIndex_BHTrans() { try { DataTable dt = (DataTable)ViewState["BH_TRANSACTION"]; gvData.DataSource = dt; gvData.DataBind(); } catch (Exception ex) { PH_ExceptionManager.WriteError("DataBind_BHTrans >>" + ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { ClearView(); lblErr.Text = ""; InsertData(Session["fileName"].ToString()); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError("verlify data >>" + ex.Message); } }
private void DataBind_BHTrans(string strUserId) { try { DataTable dt = PH_BHUpload.PH_BHTransaction_SelTMP(AppCode.strConnDB, lblWeek.Text, strUserId); ViewState["BH_TRANSACTION"] = dt; gvData.DataSource = dt; gvData.DataBind(); } catch (Exception ex) { PH_ExceptionManager.WriteError("DataBind_BHTrans >>" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { txtPasswordExpired.Text = DateTime.Now.AddDays(AppCode.GetDayofPasswdExp(Page)).ToString("dd/MM/yyyy"); } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { txtDayofExpired.Text = AppCode.GetDayofPasswdExp(Page).ToString(); } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnCalc_Click(object sender, EventArgs e) { try { int rtn = PH_RateCalc.PH_RateCaclAdj_TransportUpdate(AppCode.strConnDB, ddlHaluier.SelectedValue, ddlDateWeek.SelectedValue, txtVendorCode.Text); string message = rtn > 0 ? "Calculate Completed" : "Calculate Not Completed"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertmsg", "alert('" + message + "');", true); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void AjaxFileUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { try { string fileName = "bh_" + DateTime.Now.ToString("yyyMMddHHss") + new Random().Next(999) + e.ContentType;// +e.FileName; string fullPath = Server.MapPath(ConfigurationManager.AppSettings["PH_FolderUpload"] + fileName); AjaxFileUpload.SaveAs(fullPath); Session["fileName"] = fullPath; btnSubmit.Enabled = true; } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError("AjaxFileUpload_UploadComplete >>" + ex.Message); } }
protected void btnCalc_Click(object sender, EventArgs e) { try { lblErr.Text = ""; int isError = PH_BHCalc.PH_BHTrans_Calc(AppCode.strConnDB, ddlDateWeek.SelectedValue); DataBindTransCalc(); string message = isError > 0 ? "Calculate Data Successfull" : "Calculate Data Not Successfull"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertmsg", "alert('" + message + "');", true); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError("btnCalc_Click >>" + ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (PH_DayofPasswrdExp.PH_DayofExp_Insert(AppCode.strConnDB, int.Parse(txtDayofExpired.Text)) > 0) { lblErr.Text = "Date of Expired has changed! "; } Session[ConfigurationManager.AppSettings["PH_Day_PasswordExpired_Session"]] = txtDayofExpired.Text; } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { /*eStatus = new PHCore_Status(); * string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"])); * if( strRoleId != "" ) * eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true);*/ #region Check Type string[] type = (Request["type"] != null) ? Request["type"].Split(',') : null; if (type != null && type[0] == PHCore_Status.RoleID.A1.ToString()) { divContact.Visible = false; divHaulier.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.HL.ToString()) { divVender.Visible = false; divRole.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.VD.ToString()) { divHaulier.Visible = false; divRole.Visible = false; } else { Response.Redirect("logout.aspx", false); } #endregion lblHeader.Text = (type != null) ? ConfigurationManager.AppSettings["PH_AddNew_" + type[0]] : ""; txtPasswrdExpried.Text = DateTime.Now.AddDays(AppCode.GetDayofPasswdExp(Page)).ToString(ConfigurationManager.AppSettings["PH_Date_format"]); } catch (Exception ex) { lblError.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { cs_checkFiled getLast = new cs_checkFiled(); string frValue = getLast.sql_getAjaxAnswer("SELECT top 1 VAT_Rate FROM VAT_Default "); txtVatRate.Text = frValue; } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { main_function PPHfunction = new main_function(); if (PPHfunction.QueryExecuteNonQuery("update VAT_Default set VAT_Rate='" + txtVatRate.Text + "'")) { lblErr.Text = ""; Response.Write("<script>alert('Save Success');</script>"); } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (PHCore_User.ChangeProfile(AppCode.strConnDB, Request["id"], txtContact.Text, txtEmail.Text, txtMobile.Text) > 0) { lblError.Text = ConfigurationManager.AppSettings["PH_Success_Message"]; } else { lblError.Text = ConfigurationManager.AppSettings["PH_Error_Message"]; } } catch (Exception ex) { lblError.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
private void GetHaulierData(bool isNew) { try { if (isNew) { ViewState["HaulierUpload"] = PH_HaulierUpload.PH_HaulierUp_SelTMP(AppCode.strConnDB, txtWeek.Text, (string)ViewState["HaulierAbbr"], Request["id"]); btnInsert.Enabled = true; gvData.DataSource = (DataTable)ViewState["HaulierUpload"]; gvData.DataBind(); } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError("GetHaulierData >>" + ex.Message); } }
private void DataBindTransCalc() { try { if (!string.IsNullOrEmpty(ddlDateWeek.SelectedValue)) { DataTable dt = PH_BHCalc.PH_BHTransCacl_Sel(AppCode.strConnDB, ddlDateWeek.SelectedValue.ToString()); gvData.DataSource = dt; gvData.DataBind(); } else { PH_ExceptionManager.WriteError("Date week is null"); } } catch (Exception ex) { PH_ExceptionManager.WriteError("DataBindTransCalc >>" + ex.Message); } }
private void DataBindDateWeek() { try { DataSet ds = PH_RateCalc.PH_RateCalc_DateWeekSelAll(AppCode.strConnDB); //PH_ExceptionManager.WriteError("DataBindDateWeek >>" + ds.Tables[0].Rows.Count); ddlDateWeek.DataValueField = "dateweek"; ddlDateWeek.DataTextField = "dateweek"; ddlDateWeek.DataSource = ds.Tables[0]; ddlDateWeek.DataBind(); if (ddlDateWeek.Items.Count > 0) { ddlDateWeek.ClearSelection(); ddlDateWeek.Items[0].Selected = true; } } catch (Exception ex) { PH_ExceptionManager.WriteError("DataBindDateWeek >>" + ex.Message); } }
protected void btnInsert_Click(object sender, EventArgs e) { try { bool isError = false; string strMess = ""; /*PHDS_HaulierUpload.TransportationDataTable dt = (PHDS_HaulierUpload.TransportationDataTable)ViewState["HaulierUploadInsert"]; * foreach (PHDS_HaulierUpload.TransportationRow dr in dt.Rows) * { * try * { * PH_HaulierUpload.PH_HaulierUp_Insert(AppCode.strConnDB, dr); * PH_HaulierUpload.PH_HaulierUpLog_Insert(AppCode.strConnDB, int.Parse(Request["id"]), txtWeek.Text, Session["fileName"].ToString(), dr.Haulier_Abbr.ToString()); * } * catch (Exception ex) * { * isError = true; * strMess = ex.Message; * PH_ExceptionManager.WriteError("btnInsert_Click ,PH_HaulierUp_Insert >>" + ex.Message); * } * * }*/ PH_HaulierUpload.PH_HaulierUp_Insert1(AppCode.strConnDB, txtWeek.Text, (string)ViewState["HaulierAbbr"], Request["id"]); PH_HaulierUpload.PH_HaulierUp_DelTMP(AppCode.strConnDB, txtWeek.Text, (string)ViewState["HaulierAbbr"], Request["id"]); string message = !isError ? "Save Data Successfull" : "Save Data Not Successfull"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertmsg", "alert('" + message + "');", true); btnInsert.Enabled = false; btnSubmit.Enabled = false; btnClear.Enabled = false; } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError("btnInsert_Click >>" + ex.Message); } }
private void ClearTextAll() { try { txtContact.Text = ""; txtEmail.Text = ""; txtEngName.Text = ""; txtHaulierCode.Text = ""; txtMobile.Text = ""; txtTaxId.Text = ""; txtTHAName.Text = ""; txtUserName.Text = ""; lblErrUserName.Text = ""; lblErrHaulierCode.Text = ""; lblError.Text = ""; } catch (Exception ex) { PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnLogin_Click(object sender, EventArgs e) { try { PrimaryHaul_WSFlow.PHCore_Status status = PrimaryHaul_WSFlow.PHCore_Login.UserSignIn(AppCode.strConnDB, txtUserName.Text, txtPassword.Text); if (status.Status == PrimaryHaul_WSFlow.PHCore_Status.SignInStatus.Success) { storeUser(status); Response.Redirect("index.aspx?r=" + status.RoleId + "&id=" + status.UserId, false); } else if (status.Status == PrimaryHaul_WSFlow.PHCore_Status.SignInStatus.PasswordExpired) { storeUser(status); Response.Redirect("changepassword.aspx?r=" + status.RoleId + "&p=" + PH_EncrptHelper.MD5Encryp(txtPassword.Text) + "&id=" + status.UserId, false); } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (PHCore_User.SelAllUserName(AppCode.strConnDB, txtUserName.Text).Trim() != "") { lblErrUserName.Text = ConfigurationManager.AppSettings["PH_AddNew_UserName_Err"]; } else if (GetRoleId() == PHCore_Status.RoleID.HL.ToString() && PH_HaulierInfo.PH_Haulier_SelByTaxId(AppCode.strConnDB, txtHaulierCode.Text).Trim() == "") { lblErrHaulierCode.Text = ConfigurationManager.AppSettings["PH_AddNew_Haulier_Err"]; } else { InsertUserProfile(); } } catch (Exception ex) { lblError.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (PH_EncrptHelper.MD5Decryp(Request["p"]) == txtPassword.Text) { lblErr.Text = ConfigurationManager.AppSettings["PH_Error_PasswordExpired"]; } else { var rtn = PHCore_User.ChangePasswd(AppCode.strConnDB, Request["id"], txtPassword.Text, DateTime.ParseExact(txtPasswordExpired.Text, "dd/MM/yyyy", null)); if (rtn > 0) { Response.Redirect("login.aspx", false); } } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Request["id"] != null && Request["id"] != "") { DataTable dt = PHCore_User.SelByUserId(AppCode.strConnDB, Request["id"]); if (dt.Rows.Count > 0) { txtContact.Text = dt.Rows[0]["contact_person"].ToString(); txtMobile.Text = dt.Rows[0]["mobile"].ToString(); txtEmail.Text = dt.Rows[0]["email_address"].ToString(); } } } } catch (Exception ex) { lblError.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
private void DataBindHaulier() { try { DataSet dsHaulier = PH_RateCalc.PH_ReateCalc_HaulierSelByDateWeek(AppCode.strConnDB, ddlDateWeek.SelectedItem.Text); ViewState["DataRateCalc"] = dsHaulier; if (dsHaulier.Tables[0].Rows.Count > 0) { gvData.Visible = true; gvData.DataSource = dsHaulier; gvData.DataBind(); } else { lblErr.Text = "data not found."; gvData.Visible = false; } } catch (Exception ex) { PH_ExceptionManager.WriteError("DataBindHaulier >>" + ex.Message); } }
private void DataBindTrans(bool isNew) { try { DataSet ds; if (isNew) { ds = PH_RateCalc.PH_RateCalcAdj_TransportSel(AppCode.strConnDB, ddlHaluier.SelectedValue, txtVendorCode.Text, ddlDateWeek.SelectedValue); } else { ds = (DataSet)ViewState["RateCalcAdj"]; } ViewState["RateCalcAdj"] = ds; gvData.DataSource = ds; gvData.DataBind(); } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }