Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (tbxName.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.SalesManModel objsalesmman = new eSunSpeedDomain.SalesManModel();

            objsalesmman.SM_Name = tbxName.Text;

            objsalesmman.SM_Alias           = tbxAlias.Text;
            objsalesmman.SM_PrintName       = tbxPrintName.Text.Trim();
            objsalesmman.EnableDefCommision = cbxEnableDefComm.SelectedItem.ToString().Equals("Yes") ? true : false;
            objsalesmman.Commision_Mode     = cbxDefCommMode.SelectedItem.ToString();
            objsalesmman.DefCommision       = Convert.ToDecimal(tbxDefComm.Text.Trim());
            objsalesmman.FreezeCommision    = cbxDefFreeze.SelectedItem.ToString().Equals("Yes") ? true : false;

            objsalesmman.Sales_DebitMode  = cbxSaleDebitMode.SelectedItem.ToString();
            objsalesmman.Sales_AccDebited = cbxSalesDebited.SelectedItem.ToString();
            //objsalesmman.FreezeCommision = cbxDefFreeze.SelectedItem.ToString().Equals("Yes") ? true : false;

            objsalesmman.Purchase_DebitMode  = cbxPurchaseDebitMode.SelectedItem.ToString();
            objsalesmman.Purchase_AccDebited = cbxPurchaseDebited.SelectedItem.ToString();
            //objsalesmman.FreezeCommision = cbxDefFreeze.SelectedItem.ToString().Equals("Yes") ? true : false;

            objsalesmman.Address = tbxAddress.Text.Trim();
            objsalesmman.Mobile  = tbxMobile.Text.Trim();
            objsalesmman.Email   = tbxEmail.Text.Trim();

            //objAccGroup.CreatedBy = "Admin";

            string message = string.Empty;

            bool isSuccess = objbl.SaveSalesMan(objsalesmman);

            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();
            //*/
        }
Esempio n. 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (tbxName.Text.Equals(string.Empty))
            {
                MessageBox.Show("Group Name can not be blank!");
                return;
            }
            eSunSpeedDomain.SalesManModel objsalesmman = new eSunSpeedDomain.SalesManModel();

            objsalesmman.SM_Name = tbxName.Text;

            objsalesmman.SM_Alias           = tbxAlias.Text.Trim() == string.Empty ? string.Empty : tbxAlias.Text.Trim();
            objsalesmman.SM_PrintName       = tbxPrintName.Text.Trim() == string.Empty ? string.Empty : tbxPrintName.Text.Trim();
            objsalesmman.EnableDefCommision = cbxEnableDefComm.SelectedItem.ToString() == "Y" ? true : false;
            objsalesmman.Commision_Mode     = cbxDefCommMode.SelectedItem.ToString();
            objsalesmman.DefCommision       = Convert.ToDecimal(tbxDefComm.Text.Trim() == string.Empty ? "0.00" : tbxDefComm.Text.Trim());
            objsalesmman.FreezeCommision    = cbxDefFreeze.SelectedItem.ToString() == "Y" ? true : false;

            objsalesmman.SM_AccounttobeCredited = cbxSalesAccountCredited.SelectedItem.ToString() == string.Empty ? string.Empty : cbxSalesAccountCredited.SelectedItem.ToString();
            objsalesmman.Sales_DebitMode        = cbxSaleDebitMode.SelectedItem.ToString();
            objsalesmman.Sales_AccDebited       = cbxSalesDebited.SelectedItem.ToString();
            objsalesmman.Purchase_DebitMode     = cbxPurchaseDebitMode.SelectedItem.ToString();
            objsalesmman.Purchase_AccDebited    = cbxPurchaseDebited.SelectedItem.ToString();

            objsalesmman.Address     = tbxAddress.Text.Trim();
            objsalesmman.Address1    = tbxAddress1.Text.Trim();
            objsalesmman.Address2    = tbxAddress2.Text.Trim();
            objsalesmman.Address3    = tbxAddress3.Text.Trim();
            objsalesmman.Telephone   = Convert.ToInt64(tbxTelephone.Text.Trim() == string.Empty ? "0" : tbxTelephone.Text.Trim());
            objsalesmman.Mobile      = Convert.ToInt64(tbxMobile.Text.Trim() == string.Empty ? "0" : tbxMobile.Text.Trim());
            objsalesmman.Email       = tbxEmail.Text.Trim();
            objsalesmman.SalesMan_Id = SMId;
            string message = string.Empty;

            bool isSuccess = objbl.UpdateSalesMan(objsalesmman);

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

                frmList.ShowDialog();
                FillSalesManInfo();
                tbxName.Focus();
            }
        }