Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (tbxGroupName.Text.Equals(string.Empty))
            {
                MessageBox.Show("Group Name can not be blank!");
                return;
            }
            //if (accObj.IsGroupExists(tbxGroupName.Text.Trim()))
            //{
            //    MessageBox.Show("Group Name already Exists!", "SunSpeed", MessageBoxButtons.RetryCancel);
            //    // cbxUnderGrp.Focus();
            //    return;
            //}

            eSunSpeedDomain.EmployeeGroupModel objempmodel = new eSunSpeedDomain.EmployeeGroupModel();

            objempmodel.GroupName = tbxGroupName.Text;

            objempmodel.AliasName   = tbxAliasname.Text;
            objempmodel.Primary     = cbxPrimarygroup.SelectedItem.ToString() == "Y" ? true : false;
            objempmodel.UnderGroup  = cbxUndergroup.SelectedItem.ToString();
            objempmodel.NatureGroup = cbxNaturegroup.SelectedItem.ToString();
            objempmodel.GroupId     = Empid;

            objempmodel.CreatedBy = "Admin";

            string message = string.Empty;

            bool isSuccess = objbl.UpdateEmployeeGroup(objempmodel);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
            }
        }
Ejemplo n.º 2
0
        public List <eSunSpeedDomain.EmployeeGroupModel> GetListofEmployeeGroups()
        {
            List <eSunSpeedDomain.EmployeeGroupModel> lstEmployeeGroups = new List <eSunSpeedDomain.EmployeeGroupModel>();

            eSunSpeedDomain.EmployeeGroupModel EmployeeGroup;

            string Query = "SELECT DISTINCT EG_ID,GroupName,AliasName,`Primary`,Undergroup FROM `employeegroup`";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                EmployeeGroup = new eSunSpeedDomain.EmployeeGroupModel();

                EmployeeGroup.GroupId = Convert.ToInt32(dr["EG_ID"]);
                //accountGroup.CanDelete = Convert.ToBoolean(dr["CanDelete"]);
                EmployeeGroup.GroupName  = dr["GroupName"].ToString();
                EmployeeGroup.AliasName  = dr["AliasName"].ToString();
                EmployeeGroup.Primary    = Convert.ToBoolean(dr["Primary"]);
                EmployeeGroup.UnderGroup = dr["UnderGroup"].ToString();


                lstEmployeeGroups.Add(EmployeeGroup);
            }

            return(lstEmployeeGroups);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Save Account Group
        /// </summary>
        /// <param name="objAccountGrp"></param>
        /// <returns>True/False</returns>
        public bool SaveEmployeeGroup(eSunSpeedDomain.EmployeeGroupModel objEmpModel)
        {
            string Query = string.Empty;

            DBParameterCollection paramCollection = new DBParameterCollection();

            paramCollection.Add(new DBParameter("@GroupName", objEmpModel.GroupName));
            paramCollection.Add(new DBParameter("@AliasName", objEmpModel.AliasName));
            paramCollection.Add(new DBParameter("@Primary", objEmpModel.Primary));
            paramCollection.Add(new DBParameter("@UnderGroup", objEmpModel.UnderGroup));
            paramCollection.Add(new DBParameter("@CreatedBy", objEmpModel.CreatedBy));

            Query = "INSERT INTO employeegroup (`GroupName`,`AliasName`,`Primary`,`Undergroup`,`CreatedBy`) VALUES (@GroupName,@AliasName,@Primary,@UnderGroup,@CreatedBy)";

            return(_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0);
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //TODO: 1. Check whether the group name exists or not
            //2. if exist then do not allow to save with the same group name
            //3. Prompt user to change the group name as it already exists

            if (tbxGroupName.Text.Equals(string.Empty))
            {
                MessageBox.Show("Group Name can not be blank!");
                return;
            }
            //if (accObj.IsGroupExists(tbxGroupName.Text.Trim()))
            //{
            //    MessageBox.Show("Group Name already Exists!", "SunSpeed", MessageBoxButtons.RetryCancel);
            //    // cbxUnderGrp.Focus();
            //    return;
            //}

            eSunSpeedDomain.EmployeeGroupModel objempmodel = new eSunSpeedDomain.EmployeeGroupModel();

            objempmodel.GroupName = tbxGroupName.Text;

            objempmodel.AliasName = tbxAliasname.Text;
            objempmodel.Primary   = cbxPrimarygroup.SelectedItem.ToString();

            objempmodel.UnderGroup = cbxPrimarygroup.SelectedItem.ToString().Equals("Yes") ? "" : cbxUndergroup.SelectedItem.ToString();

            objempmodel.CreatedBy = "Admin";

            string message = string.Empty;

            bool isSuccess = objbl.SaveEmployeeGroup(objempmodel);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
            }


            //List<eSunSpeedDomain.AccountGroupModel> lstGroups = accObj.GetListofAccountsGroups();
            //dgvList.DataSource = lstGroups;

            //Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!");
            //d.ShowDialog();
        }