private void frmDealerList_Load(object sender, EventArgs e)
 {
     try
     {
         cmbState.DataSource    = objMasterRep.GetStates();
         cmbState.DisplayMember = "STATENAME";
         cmbState.ValueMember   = "STATEID";
         gcDealer.DataSource    = objMasterRep.GetDealer();
     }
     catch (Exception ex)
     {
         ErrorMgmt.ShowError(ex);
         ErrorMgmt.Errorlog.Error(ex);
     }
 }
        private void frmStockEntry_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable dtSupplier = ObjMasterRep.GetDealer();
                cmbSupplier.Properties.DataSource    = dtSupplier;
                cmbSupplier.Properties.ValueMember   = "DEALERID";
                cmbSupplier.Properties.DisplayMember = "DEALERNAME";

                if (ObjStockEntry == null)
                {
                    ObjStockEntry = new StockEntry();
                }
                ObjStockEntry.UserID     = Utility.UserID;
                ObjStockEntry.CATEGORYID = Utility.CategoryID;
                ObjStockRep.GetInvoiceDraft(ObjStockEntry);
                if (Convert.ToInt32(ObjStockEntry.STOCKENTRYID) > 0)
                {
                    cmbSupplier.EditValue      = ObjStockEntry.SUPPLIERID;
                    txtInvoiceNumber.EditValue = ObjStockEntry.SUPPLIERINVOICENO;
                    chkTaxInclusive.EditValue  = ObjStockEntry.TAXINCLUSIVE;
                    dtpInvoice.EditValue       = ObjStockEntry.InvoiceDate;
                    txtTCS.EditValue           = ObjStockEntry.TCS;
                    txtDiscountPer.EditValue   = ObjStockEntry.DISCOUNTPER;
                    txtDiscountFlat.EditValue  = ObjStockEntry.DISCOUNTFLAT;
                    txtExpenses.EditValue      = ObjStockEntry.EXPENSES;
                    txtTransport.EditValue     = ObjStockEntry.TRANSPORT;

                    gcStockEntry.DataSource  = ObjStockEntry.dtStockEntry;
                    cmbSupplier.Enabled      = false;
                    txtInvoiceNumber.Enabled = false;
                    chkTaxInclusive.Enabled  = false;
                    dtpInvoice.Enabled       = false;
                }
                else
                {
                    dtpInvoice.EditValue       = DateTime.Now;
                    ObjStockEntry.dtStockEntry = new DataTable();
                    ObjStockEntry.dtStockEntry.Columns.Add("STOCKENTRYDETAILID", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("ITEMID", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("ITEMCODEID", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("ITEMPRICEID", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("SKUCODE", typeof(string));
                    ObjStockEntry.dtStockEntry.Columns.Add("ITEMCODE", typeof(string));
                    ObjStockEntry.dtStockEntry.Columns.Add("ITEMNAME", typeof(string));
                    ObjStockEntry.dtStockEntry.Columns.Add("COSTPRICEWT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("COSTPRICEWOT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("MRP", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("SALEPRICE", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("QUANTITY", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("WEIGHTINKGS", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("FREEQUANTITY", typeof(int));
                    ObjStockEntry.dtStockEntry.Columns.Add("DISCOUNTFLAT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("DISCOUNTPERCENTAGE", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("SCHEMEPERCENTAGE", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("SCHEMEFLAT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("TOTALPRICEWT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("TOTALPRICEWOT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("APPLIEDDISCOUNT", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("APPLIEDSCHEME", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("APPLIEDDGST", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("FINALPRICE", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("SGST", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("CGST", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("IGST", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("CESS", typeof(decimal));
                    ObjStockEntry.dtStockEntry.Columns.Add("GSTID", typeof(int));
                    gcStockEntry.DataSource = ObjStockEntry.dtStockEntry;
                }
            }
            catch (Exception) { }
        }