Exemplo n.º 1
0
 private void BindAssignRoleList_ByUserID(int UserId, int CompanyId)
 {
     UserMasterDal ObjUserMasterDal = new UserMasterDal();
     lstAssignRole.Items.Clear();
     lstAssignRole.ClearSelection();
     lstAssignRole.DataTextField = "ROLE_NAME";
     lstAssignRole.DataValueField = "ROLE_ID";
     lstAssignRole.DataSource = ObjUserMasterDal.GetAssignedRoleList_ByUserID(UserId, CompanyId);
     lstAssignRole.DataBind();
 }
Exemplo n.º 2
0
 private void BindEmployeeCombo(RadComboBox sender)
 {
     objUserMasterDAL = new UserMasterDal();
     sender.Items.Clear();
     sender.ClearSelection();
     sender.DataTextField = "EMP_NAME";
     sender.DataValueField = "EMP_ID";
     sender.DataSource = objUserMasterDAL.GetEmployeeKeyValue();
     sender.DataBind();
     sender.Items.Insert(0, new RadComboBoxItem("", "0"));
     sender.SelectedValue = "0";
 }
Exemplo n.º 3
0
 private void BindAssignCompanyList_ByUserID(int UserId)
 {
     UserMasterDal ObjUserMasterDal = new UserMasterDal();
     lstAssignCompanyName.Items.Clear();
     lstAssignCompanyName.ClearSelection();
     lstAssignCompanyName.DataTextField = "COMPANY_NAME";
     lstAssignCompanyName.DataValueField = "COMPANY_ID";
     lstAssignCompanyName.DataSource = ObjUserMasterDal.GetAssignedCompanyList_ByUserID(UserId);
     lstAssignCompanyName.DataBind();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Bind customer grid
 /// </summary>
 private void BindGrid()
 {
     objUserMasterDAL = new UserMasterDal();
     DataSet dsCustomer = objUserMasterDAL.GetUser();
     radgrdUser.DataSource = dsCustomer;
     radgrdUser.DataBind();
     ViewState[vsUser] = dsCustomer;
 }
Exemplo n.º 5
0
 private void BindSecurityQuestionCombo(RadComboBox sender)
 {
     objUserMasterDAL = new UserMasterDal();
     sender.Items.Clear();
     sender.ClearSelection();
     sender.DataTextField = "SECURITY_QUESTION_DESC";
     sender.DataValueField = "SECURITY_QUESTION_ID";
     sender.DataSource = objUserMasterDAL.GetSecurityQuestion();
     sender.DataBind();
     sender.Items.Insert(0, new RadComboBoxItem("--Select--", "0"));
     sender.SelectedValue = "0";
 }
Exemplo n.º 6
0
        /// <summary>
        /// Action bar's save button event which saves grid data by xml.
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>
        protected void acbUser_SaveClick(object sender, EventArgs e)
        {
            int result = 0;
            objUserMasterDAL = new UserMasterDal();
            switch (ucControlBox.SaveButton.CommandName)
            {
                case "Save":
                    objUserMasterBdto = new UserMasterBDto();
                    objUserMasterBdto.UserId = objAuthorizationBDto.UserProfile.UserId;
                    objUserMasterBdto.UserName = txtUserName.Text;
                    objUserMasterBdto.Password = txtPassword.Text;
                    objUserMasterBdto.EmpID = int.Parse(ddlEmployeeName.SelectedValue);
                    objUserMasterBdto.SecurityQusId = int.Parse(ddlSecurityQus.SelectedValue);
                    objUserMasterBdto.SecurityQusAns = txtSecurityQusAns.Text;
                    objUserMasterBdto.FromDate = Convert.ToDateTime(rdpFromDate.SelectedDate);
                    objUserMasterBdto.ToDate = Convert.ToDateTime(rdpToDate.SelectedDate);
                    result = objUserMasterDAL.InsertUser(objUserMasterBdto);

                    GlobalUserId = result;
                    GlobalEmpId = int.Parse(ddlEmployeeName.SelectedValue);

                    if (result == -2)
                    {
                        Master.DisplayMessage("Username already exists. Record is not saved.");
                        Master.MessageCssClass = "errorMessage";
                    }
                    else if (result >= 1)
                    {
                        Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
                        Master.MessageCssClass = "successMessage";
                        BindGrid();
                        radTabStripe.FindTabByText("User Access").Enabled = true;
                        FillCompanyLists(GlobalUserId, GlobalEmpId);
                        BindRoleList();
                    }
                    else
                    {
                        Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
                        Master.MessageCssClass = "errorMessage";
                    }
                    break;
                case "Update":
                    objUserMasterBdto = new UserMasterBDto();
                    objUserMasterDAL = new UserMasterDal();
                    //UpdateUser();

                    if (ViewState[PageConstants.vsItemIndexes] != null)
                    {
                        htItemIndex = (Hashtable)(ViewState[PageConstants.vsItemIndexes]);
                    }
                    if (htItemIndex != null)
                    {
                        GridDataItem item = radgrdUser.Items[int.Parse(htItemIndex[0].ToString())];
                        //Label lblGrdUserId = (Label)radgrdUser.Items[Convert.ToInt32(htItemIndex[0])].FindControl("lblGrdUserID");
                        objUserMasterBdto.m_UserId = int.Parse(item["USER_ID"].Text);
                        objUserMasterBdto.UserId = objAuthorizationBDto.UserProfile.UserId;
                        objUserMasterBdto.UserName = txtUserName.Text;
                        objUserMasterBdto.Password = txtPassword.Text;
                        objUserMasterBdto.EmpID = int.Parse(ddlEmployeeName.SelectedValue);
                        objUserMasterBdto.SecurityQusId = int.Parse(ddlSecurityQus.SelectedValue);
                        objUserMasterBdto.SecurityQusAns = txtSecurityQusAns.Text;
                        objUserMasterBdto.FromDate = Convert.ToDateTime(rdpFromDate.SelectedDate);
                        objUserMasterBdto.ToDate = Convert.ToDateTime(rdpToDate.SelectedDate);
                        GlobalEmpId = int.Parse(ddlEmployeeName.SelectedValue);
                        result = objUserMasterDAL.UpdateUser(objUserMasterBdto);
                        if (result == 1)
                        {
                            acbUser.DefaultMode = true;
                            Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Update].ToString());
                            Master.MessageCssClass = "successMessage";

                            if (ViewState[PageConstants.vsItemIndexes] != null)
                                htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];
                            for (int i = 0; i < htItemIndex.Count; i++)
                                radgrdUser.Items[Convert.ToInt32(htItemIndex[i])].Edit = false;
                            //bisEdit = true;
                            ViewState[PageConstants.vsItemIndexes] = null;
                            BindGrid();
                            radgrdUser.Rebind();
                            acbUser.Visible = true;
                            pnlAddMode.Visible = false;
                            pnlGrid.Visible = true;
                        }
                        else
                        {
                            Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                            Master.MessageCssClass = "errorMessage";
                            acbUser.Visible = true;
                            pnlAddMode.Visible = false;
                        }
                    }
                    break;
                case "Search":
                    {
                        //UserMasterBDto objUserMasterBDto = new UserMasterBDto();
                        //objUserMasterBDto.UserName = txtUserName.Text;
                        //objUserMasterBDto.EmpID = int.Parse(ddlEmployeeName.SelectedValue);
                        //objUserMasterBDto.SecurityQusId = int.Parse(ddlSecurityQus.SelectedValue);
                        //objUserMasterBDto.SecurityQusAns = txtSecurityQusAns.Text;
                        //objUserMasterBDto.FromDate = Convert.ToDateTime(rdpFromDate.SelectedDate);
                        //objUserMasterBDto.ToDate = Convert.ToDateTime(rdpToDate.SelectedDate);
                        //DataSet dsUser = objUserMasterDAL.GetUser(objUserMasterBDto);
                        //if (dsUser != null && dsUser.Tables[0].Rows.Count > 0)
                        //{
                        //    radgrdUser.DataSource = dsUser;
                        //    radgrdUser.DataBind();
                        //    ViewState[vsUser] = dsUser;
                        //    acbUser.Visible = true;
                        //    pnlAddMode.Visible = false;
                        //    pnlGrid.Visible = true;
                        //}
                        //else
                        //{
                        //    Master.DisplayMessage(ConfigurationSettings.AppSettings["NoRecord"].ToString());
                        //    Master.MessageCssClass = "errorMessage";
                        //}
                        break;
                    }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Action bar's Search button event which search records from database. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void acbUser_SearchClick(object sender, EventArgs e)
        {
            #region OpenSearchInNewForm
            //acbUser.Visible = false;
            //pnlGrid.Visible = false;
            //ucControlBox.SaveButton.CommandName = "Search";
            //ucControlBox.SaveButton.Text = "Search";
            //ValidationGroupSearch();
            //txtPassword.Enabled = false;
            //txtRetypePassword.Enabled = false;
            //pnlAddMode.Visible = true;

            //radMultiPage.SelectedIndex = 0;
            //radTabStripe.FindTabByText("User Access").Enabled = false;
            //radTabStripe.FindTabByText("User Info").Selected = true;

            //Reset();
            //BindEmployeeCombo(ddlEmployeeName);
            //BindSecurityQuestionCombo(ddlSecurityQus);
            #endregion
            ////
            UserMasterBDto objUserMasterBDto = new UserMasterBDto();
            UserMasterDal objUserMasterDal = new UserMasterDal();
            objUserMasterBDto.UserName = acbUser.SearchTextBox.Text.Trim();
            DataSet dsUser = objUserMasterDal.GetUserSearch(objUserMasterBDto);
            if (dsUser != null && dsUser.Tables[0].Rows.Count > 0)
            {
                radgrdUser.DataSource = dsUser;
                radgrdUser.DataBind();
                ViewState[vsUser] = dsUser;
            }
            else
            {
                Master.DisplayMessage(ConfigurationSettings.AppSettings["NoRecord"].ToString());
                Master.MessageCssClass = "errorMessage";
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Action bar's delete button event which delete records physically from database.
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>
        protected void acbUser_DeleteClick(object sender, EventArgs e)
        {
            StringBuilder UserId = new StringBuilder();
            int result = 0;
            if (ViewState[PageConstants.vsItemIndexes] != null)
                htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];

            if (htItemIndex != null)
            {
                foreach (int i in htItemIndex.Values)
                {
                    GridDataItem item = radgrdUser.Items[i];
                    UserId.Append(int.Parse(item["USER_ID"].Text) + ",");
                }
            }
            objUserMasterDAL = new UserMasterDal();
            String Id = UserId.ToString().TrimEnd(',');
            result = objUserMasterDAL.DeleteUser(Id);
            if (result == 1)
            {
                Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
                Master.MessageCssClass = "successMessage";
                ViewState[PageConstants.vsItemIndexes] = null;
                BindGrid();
            }
            else if (result == 547)
            {
                Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
                Master.MessageCssClass = "errorMessage";
            }

        }
Exemplo n.º 9
0
 public void UnAssignRole(int UserId, int CompanyId, int RoleId)
 {
     objUserMasterDAL = new UserMasterDal();
     //int CreatedBy = objAuthorizationBDto.UserProfile.UserId;
     int result = objUserMasterDAL.UnAssignRole(UserId, CompanyId, RoleId);
     if (result >= 1)
     {
         Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
         Master.MessageCssClass = "successMessage";
     }
     else
     {
         Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
         Master.MessageCssClass = "errorMessage";
     }
 }
Exemplo n.º 10
0
 public void AssignCompany(string lst, int userid)
 {
     objUserMasterDAL = new UserMasterDal();
     int CreatedBy = objAuthorizationBDto.UserProfile.UserId;
     int result = objUserMasterDAL.InsertAssignCompany(lst, userid, CreatedBy);
     if (result >= 1)
     {
         Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
         Master.MessageCssClass = "successMessage";
     }
     else
     {
         Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
         Master.MessageCssClass = "errorMessage";
     }
 }