//'Dim da As SqlDataAdapter //'Dim cn As New SqlConnection protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //'cn = New SqlConnection("Server=dbserver;Database=key_CarCrox;Uid=sa;Password=123456;") //'cn.Open() btnSaveAndAddnew.Visible = HasAdd; btnClear.Visible = HasAdd; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { noIdFoundRedirect("Role.aspx"); } objEncrypt = null; SetValuesToControls(); } else { SetValuesToControls(true); } } }
public void loadData() { try { clsEncryption oEncryption = new clsEncryption(); using (clsConnection oConn = new clsConnection()) { NpgsqlCommand ocmd = new NpgsqlCommand(); frmMain.setLoadDialog(true, "Loading data..."); string strSql = @"select userid, username, password,fullname,email,groupusers,active from tbm_users where dlt='0' order by groupusers"; DataTable dtData = oConn.GetData(strSql); dgData.DataSource = dtData; } } catch (NpgsqlException ex) { ////clsGlobal.generateErrMessageAndSendmail(ex, false); } catch (Exception ex) { ////clsGlobal.generateErrMessageAndSendmail(ex, false); } finally { frmMain.setLoadDialog(false, ""); } loadGroupUsers(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lnkSaveAndAddnew.Visible = HasAdd; objCommon = new clsCommon(); objCommon.FillDropDownList(ddlCountry, "tblCountry", tblCountry.ColumnNames.AppCountry, tblCountry.ColumnNames.AppCountryID, "-- Select Country --"); ddlState.Items.Clear(); ddlState.Items.Add(new ListItem("-- Select State --", "0")); ddlCity.Items.Clear(); ddlCity.Items.Add(new ListItem("-- Select City --", "0")); objCommon = null; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["SortOrder"] = appFunctions.Enum_SortOrderBy.Asc; ViewState["SortColumn"] = ""; objCommon = new clsCommon(); objCommon.FillDropDownList(ddlstatus, "tblOrderStatus", tblOrderStatus.ColumnNames.AppOrderStatus, tblOrderStatus.ColumnNames.AppOrderStatusID, "-- Select Status --", tblOrderStatus.ColumnNames.AppDisplayOrder, appFunctions.Enum_SortOrderBy.Asc); objCommon.FillRecordPerPage(ref ddlPerPage); objCommon = null; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } LoadDataGrid(true, false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["SortOrder"] = appFunctions.Enum_SortOrderBy.Asc; ViewState["SortColumn"] = ""; dgvGridView.Columns[0].Visible = HasDelete; if (Session[appFunctions.Session.ShowMessage.ToString()] != null) { if (!string.IsNullOrEmpty(Session[appFunctions.Session.ShowMessage.ToString()].ToString())) { DInfo.ShowMessage(Session[appFunctions.Session.ShowMessage.ToString()].ToString(), (Enums.MessageType)Session[appFunctions.Session.ShowMessageType.ToString()]); Session[appFunctions.Session.ShowMessage.ToString()] = ""; Session[appFunctions.Session.ShowMessageType.ToString()] = ""; } } objCommon = new clsCommon(); objCommon.FillRecordPerPage(ref ddlPerPage); if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { string pid = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { } } LoadDataGrid(true, false); txtSearch.Focus(); objCommon = null; } }
private void frmLogin_Load(object sender, EventArgs e) { this.MaximizeBox = false; try { clsRegKey oReg = new clsRegKey(); clsEncryption oEncryption = new clsEncryption(); oReg.RegistryPathCurrentUser = clsGlobal.s_FullRegKey; clsGlobal.str_Server = oReg.getSetting("Server"); clsGlobal.str_User = oEncryption.Decrypt(oReg.getSetting("User")); clsGlobal.str_Password = oEncryption.Decrypt(oReg.getSetting("Password")); clsGlobal.str_Database = oReg.getSetting("Database"); clsGlobal.str_Port = oReg.getSetting("Port"); oReg = null; oEncryption = null; } catch (NpgsqlException ex) { XtraMessageBox.Show("Unable connect to database server, please configure the database connection first", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmServerInitialize frm = new frmServerInitialize(); frm.ShowDialog(this); frm = null; } catch (Exception ex) { XtraMessageBox.Show("Could not write/read Registry System.!\nCall Your System Administrator\n", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetRegulerExpression(); if (Request.Cookies.Get("FabyMartUsername") != null) { clsEncryption objEncrypt = new clsEncryption(); if (Request.Cookies.Get("FabyMartUsername").Value != "") { txtEmail.Text = objEncrypt.Decrypt(Request.Cookies.Get("FabyMartUsername").Value, appFunctions.strKey); if (Request.Cookies.Get("FabyMartPassword").Value != "") { txtpassword.Attributes.Add("value", objEncrypt.Decrypt(Request.Cookies.Get("FabyMartPassword").Value, appFunctions.strKey)); chkRemeber.Checked = true; } } objEncrypt = null; } else { chkRemeber.Checked = false; } } }
//Dim strHostName As String = System.Net.Dns.GetHostName() protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { dynamic objEncrypt = new clsEncryption(); if ((Request.Cookies.Get("JetAPIAdminUsername") != null)) { if (!string.IsNullOrEmpty(Request.Cookies.Get("JetAPIAdminUsername").Value)) { txtUserName.Text = objEncrypt.Decrypt(Request.Cookies.Get("JetAPIAdminUsername").Value, appFunctions.strKey); if ((Request.Cookies.Get("JetAPIAdminPassword") != null)) { if (!string.IsNullOrEmpty(Request.Cookies.Get("JetAPIAdminPassword").Value)) { txtPassword.Attributes.Add("value", objEncrypt.Decrypt(Request.Cookies.Get("JetAPIAdminPassword").Value, appFunctions.strKey)); } } chkRemeber.Checked = true; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetRegulerExpression(); lnkSaveAndAddnew.Visible = HasAdd; objClsCommon = new clsCommon(); objClsCommon.FillDropDownList(ddlBlock, "tblBlock", tblBlock.ColumnNames.AppBlockName, tblBlock.ColumnNames.AppBlockId, "--Select Block--", tblBlock.ColumnNames.AppBlockId, appFunctions.Enum_SortOrderBy.Asc, "appIsShowContent = 'False'"); objClsCommon = null; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } } }
public bool SendPassword() { tblCustomer objCustomer = new tblCustomer(); objCustomer.Where.AppEmailID.Value = txtEmail.Text; objCustomer.Query.Load(); if (objCustomer.RowCount > 0) { clsCommon objCommon = new clsCommon(); clsEncryption objEncrypt = new clsEncryption(); string StrBody = ""; string strSubject = "Password Recovery Request"; StrBody = objCommon.readFile(Server.MapPath("~/EmailTemplates/ForgetPassword.html")); StrBody = StrBody.Replace("`email`", objCustomer.AppEmailID); StrBody = StrBody.Replace("`password`", objEncrypt.Decrypt(objCustomer.AppPassword, appFunctions.strKey.ToString())); objCommon.SendConfirmationMail(objCustomer.AppEmailID, strSubject, StrBody, Enums.Enum_Confirmation_Mail_type.register); objEncrypt = null; objCommon = null; txtEmail.Text = ""; } else { DInfo.ShowMessage("Invalid email address, Please enter registered email.", Enums.MessageType.Error); return(false); } objCustomer = null; return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["SortOrder"] = appFunctions.Enum_SortOrderBy.Asc; ViewState["SortColumn"] = ""; lnkSaveAndAddnew.Visible = HasAdd; objCommon = new clsCommon(); objCommon.FillDropDownList(ddlCategory, "tblCategory", tblCategory.ColumnNames.AppCategory, tblCategory.ColumnNames.AppCategoryID, "-- Select Category --", tblCategory.ColumnNames.AppCategory, appFunctions.Enum_SortOrderBy.Asc); objCommon = null; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); LoadAllData(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTab()", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lnkSaveAndAddnew.Visible = HasAdd; ViewState["SortOrder"] = appFunctions.Enum_SortOrderBy.Asc; ViewState["SortColumn"] = ""; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTab()", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lnkSaveAndAddnew.Visible = HasAdd; objClsCommon = new clsCommon(); if ((bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]) { objClsCommon.FillDropDownList(ddlRoleName, "tblRole", tblRole.ColumnNames.AppRoleName, tblRole.ColumnNames.AppRoleID, "--Select Role--", tblRole.ColumnNames.AppRoleID, appFunctions.Enum_SortOrderBy.Asc); } else { objClsCommon.FillDropDownList(ddlRoleName, "tblRole", tblRole.ColumnNames.AppRoleName, tblRole.ColumnNames.AppRoleID, "--Select Role--", tblRole.ColumnNames.AppRoleID, appFunctions.Enum_SortOrderBy.Asc, tblRole.ColumnNames.AppCreatedBy + "=" + Session[appFunctions.Session.UserID.ToString()].ToString()); } objClsCommon = null; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } } }
protected void btnReturnGenrateSlip_Click(object sender, EventArgs e) { if (hdnReturnOrderID.Value != "") { tblReturnOrder objReturnOrder = new tblReturnOrder(); if (objReturnOrder.LoadByPrimaryKey(Convert.ToInt32(hdnReturnOrderID.Value))) { objReturnOrder.s_AppDocketNo = txtDocketNo.Text; if (Convert.ToInt32(ddlCourierCompany.SelectedValue) != -1) { objReturnOrder.s_AppCourierCompanyID = ddlCourierCompany.SelectedValue; } else { objReturnOrder.AppCourierCompanyContactNo = txtCourierContactNo.Text; objReturnOrder.AppCourierCompanyWebsite = txtSiteName.Text; } objReturnOrder.Save(); objEncrypt = new clsEncryption(); hdnReturnOrderID.Value = GetAlias("Productslip.aspx") + objEncrypt.Encrypt(objReturnOrder.s_AppReturnOrderID, appFunctions.strKey); objEncrypt = null; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "CallProductInvoice()", true); } objReturnOrder = null; } LoadMyorderList(); }
public clsParametros() { //using System.Configuration; string EncKeyBase = ""; EncKeyBase = ConfigurationManager.AppSettings["enc_key_base"].ToString(); clsEncryption Encryption = new clsEncryption(EncKeyBase); string strServer = ConfigurationManager.AppSettings["Server"].ToString(); string strCatalog = ConfigurationManager.AppSettings["Catalog"].ToString(); string strId = ConfigurationManager.AppSettings["ID"].ToString(); string strEnc = ConfigurationManager.AppSettings["ENC"].ToString(); CodigoModulo = ConfigurationManager.AppSettings["Codigo_Modulo"].ToString(); strId = Encryption.fnGetDecrypt(strId); strEnc = Encryption.fnGetDecrypt(strEnc); StringDeConexion = ConfigurationManager.AppSettings["StringDeConexion"].ToString(); StringDeConexion = StringDeConexion.Replace("Server={no_edit}", "Server=" + strServer); StringDeConexion = StringDeConexion.Replace("Initial Catalog={no_edit}", "Initial Catalog=" + strCatalog); StringDeConexion = StringDeConexion.Replace("Database={no_edit}", "Database=" + strCatalog); StringDeConexion = StringDeConexion.Replace("User ID={no_edit}", "User ID=" + strId); StringDeConexion = StringDeConexion.Replace("Password={no_edit}", "Password=" + strEnc); }
protected void btnSend_Click(object sender, EventArgs e) { objUser = new tblUser(); objUser.Where.AppUserName .Value = txtUserName.Text; objUser.Query.Load(); if (objUser.RowCount > 0) { clsCommon objCommon = new clsCommon(); clsEncryption objEncrypt = new clsEncryption(); string StrBody = ""; string strSubject = "Password Recovery Request"; StrBody = objCommon.readFile(Server.MapPath("~/admin/EmailTemplates/ForgetPassword.html")); StrBody = StrBody.Replace("`email`", objUser.AppEmail); StrBody = StrBody.Replace("`password`", objEncrypt.Decrypt(objUser.AppPassword, appFunctions.strKey.ToString())); objCommon.SendMail(objUser.AppEmail, strSubject, StrBody); objEncrypt = null; objCommon = null; txtUserName.Text = ""; lblMsg.Text = "Your password has been sent to your email address. Please check your email."; lblMsg.ForeColor = System.Drawing.Color.Green; } else { lblMsg.Text = "Invalid Your User Name."; lblMsg.ForeColor = System.Drawing.Color.Red; } objUser = null; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lnkSaveAndAddnew.Visible = HasAdd; SetRegExpresssion(); objCommon = new clsCommon(); objCommon.FillDropDownList(ddlProduct, "tblProduct", tblProduct.ColumnNames.AppProductName, tblProduct.ColumnNames.AppProductID, "-- Select Product --"); objCommon = null; img.Visible = false; if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } objEncrypt = null; SetValuesToControls(); } } }
private bool SaveData() { objClsCommon = new clsCommon(); objUser = new tblUser(); if (objClsCommon.IsRecordExists("tblUser", tblUser.ColumnNames.AppUserName, tblUser.ColumnNames.AppUserId, txtUserName.Text, hdnPKID.Value)) { DInfo.ShowMessage("User Name is already exists", Enums.MessageType.Warning); return(false); } if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objUser.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objUser.AddNew(); objUser.AppCreatedDate = System.DateTime.Now; objUser.AppCreatedBy = Convert.ToInt32(Session[appFunctions.Session.UserID.ToString()]); } objUser.s_AppUserName = txtUserName.Text; objEncrypt = new clsEncryption(); objUser.AppPassword = objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey); objEncrypt = null; objUser.s_AppRoleId = ddlRoleName.SelectedValue; objUser.AppFullName = txtFullName.Text; objUser.AppEmail = txtEmailAddress.Text; objUser.AppMobile = txtMobileNo.Text; objUser.AppAddress = txtAddress.Text; objUser.AppIsActive = chkIsActive.Checked; objUser.AppIsSuperAdmin = Convert.ToBoolean(0); if (FileUploadImg.HasFile) { objClsCommon = new clsCommon(); string strError = ""; string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); string strPath = objClsCommon.FileUpload_Images(FileUploadImg.PostedFile, txtFullName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/User/", ref strError, 0, objUser.s_AppPhoto); if (strError == "") { objUser.AppPhoto = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } } objUser.AppDescription = txtDescription.Text; objUser.Save(); iUserid = objUser.AppUserId; objUser = null; objClsCommon = null; return(true); }
public void LoadRecentProduct() { string strRecentProductId = ""; objEncrypt = new clsEncryption(); if (Request.Cookies.Get("FebyMart") != null) { if (Request.Cookies.Get("FebyMart").Value != "") { strRecentProductId = objEncrypt.Decrypt(Request.Cookies.Get("FebyMart").Value, appFunctions.strKey); } } if (strRecentProductId != "") { if (!strRecentProductId.Contains(hdnProductDetailId.Value)) { strRecentProductId = strRecentProductId.Trim(',').TrimEnd(',').Trim(); string[] strIds = strRecentProductId.Split(','); if (strIds.Length > 3) { string strRecentId = ""; for (int i = 1; i < 4; i++) { strRecentId = strRecentId + "," + strIds[i]; } strRecentProductId = strRecentId.Trim(',').TrimEnd(',').Trim() + "," + hdnProductDetailId.Value; } else { strRecentProductId = strRecentProductId + "," + hdnProductDetailId.Value; } } } else { strRecentProductId = hdnProductDetailId.Value; } tblProduct objTempProduct = new tblProduct(); objDataTable = objTempProduct.LoadRecentProduct(strRecentProductId, hdnProductDetailId.Value); if (objDataTable.Rows.Count > 0) { RepRecentProduct.DataSource = objDataTable; RepRecentProduct.DataBind(); divRecentProduct.Visible = true; } else { divRecentProduct.Visible = false; } objTempProduct = null; httpCookie = new HttpCookie("FebyMart", objEncrypt.Encrypt(strRecentProductId, appFunctions.strKey)); httpCookie.Expires = DateTime.Today.AddDays(10); Response.Cookies.Add(httpCookie); objEncrypt = null; }
private void SetValuesToControl() { objSettings = new tblSettings(); objEncrypt = new clsEncryption(); objSettings.LoadAll(); if (objSettings.RowCount > 0) { try { txtSiteName.Text = objSettings.AppSiteName; txtFooter.Text = objSettings.AppFooterText; chkSiteOffline.Checked = objSettings.AppIsSiteOffline; txtSiteOfflineMessage.Text = objSettings.AppSiteOfflineMessage; txtSiteTagLine.Text = objSettings.AppSiteTagLine; ddlPerMenu.SelectedValue = objSettings.AppSiteDefaultListLimit; txtPathToFolder.Text = objSettings.AppPathToFolder; //txtDatasourceName.Text = objSettings.AppDatasource; //txtDatasourceUserName.Text = objSettings.AppDatasourceUserName; //txtDataBaseName.Text = objSettings.AppDatabaseName; txtSMTP.Text = objSettings.AppSMTP; txtSiteEmail.Text = objSettings.AppSiteEmail; txtPortNumber.Text = objSettings.AppPortNumber; txtClientSiteUrl.Text = objSettings.AppClientSiteURL; txtRecepientEmail.Text = objSettings.AppRecepientEmail; if (objSettings.AppSiteOfflineImage.ToString() != "" && objSettings.AppSiteOfflineImage.ToString() != null) { imgOfflineImage.ImageUrl = objSettings.AppSiteOfflineImage; } if (objSettings.AppSiteLogo.ToString() != "" && objSettings.AppSiteLogo.ToString() != null) { ImgLogo.ImageUrl = objSettings.AppSiteLogo; } if (objSettings.AppSiteFavicon.ToString() != "" && objSettings.AppSiteFavicon.ToString() != null) { ImgFavicon.ImageUrl = objSettings.AppSiteFavicon; } //txtDatasourcePassword.Attributes.Add("value", objSettings.AppDatasourcePassword); txtEmailPassword.Attributes.Add("value", objEncrypt.Decrypt(objSettings.AppEmailPassword, appFunctions.strKey)); if (objSettings.s_AppIsCOD != "") { CHkIsCOD.Checked = objSettings.AppIsCOD; } else { CHkIsCOD.Checked = false; } } catch (Exception e) { } } objSettings = null; }
public Boolean IsLogin() { if (txtEmail.Text.Trim() == "" || txtPassword.Text.Trim() == "") { DInfo.ShowMessage("Enter user name and password.", Enums.MessageType.Error); return(false); } //string strRegex = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}" + "\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\" + ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"; //Regex re = new Regex(strRegex); //if (!(re.IsMatch(txtEmail.Text.Trim()))) //{ // DInfo.ShowMessage("Invalid Email (Ex. [email protected])", Enums.MessageType.Error); // return false; //} tblCustomer objCustomer = new tblCustomer(); objCustomer.Where.AppEmailID.Value = txtEmail.Text.Trim(); objCustomer.Query.Load(); if (objCustomer.RowCount > 0) { clsEncryption objEncrypt = new clsEncryption(); if (string.Compare(objEncrypt.Decrypt(objCustomer.AppPassword, appFunctions.strKey), txtPassword.Text, false) != 0) { DInfo.ShowMessage("Invalid user name and password.", Enums.MessageType.Error); return(false); } else { if (objCustomer.AppIsVerified) { httpCookie = new HttpCookie("FabyMartUsername", objEncrypt.Encrypt(txtEmail.Text, appFunctions.strKey)); httpCookie.Expires = DateTime.Today.AddDays(10); Response.Cookies.Add(httpCookie); httpCookie = new HttpCookie("FabyMartPassword", objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey)); httpCookie.Expires = DateTime.Today.AddDays(10); Response.Cookies.Add(httpCookie); Session[appFunctions.Session.ClientUserID.ToString()] = objCustomer.AppCustomerID; Session[appFunctions.Session.ClientUserName.ToString()] = objCustomer.AppFirstName + " " + objCustomer.AppLastName; } else { DInfo.ShowMessage("Your account is Not Verified .", Enums.MessageType.Error); return(false); } } objEncrypt = null; } else { DInfo.ShowMessage("Invalid user name and password.", Enums.MessageType.Error); return(false); } objCustomer = null; return(true); }
private void Login(string strUsername, string strPassword) { try { clsEncryption oEncryption = new clsEncryption(); using (clsConnection oconn = new clsConnection()) { NpgsqlCommand ocmd = new NpgsqlCommand(); oconn.Open(); ocmd.Connection = oconn.Conn; ocmd = new NpgsqlCommand(); ocmd.Connection = oconn.Conn; bool isActive = true; string strsql = @"select userid, username, fullname,email, groupusers from tbm_users where username=@username and password=@password and dlt='0' and active='1'"; ocmd.Parameters.Add("@username", NpgsqlTypes.NpgsqlDbType.Varchar).Value = oEncryption.Encrypt(strUsername.ToString().ToUpper()); ocmd.Parameters.Add("@password", NpgsqlTypes.NpgsqlDbType.Varchar).Value = oEncryption.Encrypt(strPassword.ToString()); ocmd.CommandText = strsql; NpgsqlDataReader dr; dr = ocmd.ExecuteReader(); if (dr.Read()) { clsRegKey oRegKey = new clsRegKey(); oRegKey.RegistryPathCurrentUser = clsGlobal.s_FullRegKey; oRegKey = null; clsGlobal.strUserName = oEncryption.Decrypt(dr["username"].ToString()); clsGlobal.strUserID = dr["userid"].ToString(); clsGlobal.strHakAkses = dr["groupusers"].ToString(); clsGlobal.strNamaPetugas = dr["fullname"].ToString(); clsGlobal.strUserPassword = txtPassword.Text; clsGlobal.strGroupUser = dr["groupusers"].ToString(); } else { XtraMessageBox.Show("Invalid username or password .!", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); strPassword = ""; oconn.Close(); ocmd = null; oEncryption = null; return; } oconn.Close(); ocmd = null; } oEncryption = null; this.DialogResult = System.Windows.Forms.DialogResult.OK; } catch (Exception ex) { XtraMessageBox.Show("Unable connect to database server, please configure the database connection first", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmServerInitialize frm = new frmServerInitialize(); frm.ShowDialog(this); } }
private bool SaveData() { objClsCommon = new clsCommon(); objCustomer = new tblCustomer(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCustomer.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objCustomer.AddNew(); } objCustomer.AppFirstName = txtFirstName.Text; objCustomer.AppLastName = txtLastName.Text; objCustomer.AppEmailID = txtEmail.Text; objEncrypt = new clsEncryption(); objCustomer.AppPassword = objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey); objEncrypt = null; objCustomer.AppMobile = txtMobile.Text; objCustomer.AppPhone = txtPhone.Text; if (RbtnMale.Checked) { objCustomer.AppGender = true; } else { objCustomer.AppGender = false; } objCustomer.AppIsVerified = chkIsVerified.Checked; if (FileUploadImg.HasFile) { string strError = ""; string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); string strPath = objClsCommon.FileUpload_Images(FileUploadImg.PostedFile, txtFirstName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/Customer/", ref strError, 0, objCustomer.s_AppImage, false, 0, 2000); if (strError == "") { objCustomer.AppImage = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } } objCustomer.AppIsActive = chkIsActive.Checked; objCustomer.AppIsNewsLetter = chkIsNewsLetter.Checked; objCustomer.Save(); iCustomerID = objCustomer.AppCustomerID; objCustomer = null; objClsCommon = null; return(true); }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { btnSaveAndAddnew.Visible = HasAdd; btnClear.Visible = HasAdd; SetUpDrowDown(); objEncrypt = new clsEncryption(); if ((Request.QueryString.Get("ID") != null)) { try { hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); } catch (Exception ex) { noIdFoundRedirect("Tab.aspx"); } objEncrypt = null; SetValuesToControls(); } if ((Request.QueryString.Get("PID") != null)) { try { intParentId = Convert.ToInt32(objEncrypt.Decrypt(Request.QueryString.Get("PID"), appFunctions.strKey)); } catch (Exception ex) { noIdFoundRedirect("Tab.aspx"); } ddlParent.SelectedValue = intParentId.ToString(); objTab = new tblTab(); objTab.LoadByPrimaryKey(intParentId); objTab.Query.AddResultColumn(tblTab.ColumnNames.AppAddPage); objTab.Query.Load(); ////Set Value To Controls //txtAddPage.Text = objTab.AppAddPage; objTab.Where.WhereClauseReset(); objTab = null; } } }
public void redirectToListing() { objEncrypt = new clsEncryption(); if (ddlParent.SelectedValue != "0") { Response.Redirect("Tab.aspx?ID=" + objEncrypt.Encrypt(ddlParent.SelectedValue, appFunctions.strKey)); } else { Response.Redirect("Tab.aspx"); } }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCustomer = new tblCustomer(); if (objCustomer.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { txtFirstName.Text = objCustomer.AppFirstName; txtLastName.Text = objCustomer.AppLastName; txtEmail.Text = objCustomer.AppEmailID; objEncrypt = new clsEncryption(); txtPassword.Attributes.Add("value", objEncrypt.Decrypt(objCustomer.AppPassword, appFunctions.strKey)); objEncrypt = null; txtMobile.Text = objCustomer.AppMobile; txtPhone.Text = objCustomer.AppPhone; if (objCustomer.s_AppGender != "") { if (objCustomer.AppGender) { RbtnMale.Checked = true; } else { rbtnFeMale.Checked = true; } } else { RbtnMale.Checked = true; } chkIsVerified.Checked = objCustomer.AppIsVerified; if (objCustomer.AppImage != "") { img.ImageUrl = objCustomer.AppImage; } if (objCustomer.s_AppIsActive != "") { chkIsActive.Checked = objCustomer.AppIsActive; } if (objCustomer.s_AppIsNewsLetter != "") { chkIsNewsLetter.Checked = objCustomer.AppIsNewsLetter; } if (objCustomer.s_AppIsVerified != "") { chkIsVerified.Checked = objCustomer.AppIsVerified; } } objCustomer = null; } }
private bool SaveData() { objUser = new tblUser(); objUser.LoadByPrimaryKey((int)Session[appFunctions.Session.UserID.ToString()]); objEncrypt = new clsEncryption(); if (string.Compare(objEncrypt.Decrypt(objUser.AppPassword, appFunctions.strKey), txtOldPassword.Text) == 0) { objUser.AppPassword = objEncrypt.Encrypt(txtNewPassword.Text, appFunctions.strKey); objUser.Save(); return(true); } DInfo.ShowMessage("Old Password is incorrect", Enums.MessageType.Error); return(false); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { hdnProductDetailID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); ViewState["SortOrder"] = appFunctions.Enum_SortOrderBy.Asc; ViewState["SortColumn"] = ""; //btnAdd.Visible = HasAdd; btnDelete.Visible = HasDelete; dgvGridView.Columns[0].Visible = HasDelete; // dgvGridView.Columns[1].Visible = HasEdit; objCommon = new clsCommon(); objCommon.BindEnumtoDDL(typeof(Enums.Enum_ReviewStatus), ddlStatus, "--Select Status--"); // objCommon.FillDropDownList(ddlUserName, "tblRegistration", tblRegistration.ColumnNames.AppFullName, tblRegistration.ColumnNames.AppRegistrationID, "--Select UserName--", tblRegistration.ColumnNames.AppUserStatus + "<>" + Convert.ToInt32(Enums.Enum_UserStatus.Created)); // objCommon.FillDropDownList(ddlProfessionalName, "tblProfessional", tblProfessional.ColumnNames.AppProfessionalName, tblProfessional.ColumnNames.AppProfessionalID, "--Select Professional--", tblProfessional.ColumnNames.AppPublishedBy + "<>" + "0"); objCommon = null; if (Session[appFunctions.Session.ShowMessage.ToString()] != null) { if (!string.IsNullOrEmpty(Session[appFunctions.Session.ShowMessage.ToString()].ToString())) { DInfo.ShowMessage(Session[appFunctions.Session.ShowMessage.ToString()].ToString(), (Enums.MessageType)Session[appFunctions.Session.ShowMessageType.ToString()]); Session[appFunctions.Session.ShowMessage.ToString()] = ""; Session[appFunctions.Session.ShowMessageType.ToString()] = ""; } } objCommon = new clsCommon(); objCommon.FillRecordPerPage(ref ddlPerPage); if ((Request.QueryString.Get("ID") != null)) { objEncrypt = new clsEncryption(); try { string pid = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey); // ddlProfessionalName.SelectedValue = pid; } catch (Exception ex) { // noIdFoundRedirect("Employee.aspx"); } } LoadDataGrid(true, false); //txtSearch.Focus(); objCommon = null; } }
protected void btnLogin_Click(object sender, EventArgs e) { if (IsLogin()) { tblCustomer objCustomer = new tblCustomer(); objCustomer.Where.AppEmailID.Value = txtEmail.Text.Trim(); objCustomer.Query.Load(); if (objCustomer.RowCount > 0) { objEncrypt = new clsEncryption(); if (string.Compare(objEncrypt.Decrypt(objCustomer.AppPassword, appFunctions.strKey), txtPassword.Text, false) != 0) { DInfo.ShowMessage("Invalid user name or password.", Enums.MessageType.Error); } else { if (objCustomer.AppIsVerified) { httpCookie = new HttpCookie("FabyMartUsername", objEncrypt.Encrypt(txtEmail.Text, appFunctions.strKey)); httpCookie.Expires = DateTime.Today.AddDays(10); Response.Cookies.Add(httpCookie); httpCookie = new HttpCookie("FabyMartPassword", objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey)); httpCookie.Expires = DateTime.Today.AddDays(10); Response.Cookies.Add(httpCookie); Session[appFunctions.Session.ClientUserID.ToString()] = objCustomer.AppCustomerID; Session[appFunctions.Session.ClientUserName.ToString()] = objCustomer.AppFirstName + " " + objCustomer.AppLastName; objCommon = new clsCommon(); string strRedirect = objCommon.GetParameterFromUrl(Enums.Enums_URLParameterType.ByNumber, "1"); objCommon = null; Response.Redirect(objPageBase.GetAlias("Default.aspx")); } else { DInfo.ShowMessage("Your account is Not Verified.Plase verify it by your registered email address .", Enums.MessageType.Error); } } objEncrypt = null; } else { DInfo.ShowMessage("Invalid user name or password.", Enums.MessageType.Error); } objCustomer = null; } }
public bool SaveCustomer() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblCustomer", tblCustomer.ColumnNames.AppEmailID, tblCustomer.ColumnNames.AppCustomerID, txtEmailRegistration.Text)) { DisplayInfoRegistration.ShowMessage("Email address already exist.", Enums.MessageType.Error); return(false); } objCommon = null; tblCustomer objCustomer = new tblCustomer(); objCustomer.AddNew(); objCustomer.AppFirstName = txtFirstName.Text.Trim(); objCustomer.AppLastName = txtLastName.Text.Trim(); objCustomer.AppEmailID = txtEmailRegistration.Text.Trim(); objCustomer.AppMobile = txtMobile.Text; // objCustomer.AppAddress = txtAddress.Text; if (RbtnMale.Checked) { objCustomer.AppGender = true; } else { objCustomer.AppGender = false; } objEncrypt = new clsEncryption(); objCustomer.AppPassword = objEncrypt.Encrypt(txtPasswordRegistration.Text, appFunctions.strKey); objEncrypt = null; // objCustomer.AppIsNewsLetter = ChkSubsucribNewsLetter.Checked; objCustomer.AppIsActive = true; objCustomer.AppIsVerified = false; objCustomer.AppCreatedDate = GetDateTime(); objCustomer.Save(); // tblAddress objAdress = new tblAddress(); // objAdress.AddNew(); //// objAdress.AppAddress = txtAddress.Text; // objAdress.AppCustomerID = objCustomer.AppCustomerID; // objAdress.Save(); SendMail(objCustomer.s_AppCustomerID); objCustomer = null; return(true); }