Пример #1
0
    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);
    }
Пример #2
0
 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();
 }
Пример #3
0
    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);
    }
Пример #4
0
 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 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;
    }
Пример #6
0
 public void redirectToListing()
 {
     objEncrypt = new clsEncryption();
     if (hdnPageName.Value != "MasterMenusList.aspx")
     {
         if (ddlParent.SelectedValue != "0")
         {
             Response.Redirect("MenuItems.aspx?ID=" + objEncrypt.Encrypt(ddlParent.SelectedValue, appFunctions.strKey));
         }
         else
         {
             Response.Redirect("MenuItems.aspx?ID=" + objEncrypt.Encrypt(ddlMenuType.SelectedValue, appFunctions.strKey) + "&type=mtype");
         }
     }
     else
     {
         Response.Redirect("MasterMenus.aspx");
     }
 }
    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);
    }
Пример #8
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                oconn.Server   = txtServer.Text;
                oconn.User     = txtUsername.Text;
                oconn.Password = txtpassword.Text;
                oconn.Database = cboDatabase.Text;
                oconn.Port     = txtPort.Text;

                oconn.OpenTesting();
                XtraMessageBox.Show("Congratulation\n You have been connected to server : " + txtServer.Text, clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);

                oReg.SaveSetting("Server", txtServer.Text);
                oReg.SaveSetting("User", oEncryption.Encrypt(txtUsername.Text));
                oReg.SaveSetting("Password", oEncryption.Encrypt(txtpassword.Text));
                oReg.SaveSetting("Database", cboDatabase.Text);
                oReg.SaveSetting("Port", txtPort.Text);

                oconn.Server   = oReg.getSetting("Server");
                oconn.User     = oReg.getSetting("User");
                oconn.Password = oReg.getSetting("Password");
                oconn.Database = oReg.getSetting("Database");
                oconn.Port     = oReg.getSetting("Port");

                clsGlobal.str_Server   = oconn.Server;
                clsGlobal.str_User     = txtUsername.Text;
                clsGlobal.str_Password = txtpassword.Text;
                clsGlobal.str_Database = oconn.Database;
                clsGlobal.str_Port     = oconn.Port;

                oconn.Close();
                this.Dispose();
            }
            catch (Exception ee)
            {
                XtraMessageBox.Show("Could not connect to the server .!\nCall Your System Administrator\n", clsGlobal.str_ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #9
0
    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");
        }
    }
Пример #10
0
    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);
    }
Пример #11
0
    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);
    }
Пример #12
0
    public bool SaveCustomer()
    {
        tblCustomer objCustomer = new tblCustomer();

        if (objCustomer.LoadByPrimaryKey(Convert.ToInt32(Session[appFunctions.Session.ClientUserID.ToString()].ToString())))
        {
            objEncrypt = new clsEncryption();
            if (string.Compare(objEncrypt.Decrypt(objCustomer.AppPassword, appFunctions.strKey), txtOldPassword.Text, false) != 0)
            {
                DInfo.ShowMessage("Old password is incorrect", Enums.MessageType.Warning);
                return(false);
            }
            objCustomer.AppPassword = objEncrypt.Encrypt(txtNewRetryPassword.Text, appFunctions.strKey);
            objEncrypt = null;
            objCustomer.Save();
        }
        objCustomer = null;
        return(true);
    }
Пример #13
0
    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.AppIsActive    = true;
        objCustomer.AppIsVerified  = true;
        objCustomer.AppCreatedDate = GetDateTime();
        objCustomer.Save();

        HttpContext.Current.Session[appFunctions.Session.ClientUserID.ToString()]   = objCustomer.AppCustomerID;
        HttpContext.Current.Session[appFunctions.Session.ClientUserName.ToString()] = objCustomer.AppFirstName + " " + objCustomer.AppLastName;

        objCustomer = null;
        return(true);
    }
Пример #14
0
 public void SendMail(string strId)
 {
     try
     {
         objCommon = new clsCommon();
         string Strbody    = "";
         string strSubject = "Account Activation Process";
         Strbody    = objCommon.readFile(Server.MapPath("~/EmailTemplates/NewUserMail.html"));
         Strbody    = Strbody.Replace("`link`", strServerURL);
         Strbody    = Strbody.Replace("`uname`", txtFirstName.Text + " " + txtLastName.Text);
         objEncrypt = new clsEncryption();
         Strbody    = Strbody.Replace("`linkActive`", GetAlias("Approved.aspx") + objEncrypt.Encrypt(strId, appFunctions.strKey));
         objEncrypt = null;
         objCommon.SendConfirmationMail(txtEmailRegistration.Text, strSubject, Strbody, Enums.Enum_Confirmation_Mail_type.register);
         //objCommon.SendMail(txtEmailRegistration.Text, strSubject, Strbody);
         objCommon = null;
     }
     catch (Exception ex)
     {
         Response.Write(ex.StackTrace.ToString());
     }
 }
