Exemplo n.º 1
0
 /// <summary>
 /// Function to fill the values in curresponding controls for updation
 /// </summary>
 public void FillControls()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser              = spUser.UserView(decUserId);
         txtUserName.Text      = infoUser.UserName;
         txtPassword.Text      = infoUser.Password;
         cmbRole.SelectedValue = infoUser.RoleId;
         txtNarration.Text     = infoUser.Narration;
         if (infoUser.Active)
         {
             cbxActive.Checked = true;
         }
         else
         {
             cbxActive.Checked = false;
         }
         txtRetype.Text = txtPassword.Text;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Start a login
        /// </summary>
        public void Login()
        {
            try
            {
                UserSP      spUser      = new UserSP();
                CompanySP   spCompany   = new CompanySP();
                CompanyInfo infoCompany = new CompanyInfo();
                string      strUserName = txtUserName.Text.Trim();
                string      strPassword = spUser.LoginCheck(strUserName);

                if (strPassword == txtPassword.Text.Trim() && strPassword != string.Empty)
                {
                    int inUserId = spUser.GetUserIdAfterLogin(strUserName, strPassword);
                    PublicVariables._decCurrentUserId = inUserId;
                    infoCompany = spCompany.CompanyView(1);
                    PublicVariables._decCurrencyId = infoCompany.CurrencyId;
                    formMDI.MDIObj.CallFromLogin();
                    SettingsCheck();
                    //for Quock Launch menu
                    formMDI.MDIObj.ShowQuickLaunchMenu();
                    formMDI.MDIObj.CurrentSettings();
                    //Display ChangeCurrentDate form//
                    frmChangeCurrentDate frmCurrentDateChangeObj = new frmChangeCurrentDate();
                    frmCurrentDateChangeObj.MdiParent = formMDI.MDIObj;
                    frmCurrentDateChangeObj.CallFromLogin(this);
                    formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]";
                    // For showing the OpenMiracle message from the website
                    formMDI.MDIObj.logoutToolStripMenuItem.Enabled = true;
                    if (PublicVariables.MessageToShow != string.Empty)
                    {
                        frmMessage frmMsg = new frmMessage();
                        frmMsg.lblHeading.Text = PublicVariables.MessageHeadear;
                        frmMsg.lblMessage.Text = PublicVariables.MessageToShow;
                        frmMsg.MdiParent       = formMDI.MDIObj;
                        frmMsg.Show();
                        frmMsg.Location = new Point(0, formMDI.MDIObj.Height - 270);
                        foreach (Form form in Application.OpenForms)
                        {
                            if (form.GetType() == typeof(frmChangeCurrentDate))
                            {
                                form.Focus();
                            }
                        }
                    }
                }
                else
                {
                    Messages.InformationMessage("Invalid username or password");
                    Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("LOGIN02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Function to Update values in account group Table
        /// </summary>
        /// <param name="userinfo"></param>
        public void UserEdit(UserInfo infoUser)
        {
            UserSP spUser = new UserSP();

            try
            {
                spUser.UserEdit(infoUser);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Function to delete particular details based on the parameter
        /// </summary>
        /// <param name="UserId"></param>
        public void UserDelete(decimal UserId)
        {
            UserSP spUser = new UserSP();

            try
            {
                spUser.UserDelete(UserId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Function to Get UserId After Login based on parameter
        /// </summary>
        /// <param name="strUserName"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public int GetUserIdAfterLogin(string strUserName, string strPassword)
        {
            UserSP spUser   = new UserSP();
            int    inUserId = 0;

            try
            {
                inUserId = spUser.GetUserIdAfterLogin(strUserName, strPassword);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(inUserId);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Function to view all details from user Table based on parameter
        /// </summary>
        /// <param name="strUserName"></param>
        /// <param name="strRole"></param>
        /// <returns></returns>
        public List <DataTable> UserCreationViewForGridFill(string strUserName, string strRole)
        {
            UserSP           spUser  = new UserSP();
            List <DataTable> ListObj = new List <DataTable>();

            try
            {
                ListObj = spUser.UserCreationViewForGridFill(strUserName, strRole);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(ListObj);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Add user of group
 /// </summary>
 /// <param name="web"></param>
 /// <param name="groupName">SharePoint group name </param>
 /// <param name="user"></param>
 /// <returns></returns>
 public static bool AddUserGroup(this SPWeb web, string groupName, UserSP user)
 {
     try
     {
         var groups = web.SiteGroups;
         var groupSP = groups[groupName];
         groupSP.AddUser(web.EnsureUser(user.Value));
         return true;
     }
     catch (Exception exception)
     {
         Logger.Error(string.Concat("Error AddUserGroup ", exception.Message));
         return false;
     }
 }
Exemplo n.º 8
0
 /// <summary>
 ///  Form load make the form controls based on settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChangePassword_Load(object sender, EventArgs e)
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser             = spUser.UserView(PublicVariables._decCurrentUserId);
         txtUserName.Text     = infoUser.UserName;
         txtUserName.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CHGPWD:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Function to get particular values from account group table based on the parameter
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public UserInfo UserView(decimal userId)
        {
            UserInfo infoUser = new UserInfo();
            UserSP   spUser   = new UserSP();

            try
            {
                infoUser = spUser.UserView(userId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(infoUser);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Function to get all the values from account group Table
        /// </summary>
        /// <returns></returns>
        public List <DataTable> UserViewAll()
        {
            UserSP           spUser  = new UserSP();
            List <DataTable> ListObj = new List <DataTable>();

            try
            {
                ListObj = spUser.UserViewAll();
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(ListObj);
        }
Exemplo n.º 11
0
 /// <summary>
 /// User Creation GridFill
 /// </summary>
 public void GridFill()
 {
     try
     {
         UserSP    spUser            = new UserSP();
         DataTable dtblUserCreation  = new DataTable();
         string    strSearchUserName = txtSearchUserName.Text.Trim();
         string    strSearchRole     = cmbSearchRole.Text;
         dtblUserCreation           = spUser.UserCreationViewForGridFill(strSearchUserName, strSearchRole);
         dgvUserCreation.DataSource = dtblUserCreation;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Function for check refernce and delete based on parameter
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public decimal UserCreationReferenceDelete(decimal userId)
        {
            UserSP  spUser  = new UserSP();
            decimal decUser = 0;

            try
            {
                decUser = spUser.UserCreationReferenceDelete(userId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(decUser);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Function to check existence of User based on parameter
        /// </summary>
        /// <param name="decUserId"></param>
        /// <param name="strUserName"></param>
        /// <returns></returns>
        public bool UserCreationCheckExistence(decimal decUserId, string strUserName)
        {
            UserSP spUser = new UserSP();
            bool   isEdit = false;

            try
            {
                isEdit = spUser.UserCreationCheckExistence(decUserId, strUserName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(isEdit);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Function to  get the next id for AdditionalCost table
        /// </summary>
        /// <returns></returns>
        public int UserGetMax()
        {
            UserSP spUser = new UserSP();
            int    inMax  = 0;

            try
            {
                inMax = spUser.UserGetMax();
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(inMax);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Function to check Password on Login
        /// </summary>
        /// <param name="strUserName"></param>
        /// <returns></returns>
        public string LoginCheck(string strUserName)
        {
            UserSP spUser = new UserSP();
            string strPsw = string.Empty;

            try
            {
                strPsw = spUser.LoginCheck(strUserName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("UBLL1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(strPsw);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 UserInfo infoUser = new UserInfo();
                 UserSP   spUser   = new UserSP();
                 if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text      = "Save";
                     btnDelete.Enabled = false;
                     ClearFunction();
                     GridFill();
                 }
             }
         }
         else
         {
             UserInfo infoUser = new UserInfo();
             UserSP   spUser   = new UserSP();
             if ((spUser.UserCreationReferenceDelete(decUserId) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 ClearFunction();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:9" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// Update Function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         UserInfo infoUser = new UserInfo();
         UserSP   spUser   = new UserSP();
         infoUser.UserId   = Convert.ToDecimal(dgvUserCreation.CurrentRow.Cells["dgvtxtUserId"].Value);
         infoUser.UserName = txtUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         if (cbxActive.Checked)
         {
             infoUser.Active = true;
         }
         else
         {
             infoUser.Active = false;
         }
         infoUser.RoleId    = Convert.ToDecimal(cmbRole.SelectedValue);
         infoUser.Narration = txtNarration.Text.Trim();
         infoUser.Extra1    = string.Empty;
         infoUser.Extra2    = string.Empty;
         string strUserName = txtUserName.Text.Trim();
         if (spUser.UserCreationCheckExistence(decUserId, strUserName) == false)
         {
             spUser.UserEdit(infoUser);
             Messages.UpdatedMessage();
             ClearFunction();
             GridFill();
             txtUserName.Focus();
         }
         else
         {
             Messages.InformationMessage("User name already exists");
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// Save function, Checking the Invalid entries
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                UserInfo infoUser    = new UserInfo();
                UserSP   spUser      = new UserSP();
                string   strUserName = txtUserName.Text.Trim();
                string   strPassword = spUser.LoginCheck(strUserName);

                if (txtOldPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter password");
                    txtOldPassword.Focus();
                }
                else if (txtNewPassword.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter new password");
                    txtNewPassword.Focus();
                }
                else if (txtRetype.Text.Trim() == string.Empty)
                {
                    Messages.InformationMessage("Enter confirmation password");
                    txtRetype.Focus();
                }
                else if (txtNewPassword.Text != txtRetype.Text)
                {
                    Messages.InformationMessage("Password and confirm password should match");
                    txtRetype.Focus();
                    txtRetype.SelectAll();
                }
                else if (strPassword == txtOldPassword.Text.Trim())
                {
                    if (PublicVariables.isMessageAdd)
                    {
                        if (Messages.SaveMessage())
                        {
                            infoUser.UserId   = PublicVariables._decCurrentUserId;
                            infoUser.UserName = txtUserName.Text.Trim();
                            infoUser.Password = txtNewPassword.Text.Trim();
                            spUser.ChangePasswordEdit(infoUser);
                            Clear();
                            Messages.SavedMessage();
                            this.Close();
                        }
                    }
                    else
                    {
                        infoUser.UserId   = PublicVariables._decCurrentUserId;
                        infoUser.UserName = txtUserName.Text.Trim();
                        infoUser.Password = txtNewPassword.Text.Trim();
                        spUser.ChangePasswordEdit(infoUser);
                    }
                }
                else
                {
                    Messages.InformationMessage("Invalid password");
                    txtOldPassword.Focus();
                    txtOldPassword.SelectAll();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CHGPWD:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }