Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (tbxGroupName.Text.Equals(string.Empty))
            {
                MessageBox.Show("Cost Center Group can not be blank!");
                return;
            }
            CostCentreGroupModel objModel = new CostCentreGroupModel();

            objModel.GroupName    = tbxGroupName.Text.Trim();
            objModel.Alias        = tbxAlias.Text.Trim() == null?string.Empty:tbxAlias.Text.Trim();
            objModel.PrimaryGroup = cbxPrimarygroup.SelectedItem.ToString() == "Y" ? true : false;
            if (cbxPrimarygroup.SelectedItem.ToString() == "N")
            {
                objModel.underGroup = cbxUndergroup.SelectedItem.ToString();
            }

            objModel.CreatedBy = "Admin";
            bool isSuccess = objCG.SaveCCG(objModel);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                ClearControls();
                tbxGroupName.Focus();
            }
        }
Exemple #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CostCentreGroupModel objModel = new CostCentreGroupModel();

            objModel.CCG_ID       = groupId;
            objModel.GroupName    = tbxGroupName.Text.Trim();
            objModel.Alias        = tbxAlias.Text.Trim();
            objModel.underGroup   = cbxUndergroup.SelectedItem.ToString();
            objModel.PrimaryGroup = cbxPrimarygroup.SelectedItem.ToString() == "Y" ? true : false;
            objModel.CreatedBy    = "Admin";

            bool isSuccess = objCG.UpdateCCGM(objModel);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                ClearControls();
                groupId = 0;
                Administration.List.CostcentergrpList frmList = new Administration.List.CostcentergrpList();
                frmList.StartPosition = FormStartPosition.CenterScreen;

                frmList.ShowDialog();
                FillCostCenterGroupInfo();
            }
        }
Exemple #3
0
        //Get All CostcenterGroup By Id
        public CostCentreGroupModel GetAllCostCentreGroupsById(int id)
        {
            CostCentreGroupModel objCCG = new CostCentreGroupModel();

            string Query = "SELECT * FROM CostCentreGroupMaster WHERE CCG_ID=" + id + "";

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

            while (dr.Read())
            {
                objCCG              = new CostCentreGroupModel();
                objCCG.CCG_ID       = Convert.ToInt32(dr["CCG_ID"]);
                objCCG.GroupName    = dr["GroupName"].ToString();
                objCCG.Alias        = dr["Alias"].ToString();
                objCCG.PrimaryGroup = Convert.ToBoolean(dr["PrimaryGroup"]);
                objCCG.underGroup   = dr["underGroup"].ToString();
            }

            return(objCCG);
        }
Exemple #4
0
        private void FillCostCenterGroupInfo()
        {
            if (groupId == 0)
            {
                tbxGroupName.Focus();
                ClearControls();
                lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                return;
            }
            CostCentreGroupModel objMaster = objCG.GetAllCostCentreGroupsById(groupId);

            tbxGroupName.Text            = objMaster.GroupName;
            tbxAlias.Text                = objMaster.Alias;
            cbxPrimarygroup.SelectedItem = (objMaster.PrimaryGroup)?"Y" : "N";
            cbxUndergroup.SelectedItem   = objMaster.underGroup;

            lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
            lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
        }
Exemple #5
0
        //List
        public List <CostCentreGroupModel> GetAllCostCentreGroups()
        {
            List <CostCentreGroupModel> lstCCG = new List <CostCentreGroupModel>();
            CostCentreGroupModel        objCCG;

            string Query = "SELECT * FROM CostCentreGroupMaster";

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

            while (dr.Read())
            {
                objCCG              = new CostCentreGroupModel();
                objCCG.CCG_ID       = Convert.ToInt32(dr["CCG_ID"]);
                objCCG.GroupName    = dr["GroupName"].ToString();
                objCCG.Alias        = dr["Alias"].ToString();
                objCCG.PrimaryGroup = Convert.ToBoolean(dr["PrimaryGroup"]);
                objCCG.underGroup   = dr["underGroup"].ToString();
                //objCCG.ModifiedBy = dr["ModifiedBy"].ToString();

                lstCCG.Add(objCCG);
            }

            return(lstCCG);
        }
Exemple #6
0
        private void btnSave_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;
            //}

            CostCentreGroupModel objModel = new CostCentreGroupModel();

            objModel.GroupName    = tbxGroupName.Text.Trim();
            objModel.Alias        = tbxAlias.Text.Trim();
            objModel.underGroup   = cbxUndergroup.SelectedItem.ToString();
            objModel.PrimaryGroup = cbxPrimarygroup.SelectedItem.ToString() == "Y" ? true : false;
            objModel.CreatedBy    = "Admin";

            bool isSuccess = objCG.SaveCCG(objModel);

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

            //List<CostCentreGroupModel> lstGroups = objCG.GetAllCostCentreGroups();
            //dgvList.DataSource = lstGroups;

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