Пример #15
0
    private bool SaveData()
    {
        objSettings           = new tblSettings();
        objEncrypt            = new clsEncryption();
        objSettings.Query.Top = 1;
        objSettings.Query.Load();
        if (objSettings.RowCount == 0)
        {
            objSettings = new tblSettings();
            objSettings.AddNew();
            objSettings.AppCreatedDate = DateTime.Now;
            objSettings.s_AppCreatedBy = Session[appFunctions.Session.UserID.ToString()].ToString();
        }
        objSettings.AppSiteName             = txtSiteName.Text;
        objSettings.AppFooterText           = txtFooter.Text;
        objSettings.AppIsSiteOffline        = chkSiteOffline.Checked;
        objSettings.AppSiteOfflineMessage   = txtSiteOfflineMessage.Text;
        objSettings.AppSiteTagLine          = txtSiteTagLine.Text;
        objSettings.AppSiteDefaultListLimit = ddlPerMenu.SelectedValue;
        objSettings.AppPathToFolder         = txtPathToFolder.Text;
        objSettings.AppIsCOD = CHkIsCOD.Checked;
        if (txtClientSiteUrl.Text.Contains("http://"))
        {
            objSettings.AppClientSiteURL = txtClientSiteUrl.Text;
        }
        else
        {
            objSettings.AppClientSiteURL = "http://" + txtClientSiteUrl.Text;
        }

        objSettings.AppEmailPassword  = objEncrypt.Encrypt(txtEmailPassword.Text, appFunctions.strKey);
        objSettings.AppSMTP           = txtSMTP.Text;
        objSettings.AppSiteEmail      = txtSiteEmail.Text;
        objSettings.AppRecepientEmail = txtRecepientEmail.Text;
        objSettings.AppPortNumber     = txtPortNumber.Text;
        string strFilePath = Server.MapPath("~/Uploads/ConfigurationsSetting");

        if (FileUploadOfflineImage.HasFile)
        {
            FileUploadOfflineImage.SaveAs(strFilePath + "/Offline.jpg");
            objSettings.AppSiteOfflineImage = "Uploads/ConfigurationsSetting/Offline.jpg";
        }

        if (FileUploadLogo.HasFile)
        {
            FileUploadLogo.SaveAs(strFilePath + "/Logo.jpg");
            objSettings.AppSiteLogo = "Uploads/ConfigurationsSetting/Logo.jpg";
        }

        if (FileUploadFavicon.HasFile)
        {
            FileUploadFavicon.SaveAs(strFilePath + "/Favicon.ico");
            objSettings.AppSiteFavicon = "Uploads/ConfigurationsSetting/Favicon.ico";
        }


        //if (chkDataBaseSettings.Checked)
        //{
        //    SaveDataBaseSettings();
        //}

        objSettings.Save();
        SetUpSiteSettings();


        objSettings = null;
        return(true);
    }
