Exemplo n.º 1
0
        public bool SetSave()
        {
            bool ReturnValue = false;

            try
            {
                if (_Mode == (int)Common.Constant.Mode.Delete)
                {
                    CommDelRec.DeleteRecord(_VendorID, "usp_Vendor_Delete", "Vendor - Delete");
                    if (CommDelRec.Exception == null)
                    {
                        if (CommDelRec.ErrorMessage != "")
                        {
                            lblErrorMessage.Text = CommDelRec.ErrorMessage;
                            ReturnValue          = false;
                        }
                        else
                        {
                            lblErrorMessage.Text = "No error";
                            ReturnValue          = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(CommDelRec.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ReturnValue = false;
                    }
                }
                else
                {
                    if (DataValidator.IsValid(this.grpVendor))
                    {
                        if (DataValidator.IsValid(this.grpData))
                        {
                            //if (_Mode == (int)Common.Constant.Mode.Insert)
                            // {
                            objVendorBL.Insert(txtreamrks.Text, cmbcategory.Text, txtVendorCode.Text, txtCompany.Text, txtAddress1.Text, txtAddress2.Text, (long)cmbCity.SelectedValue, txtPincode.Text, txtPhone1.Text, txtPhone2.Text, txtFax.Text, txtMobile.Text, txtTinNo.Text, txtCSTNo.Text, txtPANo.Text, txtEccNo.Text, Convert.ToInt64(txtCreditDays.Text), txtRange.Text, txtDivision.Text, Convert.ToDateTime(dtpDate.Value), Convert.ToDecimal(txtCrAmount.Text), Convert.ToDecimal(txtDbAmount.Text));
                            //}
                            //else if (_Mode == (int)Common.Constant.Mode.Modify)
                            //{
                            //    objVendorBL.Update(txtreamrks.Text, cmbcategory.Text, _VendorID, txtVendorCode.Text, txtCompany.Text, txtAddress1.Text, txtAddress2.Text, (long)cmbCity.SelectedValue, txtPincode.Text, txtPhone1.Text, txtPhone2.Text, txtFax.Text, txtMobile.Text, txtTinNo.Text, txtCSTNo.Text, txtPANo.Text, txtEccNo.Text, Convert.ToInt64(txtCreditDays.Text), txtRange.Text, txtDivision.Text, Convert.ToDateTime(dtpDate.Value), Convert.ToDecimal(txtCrAmount.Text), Convert.ToDecimal(txtDbAmount.Text));
                            //}

                            if (objVendorBL.Exception == null)
                            {
                                if (objVendorBL.ErrorMessage != "")
                                {
                                    lblErrorMessage.Text = objVendorBL.ErrorMessage;
                                    txtCompany.Focus();
                                    ReturnValue = false;
                                }
                                else
                                {
                                    lblErrorMessage.Text = "No error";
                                    ReturnValue          = true;
                                }
                            }
                            else
                            {
                                MessageBox.Show(objVendorBL.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                ReturnValue = false;
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("Vendor", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
            return(ReturnValue);
        }