Пример #16
0
    protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            clsEncryption objEncrypt    = new clsEncryption();
            int           intHiddenPKID = 0;

            if (!string.IsNullOrEmpty(hdnPKID.Value))
            {
                intHiddenPKID = Convert.ToInt32(hdnPKID.Value);
            }

            objCommon     = new clsCommon();
            hdnPKID.Value = e.CommandArgument.ToString();

            if (e.CommandName == "ListChildMenus")
            {
                Response.Redirect("Tab.aspx?ID=" + objEncrypt.Encrypt(hdnPKID.Value, appFunctions.strKey), true);
            }
            //else if (e.CommandName == "Edit")
            //{
            //    Response.Redirect("TabDetail.aspx?ID=" + objEncrypt.Encrypt(hdnPKID.Value, appFunctions.strKey), true);
            //}
            else if (e.CommandName == "Up")
            {
                LinkButton inkButton = (LinkButton)e.CommandSource;

                GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;

                if (drCurrent.RowIndex > 0)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1];
                    objCommon.SetDisplayOrder("tblTab", tblTab.ColumnNames.AppTabID, tblTab.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[5], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[5]);
                    hdnPKID.Value = intHiddenPKID.ToString();
                    LoadDataGrid(false, false);
                    objCommon = null;
                }

                hdnPKID.Value = intHiddenPKID.ToString();
            }
            else if (e.CommandName == "Down")
            {
                LinkButton lnkButton = (LinkButton)e.CommandSource;

                GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;

                if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1];
                    objCommon.SetDisplayOrder("tblTab", tblTab.ColumnNames.AppTabID, tblTab.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[5], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[5]);
                    hdnPKID.Value = intHiddenPKID.ToString();
                    LoadDataGrid(false, false);
                    objCommon = null;
                }

                hdnPKID.Value = intHiddenPKID.ToString();
            }
            else if (e.CommandName == "IsActive")
            {
                objtab = new tblTab();

                objtab.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));

                if (objtab.AppIsActive == true)
                {
                    objtab.AppIsActive = false;
                }
                else if (objtab.AppIsActive == false)
                {
                    objtab.AppIsActive = true;
                }

                objtab.Save();
                LoadDataGrid(false, false, "", "");
            }
            else if (e.CommandName == "IsAdd")
            {
                objtab = new tblTab();


                objtab.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));

                if (objtab.AppIsAdd == true)
                {
                    objtab.AppIsAdd = false;
                }
                else if (objtab.AppIsAdd == false)
                {
                    objtab.AppIsAdd = true;
                }

                objtab.Save();
                LoadDataGrid(false, false, "", "");
            }
            else if (e.CommandName == "IsEdit")
            {
                objtab = new tblTab();

                objtab.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));

                if (objtab.AppIsEdit == true)
                {
                    objtab.AppIsEdit = false;
                }
                else if (objtab.AppIsEdit == false)
                {
                    objtab.AppIsEdit = true;
                }

                objtab.Save();
                LoadDataGrid(false, false, "", "");
            }
            else if (e.CommandName == "IsDelete")
            {
                objtab = new tblTab();

                objtab.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));

                if (objtab.AppIsDelete == true)
                {
                    objtab.AppIsDelete = false;
                }
                else if (objtab.AppIsDelete == false)
                {
                    objtab.AppIsDelete = true;
                }

                objtab.Save();
                LoadDataGrid(false, false, "", "");
            }
            else if (e.CommandName == "IsDashbord")
            {
                objtab = new tblTab();

                objtab.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));

                if (objtab.AppIsShowOnDashboard == true)
                {
                    objtab.AppIsShowOnDashboard = false;
                }
                else if (objtab.AppIsShowOnDashboard == false)
                {
                    objtab.AppIsShowOnDashboard = true;
                }

                objtab.Save();
                LoadDataGrid(false, false, "", "");
            }
        }
    }
Пример #17
0
    public void GenerateAlias(int intId)
    {
        DataTable   dt;
        tblMenuType objMenuType = new tblMenuType();

        objMenuItem = new tblMenuItem();
        objEncrypt  = new clsEncryption();
        dt          = objMenuItem.GetSiteMap(intId);
        strSiteMap  = dt.Rows[0][0].ToString().Trim('/');
        if (hdnMenuTypeId.Value == "")
        {
            dt = objMenuItem.GetMenuType(intId, false);
        }
        else
        {
            dt = objMenuItem.GetMenuType(Convert.ToInt32(hdnMenuTypeId.Value), true);
        }
        string[] SplitSiteMapString = strSiteMap.Split('/');
        objMenuType.Where.AppMenuTypeId.Value = ddlMenuType.SelectedValue;
        objMenuType.Query.Load();
        strSiteMap = "<a href='MasterMenus.aspx'>Menu Items</a>";
        if (objMenuType.RowCount > 0)
        {
            strSiteMap += " >  <a href=MenuItems.aspx?Id=" + objEncrypt.Encrypt(dt.Rows[0]["appMenuTypeId"].ToString(), appFunctions.strKey) + "&type=mtype>" + dt.Rows[0]["appMenuTypeName"].ToString() + "</a>";
        }
        if (objMenuType.AppNoOfLevel > SplitSiteMapString.Length - 1)
        {
            for (int i = 0; i <= SplitSiteMapString.Length - 1; i++)
            {
                string[] SplittedItems = SplitSiteMapString[i].Split(',');
                aliasPrefix += SplittedItems[0] + "/";
                if (i == SplitSiteMapString.Length - 1)
                {
                    strSiteMap += " > " + SplittedItems[0];
                }
                else
                {
                    strSiteMap += "> <a href='MenuItems.aspx?Id=" + objEncrypt.Encrypt(SplittedItems[1].ToString(), appFunctions.strKey) + "'>" + SplittedItems[0].ToString() + "</a>";
                }
            }
            siteMapLiteral.Text = strSiteMap.ToString();
            if (aliasPrefix.Length > 0)
            {
                aliasPrefix = aliasPrefix.Substring(0, aliasPrefix.Length - 1);
                aliasPrefix = aliasPrefix.Substring(0, aliasPrefix.LastIndexOf("/") + 1);
            }
            hdnAliasPrefix.Value = aliasPrefix.Replace(" ", "-");
        }
        else
        {
            Session[appFunctions.Session.ShowMessage.ToString()]     = "You Can't Add Menu Item For This Level As Maximum No. Of Level Is " + objMenuType.AppNoOfLevel.ToString();
            Session[appFunctions.Session.ShowMessageType.ToString()] = Enums.MessageType.Error;

            if (Request.QueryString.Get("PID") != null)
            {
                Response.Redirect("MenuItems.aspx?Id=" + Request.QueryString.Get("PID"), true);
            }
            else if (Request.QueryString.Get("TID") != null)
            {
                Response.Redirect("MenuItems.aspx?Id=" + Request.QueryString.Get("TID") + "&type=mtype", true);
            }
            else if (hdnPKID.Value == "")
            {
                Response.Redirect("Dashboard.aspx");
            }
        }
        objMenuItem = null;
        objMenuType = null;
    }
Пример #18
0
        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);
            }
        }
Пример #19
0
    public void SendMail(string strId)
    {
        try
        {
            objCommon = new clsCommon();
            string Strbody    = "";
            string strSubject = "Registration Detail";
            Strbody = objCommon.readFile(Server.MapPath("~/EmailTemplates/NewUserMail.html"));
            Strbody = Strbody.Replace("`uname`", txtFirstName.Text + " " + txtLastName.Text);
            Strbody = Strbody.Replace("`username`", txtEmail.Text.Trim());
            Strbody = Strbody.Replace("`password`", txtPassword.Text);

            objEncrypt = new clsEncryption();
            Strbody    = Strbody.Replace("`Link`", PageBase.GetServerURL() + "/Approved.aspx?CID=" + objEncrypt.Encrypt(strId, appFunctions.strKey));
            objEncrypt = null;
            objCommon.SendMail(txtEmail.Text, strSubject, Strbody);
            objCommon = null;
        }
        catch (Exception ex)
        {
            Response.Write(ex.StackTrace.ToString());
        }
    }
Пример #20
0
    public void SetMenu()
    {
        tblPermission objPermisssion = new tblPermission();
        //Change for manu and sub menu load

        DataTable DtTab = new DataTable();

        objRole = new tblRole();

        DtTab = objRole.LoadPermissionTabMenu(Session[appFunctions.Session.RoleID.ToString()].ToString(), 0.ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]);

        for (int i = 0; i <= DtTab.Rows.Count - 1; i++)
        {
            if ((bool)DtTab.Rows[i]["AppIsMenu"])
            {
                menuString += "<li><a href='#'>" + DtTab.Rows[i]["AppTabName"];
                objMenuType = new tblMenuType();
                DataTable menutypeDt = new DataTable();
                menutypeDt = objMenuType.LoadMenuTypes();

                menuString += "</a> ";
                //loadmenuChild(menutypeDt, 2, "0", true);
                menuString += "<ul>";
                for (int j = 0; j <= menutypeDt.Rows.Count - 1; j++)
                {
                    menuString += "<li><a href='MenuItems.aspx?ID=" + objEncrypt.Encrypt(menutypeDt.Rows[j]["appMenuTypeId"].ToString(), appFunctions.strKey) + "&type=mtype'>" + menutypeDt.Rows[j]["appMenuTypeName"].ToString();
                    menuString += "</a>";
                    menuString += "</li>";
                }

                menuString += "</ul>";
                menuString += "</li>";
            }
            else
            {
                DataTable DtChildTab = new DataTable();
                objRole = new tblRole();

                DtChildTab = objRole.LoadPermissionTabMenu(Session[appFunctions.Session.RoleID.ToString()].ToString(), DtTab.Rows[i]["AppTabID"].ToString(), "", (bool)Session[appFunctions.Session.IsSuperAdmin.ToString()]);

                menuString += "<li><a href='" + DtTab.Rows[i]["appWebPageName"] + "'>" + DtTab.Rows[i]["AppTabName"];

                menuString += "</a> ";

                loadchildmenu(DtChildTab, 2);

                //if ((bool)DtTab.Rows[i]["AppIsMenu"] == true)
                //{

                //    loadchildmenu(DtTab.Rows(i)("AppTabID").ToString, DtTab.Rows(i)("AppIsMenu"), DtTab.Rows(i)("AppIsTabAdd"), DtTab.Rows(i)("AppIsTabEdit"));
                //}
                //else
                //{
                //    menuString += "<li><a class='menuLink' id='" + DtTab.Rows(i)("AppTabID").ToString + "' href='" + DtTab.Rows(i)("appWebPageName") + "'>" + DtTab.Rows(i)("AppTabName") + "</a>";
                //    loadchildmenu(DtTab.Rows(i)("AppTabID").ToString, DtTab.Rows(i)("AppIsMenu"), DtTab.Rows(i)("AppIsTabAdd"), DtTab.Rows(i)("AppIsTabEdit"));
                //}
                menuString += "</li>";
            }
        }

        litMainMenu.Text = menuString;
    }
Пример #21
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        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)
            {
                lblForError.InnerText = "Invalid Email or Password.";
                //DInfo.ShowMessage("Invalid User Name or Password.", Enums.MessageType.Error);
            }
            else
            {
                if (objCustomer.AppIsVerified)
                {
                    if (chkRemeberMe.Checked)
                    {
                        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);
                    }
                    else
                    {
                        httpCookie         = new HttpCookie("FabyMartUsername", "");
                        httpCookie.Expires = DateTime.Today.AddDays(0);
                        Response.Cookies.Add(httpCookie);
                        httpCookie         = new HttpCookie("FabyMartPassword", "");
                        httpCookie.Expires = DateTime.Today.AddDays(0);
                        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;
                    if (strRedirect != "")
                    {
                        if (strRedirect == "Cart")
                        {
                            Response.Redirect(GetAlias("Cart.aspx"));
                        }
                        else if (strRedirect == "wishlist")
                        {
                            Response.Redirect(GetAlias("MyFavouriteProduct.aspx"));
                        }
                        else if (strRedirect == "TrackOrder")
                        {
                            Response.Redirect(GetAlias("TrackOrder.aspx"));
                        }
                        else if (strRedirect == "WishList")
                        {
                            Response.Redirect(GetAlias("MyFavouriteProduct.aspx"));
                        }
                        else if (strRedirect == "order")
                        {
                            Response.Redirect(GetAlias("order.aspx"));
                        }
                        else
                        {
                            Response.Redirect(GetAlias("Default.aspx"));
                        }
                    }
                    else
                    {
                        Response.Redirect(GetAlias("Default.aspx"));
                    }
                }
                else
                {
                    DInfo.ShowMessage("Your account is not verified, Please check your email to verify or contact to support", Enums.MessageType.Error);
                }
            }
            objEncrypt = null;
        }
        else
        {
            lblForError.InnerText = "Invalid Email or Password";
            // DInfo.ShowMessage("Invalid User Name or Password.", Enums.MessageType.Error);
        }
        objCustomer = null;
    }
Пример #22
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!IsPostBack)
        {
            ifError = false;
            ViewState["SortOrder"]  = appFunctions.Enum_SortOrderBy.Asc;
            ViewState["SortColumn"] = "";

            btnAdd.Visible    = HasAdd;
            btnDelete.Visible = HasDelete;
            dgvGridView.Columns[0].Visible = HasDelete;
            dgvGridView.Columns[1].Visible = HasEdit;
            dgvGridView.Columns[5].Visible = HasEdit;

            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
                {
                    hdnPKID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey);
                    intSiteMapId  = Convert.ToInt32(hdnPKID.Value);
                }
                catch (Exception ex)
                {
                    // noIdFoundRedirect("Employee.aspx");
                }

                objEncrypt = null;
                if ((Request.QueryString.Get("type") != null))
                {
                    if ((Request.QueryString.Get("type") == "mtype"))
                    {
                        hdnType.Value = "mtype";
                    }
                    else
                    {
                        hdnType.Value = "";
                    }
                }
                else
                {
                    hdnType.Value = "";
                }
            }
            if (intSiteMapId != -1)
            {
                DataTable dt = new DataTable();

                objEncrypt = new clsEncryption();
                dynamic objTempMenuItem = new tblMenuItem();
                if (hdnType.Value == "")
                {
                    dt             = objTempMenuItem.GetSiteMap(intSiteMapId);
                    strSiteMapData = dt.Rows[0][0].ToString();
                    dt             = objTempMenuItem.GetMenuType(intSiteMapId, false);
                }
                else
                {
                    dt = objTempMenuItem.GetMenuType(intSiteMapId, true);
                }

                String[] SplitSiteMapString = strSiteMapData.Split('/');

                strSiteMap = "<a href='MasterMenus.aspx'>Menu Items</a>";

                if (SplitSiteMapString.Length > 1)
                {
                    strSiteMap += " >  <a href=MenuItems.aspx?Id=" + objEncrypt.Encrypt(dt.Rows[0]["appMenuTypeId"].ToString(), appFunctions.strKey) + "&type=mtype>" + dt.Rows[0]["appMenuTypeName"].ToString() + "</a>";
                    //strSiteMap = "<a href='MenuItems.aspx'>Parent Tabs </a>";
                }
                else
                {
                    strSiteMap += " > " + dt.Rows[0]["appMenuTypeName"].ToString();
                }

                for (int i = 0; i <= SplitSiteMapString.Length - 2; i += 1)
                {
                    String[] SplittedItems = SplitSiteMapString.GetValue(i).ToString().Split(',');
                    if (i == SplitSiteMapString.Length - 2)
                    {
                        strSiteMap += " > " + SplittedItems.GetValue(0);
                    }
                    else
                    {
                        strSiteMap += " > <a href='MenuItems.aspx?Id=" + objEncrypt.Encrypt(SplittedItems.GetValue(1).ToString(), appFunctions.strKey) + "'> " + SplittedItems.GetValue(0) + "</a>";
                    }
                }

                litSiteMap.Text = strSiteMap;
            }

            LoadDataGrid(true, false);
            txtSearch.Focus();
            objCommon = null;
        }
    }
Пример #23
0
    protected void btnLogIn_Click(object sender, System.EventArgs e)
    {
        clsEncryption objEncrypt = new clsEncryption();

        objAdminUser = new tblUser();
        objAdminUser.Where.AppUserName.Value = txtUserName.Text;

        try
        {
            objAdminUser.Where.AppPassword.Value = objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey.ToString());
        }
        catch (Exception ex)
        {
            lblMsg.Text = "Invalid Username or Password";
            SaveLog(false);
            return;
        }

        objAdminUser.Query.Load();


        if (objAdminUser.RowCount > 0)
        {
            if (objAdminUser.AppIsActive)
            {
                if (chkRemeber.Checked)
                {
                    httpCookie         = new HttpCookie("JetAPIAdminUsername", objEncrypt.Encrypt(txtUserName.Text, appFunctions.strKey));
                    httpCookie.Expires = DateTime.Today.AddDays(10);
                    Response.Cookies.Add(httpCookie);

                    httpCookie         = new HttpCookie("JetAPIAdminPassword", objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey));
                    httpCookie.Expires = DateTime.Today.AddDays(10);
                    Response.Cookies.Add(httpCookie);
                }
                else
                {
                    httpCookie         = new HttpCookie("JetAPIAdminUsername", "");
                    httpCookie.Expires = DateTime.Today.AddDays(0);
                    Response.Cookies.Add(httpCookie);

                    httpCookie         = new HttpCookie("JetAPIAdminPassword", "");
                    httpCookie.Expires = DateTime.Today.AddDays(0);
                    Response.Cookies.Add(httpCookie);
                }

                Session[appFunctions.Session.UserID.ToString()]       = objAdminUser.AppUserId;
                Session[appFunctions.Session.RoleID.ToString()]       = objAdminUser.AppRoleId;
                Session[appFunctions.Session.UserName.ToString()]     = objAdminUser.AppUserName;
                Session[appFunctions.Session.EmployeeName.ToString()] = objAdminUser.AppFullName;
                Session[appFunctions.Session.IsSuperAdmin.ToString()] = objAdminUser.AppIsSuperAdmin;


                objAdminUser.AppLastLoginTime = DateTime.Now;
                objAdminUser.Save();
                SaveLog(true);

                if ((bool)Session[appFunctions.Session.IsSuperAdmin.ToString()] == false)
                {
                    tblPermission objPermission = new tblPermission();

                    bool hasDashboardPermission = objPermission.CheckDeshbordTab(Session[appFunctions.Session.RoleID.ToString()].ToString());  //objPermission.CheckDeshbordTab(Session[appFunctions.Session.RoleID.ToString()].ToString());
                    if (hasDashboardPermission)
                    {
                        Response.Redirect("Dashboard.aspx");
                    }
                    else
                    {
                        Response.Redirect("UserPanel.aspx");
                    }
                }
                else
                {
                    Response.Redirect("Dashboard.aspx");
                }
            }
            else
            {
                lblMsg.Text = "Your account is disabled, Contact to administrator.";
                SaveLog(false);
            }
        }
        else
        {
            lblMsg.Text = "Invalid Username or Password";
            SaveLog(false);
        }
    }
Пример #24
0
        private void gridViewData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    string strID          = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId));
                    string strPassword    = Convert.ToString(gridViewData.GetFocusedRowCellValue(colPassword));
                    string strUsername    = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUsername));
                    string strCount       = clsGlobal.getData1Field("select count(*) from tbm_users where dlt='0' and trim(lower(username))=trim(lower('" + Convert.ToString(gridViewData.GetFocusedRowCellValue(colUsername)) + "')) and userid<>'" + strID + "'");
                    string strGetPassword = clsGlobal.getData1Field("select password from tbm_users where userid='" + strID + "'");
                    string strGetUsername = clsGlobal.getData1Field("select username from tbm_users where userid='" + strID + "'");

                    if (Convert.ToInt32(strCount) == 0)
                    {
                        tbm_users oObject = new tbm_users();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(strID))
                        {
                            oObject.GetByPrimaryKey(strID);
                        }
                        clsEncryption oEncryption = new clsEncryption();
                        if (strPassword == strGetPassword)
                        {
                            oObject.password = strGetPassword;
                        }
                        else
                        {
                            oObject.password = oEncryption.Encrypt(strPassword);
                        }
                        if (strUsername == strGetUsername)
                        {
                            oObject.username = strGetUsername;
                        }
                        else
                        {
                            oObject.username = oEncryption.Encrypt(strUsername);
                        }
                        oObject.userid     = Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId));
                        oObject.fullname   = Convert.ToString(gridViewData.GetFocusedRowCellValue(colFullname));
                        oObject.email      = Convert.ToString(gridViewData.GetFocusedRowCellValue(colEmail));
                        oObject.groupusers = Convert.ToString(gridViewData.GetFocusedRowCellValue(colGroupUsers)).ToLower();
                        if (oObject.username == "" || oObject.password == "" || oObject.fullname == "" || oObject.email == "" || oObject.groupusers == "")
                        {
                            XtraMessageBox.Show("Data Can't Be Null", "Warning");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(strID))
                            {
                                oObject.userid = oObject.NewID();
                                oObject.active = true;
                                oObject.opadd  = clsGlobal.strUserName;
                                oObject.pcadd  = SystemInformation.ComputerName;
                                oObject.luadd  = DateTime.Now;
                                oObject.Insert();
                                gridViewData.SetFocusedRowCellValue(colUserId, oObject.userid);
                            }
                            else
                            {
                                oObject.active = Convert.ToBoolean(gridViewData.GetFocusedRowCellValue(colActive));
                                oObject.opedit = clsGlobal.strUserName;
                                oObject.pcedit = SystemInformation.ComputerName;
                                oObject.Update();
                            }
                            oObject = null;
                            e.Valid = true;
                        }
                    }
                    else
                    {
                        e.ErrorText = "This code " + Convert.ToString(gridViewData.GetFocusedRowCellValue(colUserId)) + " already exists in database and cannot be filled the same value.!\n";
                        gridViewData.FocusedColumn = colUsername;
                        e.Valid = false;
                        return;
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
            catch (Exception ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
        }
Пример #25
0
    protected void DataListSubOrder_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandArgument.ToString() != "")
        {
            if (e.CommandName == "ReturnAddress")
            {
                hdnReturnOrderID.Value = e.CommandArgument.ToString();
                tblReturnOrder objReturnOrder = new tblReturnOrder();
                if (objReturnOrder.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    if (objReturnOrder.AppReturnStatus == Convert.ToInt32(Enums.Enum_ReturnStatus.Slip) && objReturnOrder.s_AppDocketNo != "")
                    {
                        if (objReturnOrder.AppReturnStatus == Convert.ToInt32(Enums.Enum_ReturnStatus.Approved))
                        {
                            objReturnOrder.AppReturnStatus = Convert.ToInt32(Enums.Enum_ReturnStatus.Slip);
                            objReturnOrder.Save();
                        }
                        objEncrypt             = new clsEncryption();
                        hdnReturnOrderID.Value = GetAlias("Productslip.aspx") + objEncrypt.Encrypt(objReturnOrder.s_AppReturnOrderID, appFunctions.strKey);
                        objEncrypt             = null;
                        ScriptManager.RegisterStartupScript(UpMain, UpMain.GetType(), "myFunction", "CallProductInvoice();", true);
                    }
                    else
                    {
                        if (objReturnOrder.s_AppDocketNo != "")
                        {
                            txtDocketNo.Text    = objReturnOrder.s_AppDocketNo;
                            txtDocketNo.Enabled = false;
                        }
                        else
                        {
                            ddlCourierCompany.SelectedIndex = 0;
                            txtCourierContactNo.Text        = "";
                            txtSiteName.Text    = "";
                            txtDocketNo.Text    = "";
                            txtDocketNo.Enabled = true;
                        }

                        Mpeslip.Show();
                    }
                    //  Mpeslip.Show();
                }
                objReturnOrder = null;
            }
            if (e.CommandName == "ReturnRequest")
            {
                tblSubOrder objTempSubOrder = new tblSubOrder();
                objDataTable = objTempSubOrder.GetProductInvoiceInfo(e.CommandArgument.ToString());
                if (objDataTable.Rows.Count > 0)
                {
                    hdnPrevStatus.Value   = objDataTable.Rows[0][tblSubOrder.ColumnNames.AppSubOrderStatusID].ToString();
                    txtPickupName.Text    = objDataTable.Rows[0][tblOrder.ColumnNames.AppReceiverName].ToString();
                    txtPickupAddress.Text = objDataTable.Rows[0][tblOrder.ColumnNames.AppReceiverAddress].ToString();
                    txPickupMobile1.Text  = objDataTable.Rows[0][tblOrder.ColumnNames.AppReceiverContactNo1].ToString();
                    txtPickupMobile2.Text = objDataTable.Rows[0][tblOrder.ColumnNames.AppReceiverContactNo2].ToString();
                    txtPickupPIN.Text     = objDataTable.Rows[0][tblOrder.ColumnNames.AppReceiverPIN].ToString();
                }
                objTempSubOrder = null;

                MpeReturnRequest.Show();
            }
            if (e.CommandName == "Dispatch")
            {
                tblReturnOrder objReturnOrder = new tblReturnOrder();
                if (objReturnOrder.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    objReturnOrder.AppReturnStatus = Convert.ToInt32(Enums.Enum_ReturnStatus.Dispatched);
                    objReturnOrder.Save();
                    objReturnOrder = null;
                }
                LoadMyorderList();
            }
        }
    }
Пример #26
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["SortOrder"]  = appFunctions.Enum_SortOrderBy.Asc;
            ViewState["SortColumn"] = "";


            ifError           = false;
            btnAdd.Visible    = HasAdd;
            btnDelete.Visible = HasDelete;
            dgvGridView.Columns[0].Visible = HasDelete;
            dgvGridView.Columns[1].Visible = HasEdit;
            dgvGridView.Columns[4].Visible = HasEdit;
            dgvGridView.Columns[5].Visible = HasEdit;
            dgvGridView.Columns[6].Visible = HasEdit;
            dgvGridView.Columns[7].Visible = HasEdit;
            dgvGridView.Columns[8].Visible = HasEdit;

            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);
            //  objCommon.FillDropDownList(ddlParents, "tblTab", tblTab.ColumnNames.AppTabName, tblTab.ColumnNames.AppTabID, "--Select Parent--", tblTab.ColumnNames.AppDisplayOrder, appFunctions.Enum_SortOrderBy.Asc, "appParentId = 0")

            if ((Request.QueryString.Get("ID") != null))
            {
                objEncrypt            = new clsEncryption();
                hdnCurrentTabID.Value = objEncrypt.Decrypt(Request.QueryString.Get("ID"), appFunctions.strKey);
                intSiteMapId          = Convert.ToInt32(hdnCurrentTabID.Value);
            }

            if (intSiteMapId != -1)
            {
                DataTable dt = new DataTable();

                objEncrypt = new clsEncryption();
                dynamic objTempTab = new tblTab();
                dt             = objTempTab.GetSiteMap(intSiteMapId);
                strSiteMapData = dt.Rows[0][0].ToString();

                dt = objTempTab.GetMenuType(intSiteMapId);

                String[] SplitSiteMapString = strSiteMapData.Split('/');
                if (SplitSiteMapString.Length > 1)
                {
                    strSiteMap = "<a href='Tab.aspx'>Parent Tabs </a>";
                }
                else
                {
                    strSiteMap = "Parent Tabs";
                }

                for (int i = SplitSiteMapString.Length - 2; i >= 0; i += -1)
                {
                    String[] SplittedItems = SplitSiteMapString.GetValue(i).ToString().Split(',');

                    //If i = 0 Then
                    //    strSiteMap = "<a href=TabsList.aspx?Id=" + objEncrypt.Encrypt(dt.Rows(0).Item("appTabID"), appFunctions.strKey) + "&type=mtype>" + dt.Rows(0).Item("appTabName") + "</a>"
                    //End If
                    //If i <> SplitSiteMapString.Length - 2 Then
                    //    strSiteMap += " > "
                    //End If
                    if (i == 0)
                    {
                        strSiteMap += " > " + SplittedItems.GetValue(0);
                    }
                    else
                    {
                        strSiteMap += " > <a href='Tab.aspx?Id=" + objEncrypt.Encrypt(SplittedItems.GetValue(1).ToString(), appFunctions.strKey) + "'>" + SplittedItems.GetValue(0) + "</a>";
                    }
                }

                litSiteMap.Text = strSiteMap;
            }
            LoadDataGrid(true, false);
            txtSearch.Focus();
            objCommon = null;
        }
    }