Esempio n. 1
0
        protected void lv_Adjust_Advances_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            try
            {
                GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();
                LinkButton lkbInsert        = (e.Item.FindControl("lkbInsert")) as LinkButton;
                if (lkbInsert.CommandName == "Insert")
                {
                    uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType");
                    obj.ReturnType  = ReturnType;
                    obj.SectionType = (byte)EnumConstants.OfflineExcelSection.AdvanceAdjustment;
                    if (uc_SupplyType.ddlPos_SelectedIndex > 0)
                    {
                        obj.PlaceofSupply = Convert.ToByte(uc_SupplyType.ddlPos_SelectedValue);
                    }

                    if (uc_SupplyType.ddlSupplyType_SelectedIndex > 0)
                    {
                        obj.SupplyType = Convert.ToByte(uc_SupplyType.ddlSupplyType_SelectedValue);
                    }
                }
                obj.UserID      = Common.LoggedInUserID();
                obj.CreatedDate = DateTime.Now;
                obj.CreatedBy   = Common.LoggedInUserID();
                unitOfwork.OfflineinvoiceRepository.Create(obj);
                unitOfwork.Save();
                lv_Adjust_Advances.EditIndex = -1;
                BindItems(ReturnType);
            }
            catch (Exception ex) {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
Esempio n. 2
0
        private At Getatsdata(GST_TRN_OFFLINE_INVOICE atdata)
        {
            At at = new At();

            at.itms = new List <Itm4>();
            // at.pos = atdata.GST_MST_STATE.StateName;
            at.itms.AddRange(GetItm4(atdata));
            at.sply_ty = atdata.SupplyType == 0 ? "INTER" : "INTRA";
            return(at);
        }
        protected void lv_B2b_Invoice_Gstr2_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            LinkButton lkbUpdate = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("lkbUpdate")) as LinkButton;

            if (lkbUpdate.CommandName == "Update")
            {
                int id = Convert.ToInt32(lkbUpdate.CommandArgument);
                GST_TRN_OFFLINE_INVOICE invoice = unitOfwork.OfflineinvoiceRepository.Filter(x => x.ValueId == id).SingleOrDefault();
                if (invoice != null)
                {
                    TextBox txtGSTIN = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("txtGSTIN")) as TextBox;
                    if (txtGSTIN != null)
                    {
                        invoice.ReceiverGSTIN = txtGSTIN.Text;
                    }
                    TextBox txtInvoiceNo = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("txtInvoiceNo")) as TextBox;
                    if (txtInvoiceNo != null)
                    {
                        invoice.InvoiceNo = txtInvoiceNo.Text;
                    }
                    TextBox txt_InvoiceDate = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("txt_InvoiceDate")) as TextBox;
                    if (txt_InvoiceDate != null)
                    {
                        invoice.InvoiceDate = Convert.ToDateTime(txt_InvoiceDate.Text);
                    }
                    TextBox txtInvoiceValue = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("txtInvoiceValue")) as TextBox;
                    if (txtInvoiceValue != null)
                    {
                        invoice.TotalInvoiceValue = txtInvoiceValue.Text;
                    }
                    DropDownList ddlPos = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("ddlPos")) as DropDownList;
                    if (ddlPos != null)
                    {
                        invoice.PlaceofSupply = Convert.ToByte(ddlPos.SelectedValue);
                    }
                    DropDownList ddl_SupplyType = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("ddl_SupplyType")) as DropDownList;
                    if (ddl_SupplyType.SelectedIndex > 0)
                    {
                        invoice.SupplyType = Convert.ToByte(ddl_SupplyType.SelectedValue);
                    }
                    DropDownList ddl_InvoiceType = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("ddl_InvoiceType")) as DropDownList;
                    if (ddl_InvoiceType.SelectedIndex > 0)
                    {
                        invoice.InvoiceType = Convert.ToByte(ddl_InvoiceType.SelectedValue);
                    }
                    CheckBox chkReverse = (lv_B2b_Invoice_Gstr2.Items[e.ItemIndex].FindControl("chkReverse")) as CheckBox;
                    invoice.ReverseCharge = chkReverse.Checked;
                }
                unitOfwork.OfflineinvoiceRepository.Update(invoice);
                unitOfwork.Save();
            }
            lv_B2b_Invoice_Gstr2.EditIndex = -1;
            BindItems();
        }
Esempio n. 4
0
        public B2cl GetB2cl(GST_TRN_OFFLINE_INVOICE b2clInvoice)
        {
            B2cl b2cldata = new B2cl();

            b2cldata.inv = new List <Inv2>();
            b2cldata.pos = b2clInvoice.PlaceofSupply.ToString();
            foreach (var data in b2clInvoice.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                b2cldata.inv.Add(GetInv2(data));
            }
            return(b2cldata);
        }
Esempio n. 5
0
        public Cdnr Getcdnrdata(GST_TRN_OFFLINE_INVOICE cdnrInvoice)
        {
            Cdnr cdnrdatas = new Cdnr();

            cdnrdatas.ctin = "Tin";//cdnrInvoice.TIN;
            cdnrdatas.nt   = new List <Nt>();
            foreach (var data in cdnrInvoice.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                cdnrdatas.nt.Add(GetNt(data));
            }
            return(cdnrdatas);
        }
        protected void lv_B2b_Invoice_Gstr2_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();

            LinkButton lkbInsert = (e.Item.FindControl("lkbInsert")) as LinkButton;

            if (lkbInsert.CommandName == "Insert")
            {
                TextBox txtGSTIN = (e.Item.FindControl("txtGSTIN")) as TextBox;
                if (txtGSTIN != null)
                {
                    obj.ReceiverGSTIN = txtGSTIN.Text;
                }
                TextBox txtInvoiceNo = (e.Item.FindControl("txtInvoiceNo")) as TextBox;
                if (txtInvoiceNo != null)
                {
                    obj.InvoiceNo = txtInvoiceNo.Text;
                }
                TextBox txt_InvoiceDate = (e.Item.FindControl("txt_InvoiceDate")) as TextBox;
                if (txt_InvoiceDate != null)
                {
                    obj.InvoiceDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                }
                //obj.InvoiceDate = Convert.ToDateTime(txt_InvoiceDate.Text);
                TextBox txtInvoiceValue = (e.Item.FindControl("txtInvoiceValue")) as TextBox;
                if (txtInvoiceValue != null)
                {
                    obj.TotalInvoiceValue = txtInvoiceValue.Text;
                }
                DropDownList ddlPos = (e.Item.FindControl("ddlPos")) as DropDownList;
                if (ddlPos.SelectedIndex > 0)
                {
                    obj.PlaceofSupply = Convert.ToByte(ddlPos.SelectedItem.Value);
                }
                DropDownList ddl_SupplyType = (e.Item.FindControl("ddl_SupplyType")) as DropDownList;
                if (ddl_SupplyType.SelectedIndex > 0)
                {
                    obj.SupplyType = Convert.ToByte(ddl_SupplyType.SelectedValue);
                }
                DropDownList ddl_InvoiceType = (e.Item.FindControl("ddl_InvoiceType")) as DropDownList;
                if (ddl_InvoiceType.SelectedIndex > 0)
                {
                    obj.InvoiceType = Convert.ToByte(ddl_InvoiceType.SelectedValue);
                }
                CheckBox chkReverse = (e.Item.FindControl("chkReverse")) as CheckBox;
                obj.ReverseCharge = chkReverse.Checked;
            }
            unitOfwork.OfflineinvoiceRepository.Create(obj);
            unitOfwork.Save();
            lv_B2b_Invoice_Gstr2.EditIndex++;
            BindItems();
        }
Esempio n. 7
0
        private Txpd Gettxpdata(GST_TRN_OFFLINE_INVOICE txpddata)
        {
            Txpd txpd = new Txpd();

            txpd.pos     = Convert.ToString(txpddata.PlaceofSupply);
            txpd.sply_ty = txpddata.SupplyType == 0 ? "INTER" : "INTRA";
            foreach (var data in txpddata.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                txpd.itms.Add(GetItm7(data));
            }

            return(txpd);
        }
Esempio n. 8
0
        private List <Itm4> GetItm4(GST_TRN_OFFLINE_INVOICE atdata)
        {
            List <Itm4> itm4s = new List <Itm4>();
            Itm4        itm4  = new Itm4();

            foreach (var data in atdata.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                itm4.camt  = (double?)data.CGSTAmt;
                itm4.csamt = (int?)data.CessAmt;
                itm4.iamt  = (double?)data.IGSTAmt;
                itm4.rt    = data.GST_TRN_OFFLINE_INVOICE_RATE == null ? null : (int?)data.GST_TRN_OFFLINE_INVOICE_RATE.RATE;
                itm4.samt  = (int?)data.SGSTAmt;
                itm4s.Add(itm4);
            }
            return(itm4s);
        }
Esempio n. 9
0
        private Datum GetDatum(GST_TRN_OFFLINE_INVOICE data)
        {
            Datum datumSource = new Datum();

            datumSource.desc   = data.HSNDescription;
            datumSource.samt   = (int?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().SGSTAmt;
            datumSource.camt   = (int?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().CGSTAmt;
            datumSource.csamt  = (int?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().CessAmt;
            datumSource.hsn_sc = data.HSN;
            datumSource.num    = 12;
            datumSource.qty    = (double?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().TotalQuantity;
            datumSource.txval  = (double?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().TotalTaxableValue;
            datumSource.iamt   = (double?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().IGSTAmt;
            datumSource.val    = (double?)data.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault().TotalValue;
            datumSource.uqc    = "ABC";
            return(datumSource);
        }
Esempio n. 10
0
        public Cdnur Getcdnurdata(GST_TRN_OFFLINE_INVOICE cdnurdata)
        {
            Cdnur cdnur = new Cdnur();

            cdnur.idt    = Convert.ToDateTime(cdnurdata.InvoiceDate).ToString("dd-mm-yyyy");
            cdnur.inum   = cdnurdata.InvoiceNo;
            cdnur.nt_dt  = Convert.ToString(cdnurdata.Voucher_date);
            cdnur.nt_num = cdnurdata.Voucher_No;
            cdnur.ntty   = Convert.ToString(cdnurdata.NoteType);
            cdnur.p_gst  = Convert.ToString(cdnurdata.Pre_GST);
            cdnur.rsn    = Convert.ToString(cdnurdata.Issuing_Note);
            cdnur.val    = Convert.ToInt32(cdnurdata.Voucher_Value);
            cdnur.itms   = new List <Itm6>();
            foreach (var data in cdnurdata.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                cdnur.itms.Add(GetItem6(data));
            }
            return(cdnur);
        }
Esempio n. 11
0
        private List <Inv3> GetInv3(GST_TRN_OFFLINE_INVOICE expdata)
        {
            List <Inv3> invs3 = new List <Inv3>();
            Inv3        inv3;

            foreach (var dataitem in expdata.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                inv3      = new Inv3();
                inv3.itms = new List <Itm3>();
                inv3.idt  = Convert.ToDateTime(dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceDate).ToString("dd-mm-yyyy");
                inv3.inum = dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceNo;
                inv3.itms.Add(GetItm3(dataitem));
                inv3.sbdt    = Convert.ToDateTime(dataitem.GST_TRN_OFFLINE_INVOICE.ShippingBillDate).ToString("dd-mm-yyyy");
                inv3.sbnum   = Convert.ToInt32(dataitem.GST_TRN_OFFLINE_INVOICE.ShippingBillNo);
                inv3.sbpcode = dataitem.GST_TRN_OFFLINE_INVOICE.PortCode;
                inv3.val     = (int?)dataitem.TotalTaxableValue;
                invs3.Add(inv3);
            }
            return(invs3);
        }
Esempio n. 12
0
        private List <Inv> GetInv(GST_TRN_OFFLINE_INVOICE B2B)
        {
            List <Inv> invs = new List <Inv>();
            Inv        inv;

            foreach (var dataitem in B2B.GST_TRN_OFFLINE_INVOICE_DATAITEM)
            {
                inv         = new Inv();
                inv.itms    = new List <Itm>();
                inv.idt     = Convert.ToDateTime(dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceDate).ToString("dd-mm-yyyy");
                inv.inum    = dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceNo;
                inv.inv_typ = dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceType == null ? "" : ((EnumConstants.InvoiceType)dataitem.GST_TRN_OFFLINE_INVOICE.InvoiceType).ToString()[0].ToString();
                inv.itms.Add(GetItm(dataitem));
                inv.pos   = dataitem.GST_TRN_OFFLINE_INVOICE.PlaceofSupply == null ? "" : dataitem.GST_TRN_OFFLINE_INVOICE.GST_MST_STATE.StateCode;
                inv.rchrg = Convert.ToBoolean(dataitem.GST_TRN_OFFLINE_INVOICE.ReverseCharge) ? "Y" : "N";
                inv.val   = (int?)dataitem.TotalTaxableValue;
                invs.Add(inv);
            }
            return(invs);
        }
Esempio n. 13
0
        public B2cs GetB2cs(GST_TRN_OFFLINE_INVOICE ItmB2csInvoice)
        {
            B2cs invb2cs = new B2cs();

            invb2cs.pos = Convert.ToString(ItmB2csInvoice.PlaceofSupply);
            invb2cs.typ = Convert.ToString(ItmB2csInvoice.Type);
            var b2bdata = ItmB2csInvoice.GST_TRN_OFFLINE_INVOICE_DATAITEM.FirstOrDefault();

            if (b2bdata != null)
            {
                invb2cs.camt  = (int?)b2bdata.CGSTAmt;
                invb2cs.csamt = (int?)b2bdata.CessAmt;
                //invb2cs.etin = ItmB2csInvoice.TinNo;
                invb2cs.iamt = (int?)b2bdata.IGSTAmt;
                invb2cs.samt = (int?)b2bdata.SGSTAmt;
                //invb2cs.sply_ty = ItmB2csInvoice.
                invb2cs.txval = (double?)b2bdata.TaxableAmount;
                invb2cs.rt    = b2bdata.GST_TRN_OFFLINE_INVOICE_RATE == null ? null : (int?)b2bdata.GST_TRN_OFFLINE_INVOICE_RATE.RATE;
            }
            return(invb2cs);
        }
        protected void lv_crdrUnregister_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            try
            {
                GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();

                LinkButton lkbInsert = (e.Item.FindControl("lkbInsert")) as LinkButton;
                if (lkbInsert.CommandName == "Insert")
                {
                    obj.ReturnType  = ReturnType;
                    obj.SectionType = (byte)EnumConstants.OfflineExcelSection.CreditDebitNonReg;
                    DropDownList ddl_URType = (e.Item.FindControl("ddl_URType")) as DropDownList;
                    if (ddl_URType.SelectedIndex > 0)
                    {
                        obj.URType = Convert.ToByte(ddl_URType.SelectedValue);
                    }
                    TextBox txtVoucherNo = (e.Item.FindControl("txtVoucherNo")) as TextBox;
                    if (txtVoucherNo.Text != null)
                    {
                        obj.Voucher_No = txtVoucherNo.Text.Trim();
                    }

                    TextBox txt_VoucherDate = (e.Item.FindControl("txt_VoucherDate")) as TextBox;
                    if (txt_VoucherDate.Text != null || txt_VoucherDate.Text != "-")
                    {
                        DateTime SOrderDate = DateTime.ParseExact(txt_VoucherDate.Text, "dd/MM/yyyy", null);
                        obj.Voucher_date = SOrderDate;
                    }

                    TextBox txt_invoiceno = (e.Item.FindControl("txt_invoiceno")) as TextBox;
                    if (txt_invoiceno.Text != null)
                    {
                        obj.InvoiceNo = txt_invoiceno.Text.Trim();
                    }

                    TextBox txt_InvoiceDate = (e.Item.FindControl("txt_InvoiceDate")) as TextBox;
                    if (txt_InvoiceDate.Text != null || txt_InvoiceDate.Text != "-")
                    {
                        DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text.Trim(), "dd/MM/yyyy", null);
                        obj.InvoiceDate = SOrderDate;
                    }

                    DropDownList ddl_DocumentType = (e.Item.FindControl("ddl_DocumentType")) as DropDownList;
                    if (ddl_DocumentType.SelectedIndex > 0)
                    {
                        obj.Document_Type = ddl_DocumentType.SelectedValue;
                    }

                    DropDownList ddl_IssuingNote = (e.Item.FindControl("ddl_IssuingNote")) as DropDownList;
                    if (ddl_IssuingNote.SelectedIndex > 0)
                    {
                        obj.Issuing_Note = Convert.ToInt32(ddl_IssuingNote.SelectedItem.Value);
                    }

                    TextBox txt_VoucherValue = (e.Item.FindControl("txt_VoucherValue")) as TextBox;
                    if (txt_VoucherValue.Text != null)
                    {
                        obj.Voucher_Value = txt_VoucherValue.Text.Trim();
                    }

                    DropDownList ddlPos = (e.Item.FindControl("ddlPos")) as DropDownList;
                    if (ddlPos.SelectedIndex > 0)
                    {
                        obj.PlaceofSupply = Convert.ToByte(ddlPos.SelectedItem.Value);
                    }

                    DropDownList ddlSupplyType = (e.Item.FindControl("ddlSupplyType")) as DropDownList;
                    if (ddlSupplyType.SelectedIndex > 0)
                    {
                        obj.SupplyType = Convert.ToByte(ddlSupplyType.SelectedValue);
                    }

                    CheckBox chk_PreGST = (e.Item.FindControl("chk_PreGST")) as CheckBox;
                    obj.Pre_GST = chk_PreGST.Checked;
                }
                //viveksinha-start
                obj.UserID      = Common.LoggedInUserID();
                obj.CreatedBy   = Common.LoggedInUserID();
                obj.CreatedDate = DateTime.Now;

                unitOfwork.OfflineinvoiceRepository.Create(obj);
                unitOfwork.Save();
                lv_crdrUnregister.EditIndex = -1;
                //lv_crdrUnregister.EditIndex++;
                BindItems(ReturnType);
                lkbDelete.Visible = true;
                //end
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
        protected void lv_crdrUnregister_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            try
            {
                LinkButton lkbUpdate = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("lkbUpdate")) as LinkButton;
                if (lkbUpdate.CommandName == "Update")
                {
                    int id = Convert.ToInt32(lkbUpdate.CommandArgument);
                    GST_TRN_OFFLINE_INVOICE invoice = unitOfwork.OfflineinvoiceRepository.Filter(x => x.ValueId == id).SingleOrDefault();
                    if (invoice != null)
                    {
                        DropDownList ddl_URType = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("ddl_URType")) as DropDownList;
                        if (ddl_URType.SelectedIndex > -1)
                        {
                            invoice.URType = Convert.ToByte(ddl_URType.SelectedValue);
                        }

                        TextBox txtVoucherNo = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("txtVoucherNo")) as TextBox;
                        if (txtVoucherNo.Text != null || txtVoucherNo.Text != "")
                        {
                            invoice.Voucher_No = txtVoucherNo.Text.Trim();
                        }

                        TextBox txt_VocherDate = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("txt_VocherDate")) as TextBox;
                        if (txt_VocherDate.Text != null || txt_VocherDate.Text != "-")
                        {
                            DateTime SOrderDate = DateTime.ParseExact(txt_VocherDate.Text, "dd/MM/yyyy", null);
                            invoice.Voucher_date = SOrderDate;
                        }

                        TextBox txt_invoiceno = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("txt_invoiceno")) as TextBox;
                        if (txt_invoiceno.Text != null || txt_invoiceno.Text != "")
                        {
                            invoice.InvoiceNo = txt_invoiceno.Text.Trim();
                        }

                        TextBox txt_InvoiceDate = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("txt_InvoiceDate")) as TextBox;
                        if (txt_InvoiceDate.Text != "-" || txt_InvoiceDate.Text != null)
                        {
                            DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                            invoice.InvoiceDate = SOrderDate;
                        }

                        DropDownList ddl_DocumentType = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("ddl_DocumentType")) as DropDownList;
                        if (ddl_DocumentType.SelectedIndex > 0)
                        {
                            invoice.Document_Type = ddl_DocumentType.SelectedValue;
                        }

                        DropDownList ddl_IssuingNote = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("ddl_IssuingNote")) as DropDownList;
                        if (ddl_IssuingNote.SelectedIndex > 0)
                        {
                            invoice.Issuing_Note = Convert.ToInt32(ddl_IssuingNote.SelectedItem.Value);
                        }

                        DropDownList ddlPos = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("ddlPos")) as DropDownList;
                        if (ddlPos != null)
                        {
                            invoice.PlaceofSupply = Convert.ToByte(ddlPos.SelectedValue);
                        }

                        TextBox txt_VoucherValue = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("txt_VoucherValue")) as TextBox;
                        if (txt_VoucherValue.Text != null || txt_VoucherValue.Text != "")
                        {
                            invoice.Voucher_Value = txt_VoucherValue.Text.Trim();
                        }

                        DropDownList ddlSupplyType = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("ddlSupplyType")) as DropDownList;
                        if (ddlSupplyType.SelectedIndex > 0)
                        {
                            invoice.SupplyType = Convert.ToByte(ddlSupplyType.SelectedValue);
                        }

                        CheckBox chk_PreGST = (lv_crdrUnregister.Items[e.ItemIndex].FindControl("chk_PreGST")) as CheckBox;
                        invoice.Pre_GST = chk_PreGST.Checked;
                    }

                    //viveksinha-start
                    invoice.UpdatedDate = DateTime.Now;
                    invoice.UpdatedBy   = Common.LoggedInUserID();
                    invoice.UserID      = Common.LoggedInUserID();
                    //end
                    unitOfwork.OfflineinvoiceRepository.Update(invoice);
                    unitOfwork.Save();
                }
                lv_crdrUnregister.EditIndex = -1;
                BindItems(ReturnType);
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
        protected void lv_Export_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            try
            {
                GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();
                LinkButton lkbInsert        = (e.Item.FindControl("lkbInsert")) as LinkButton;
                if (lkbInsert.CommandName == "Insert")
                {
                    obj.ReturnType  = ReturnType;
                    obj.SectionType = (byte)EnumConstants.OfflineExcelSection.ExportInvoice;
                    DropDownList ddl_GSTPayment = (e.Item.FindControl("ddl_GSTPayment")) as DropDownList;
                    if (ddl_GSTPayment.SelectedIndex > 0)
                    {
                        obj.GST_Payment = Convert.ToByte(ddl_GSTPayment.SelectedValue);
                    }

                    TextBox txt_invoiceno = (e.Item.FindControl("txt_invoiceno")) as TextBox;
                    if (txt_invoiceno.Text != null)
                    {
                        obj.InvoiceNo = txt_invoiceno.Text.Trim();
                    }

                    TextBox txt_InvoiceDate = (e.Item.FindControl("txt_InvoiceDate")) as TextBox;
                    if (txt_InvoiceDate.Text != null || txt_InvoiceDate.Text != "-")
                    {
                        DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                        obj.InvoiceDate = SOrderDate;
                    }
                    //obj.InvoiceDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                    TextBox txt_InvoiceValue = (e.Item.FindControl("txt_InvoiceValue")) as TextBox;
                    if (txt_InvoiceValue.Text != null)
                    {
                        obj.TotalInvoiceValue = txt_InvoiceValue.Text.Trim();
                    }
                    TextBox txt_PortCode = (e.Item.FindControl("txt_PortCode")) as TextBox;
                    if (txt_PortCode.Text != null)
                    {
                        obj.PortCode = txt_PortCode.Text.Trim();
                    }
                    TextBox txt_ShippingBillNo = (e.Item.FindControl("txt_ShippingBillNo")) as TextBox;
                    if (txt_ShippingBillNo.Text != null)
                    {
                        obj.ShippingBillNo = txt_ShippingBillNo.Text.Trim();
                    }

                    TextBox txt_ShippingBillDate = (e.Item.FindControl("txt_ShippingBillDate")) as TextBox;
                    if (txt_ShippingBillDate.Text != null || txt_ShippingBillDate.Text != "-")
                    {
                        DateTime SOrderDate = DateTime.ParseExact(txt_ShippingBillDate.Text, "dd/MM/yyyy", null);
                        obj.ShippingBillDate = SOrderDate;
                    }
                    DropDownList ddl_SupplyType = (e.Item.FindControl("ddl_SupplyType")) as DropDownList;
                    if (ddl_SupplyType.SelectedIndex > 0)
                    {
                        obj.SupplyType = Convert.ToByte(ddl_SupplyType.SelectedValue);
                    }
                }

                //viveksinha-start
                obj.UserID      = Common.LoggedInUserID();
                obj.CreatedBy   = Common.LoggedInUserID();
                obj.CreatedDate = DateTime.Now;
                unitOfwork.OfflineinvoiceRepository.Create(obj);
                unitOfwork.Save();
                lv_Export.EditIndex = -1;
                //lv_Export.EditIndex++;
                BindItems(ReturnType);
                lkbDelete.Visible = true;
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
        protected void lv_Export_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            try
            {
                LinkButton lkbUpdate = (lv_Export.Items[e.ItemIndex].FindControl("lkbUpdate")) as LinkButton;
                if (lkbUpdate.CommandName == "Update")
                {
                    int id = Convert.ToInt32(lkbUpdate.CommandArgument);
                    GST_TRN_OFFLINE_INVOICE invoice = unitOfwork.OfflineinvoiceRepository.Filter(x => x.ValueId == id).SingleOrDefault();
                    if (invoice != null)
                    {
                        DropDownList ddl_GSTPayment = (lv_Export.Items[e.ItemIndex].FindControl("ddl_GSTPayment")) as DropDownList;
                        if (ddl_GSTPayment.SelectedIndex > 0)
                        {
                            invoice.GST_Payment = Convert.ToByte(ddl_GSTPayment.SelectedValue);
                        }

                        TextBox txt_invoiceno = (lv_Export.Items[e.ItemIndex].FindControl("txt_invoiceno")) as TextBox;
                        if (txt_invoiceno.Text != null || txt_invoiceno.Text != "")
                        {
                            invoice.InvoiceNo = txt_invoiceno.Text.Trim();
                        }

                        TextBox txt_InvoiceDate = (lv_Export.Items[e.ItemIndex].FindControl("txt_InvoiceDate")) as TextBox;
                        if (txt_InvoiceDate.Text != null || txt_InvoiceDate.Text != "-")
                        {
                            DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                            invoice.InvoiceDate = SOrderDate;
                        }

                        TextBox txt_InvoiceValue = (lv_Export.Items[e.ItemIndex].FindControl("txt_InvoiceValue")) as TextBox;
                        if (txt_InvoiceValue.Text != null || txt_InvoiceValue.Text != "")
                        {
                            invoice.TotalInvoiceValue = txt_InvoiceValue.Text.Trim();
                        }

                        TextBox txt_PortCode = (lv_Export.Items[e.ItemIndex].FindControl("txt_PortCode")) as TextBox;
                        if (txt_PortCode.Text != null || txt_PortCode.Text != "")
                        {
                            invoice.PortCode = txt_PortCode.Text.Trim();
                        }

                        TextBox txt_ShippingBillNo = (lv_Export.Items[e.ItemIndex].FindControl("txt_ShippingBillNo")) as TextBox;
                        if (txt_ShippingBillNo.Text != null || txt_ShippingBillNo.Text != "")
                        {
                            invoice.ShippingBillNo = txt_ShippingBillNo.Text;
                        }

                        TextBox txt_ShippingBillDate = (lv_Export.Items[e.ItemIndex].FindControl("txt_ShippingBillDate")) as TextBox;
                        if (txt_ShippingBillDate.Text != null || txt_ShippingBillDate.Text != "-")
                        {
                            DateTime SOrderDate = DateTime.ParseExact(txt_ShippingBillDate.Text, "dd/MM/yyyy", null);
                            invoice.ShippingBillDate = SOrderDate;
                        }

                        DropDownList ddl_SupplyType = (lv_Export.Items[e.ItemIndex].FindControl("ddl_SupplyType")) as DropDownList;
                        if (ddl_SupplyType.SelectedIndex > 0)
                        {
                            invoice.SupplyType = Convert.ToByte(ddl_SupplyType.SelectedValue);
                        }
                    }
                    //viveksinha-start
                    invoice.UpdatedDate = DateTime.Now;
                    invoice.UpdatedBy   = Common.LoggedInUserID();
                    invoice.UserID      = Common.LoggedInUserID();
                    //end
                    unitOfwork.OfflineinvoiceRepository.Update(invoice);
                    unitOfwork.Save();
                    lv_Export.EditIndex = -1;
                    BindItems(ReturnType);
                    //lkbDelete.Visible = true;
                }
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
Esempio n. 18
0
 private Exp GetExpData(GST_TRN_OFFLINE_INVOICE expdata)
 {
     return(new Exp {
         exp_typ = "Wpay", inv = GetInv3(expdata)
     });
 }
Esempio n. 19
0
 private B2b GetB2b(GST_TRN_OFFLINE_INVOICE B2B)
 {
     return(new B2b {
         ctin = "tinno", inv = GetInv(B2B)
     });
 }
Esempio n. 20
0
        protected void lv_B2b_Invoice_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            try
            {
                GST_TRN_OFFLINE_INVOICE obj = new GST_TRN_OFFLINE_INVOICE();

                LinkButton lkbInsert = (e.Item.FindControl("lkbInsert")) as LinkButton;
                if (lkbInsert.CommandName == "Insert")
                {
                    obj.ReturnType  = ReturnType;
                    obj.SectionType = (byte)EnumConstants.OfflineExcelSection.B2B;
                    uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType");

                    TextBox txtGSTIN = (e.Item.FindControl("txtGSTIN")) as TextBox;
                    if (txtGSTIN.Text != null)
                    {
                        obj.ReceiverGSTIN = txtGSTIN.Text.Trim();
                    }

                    TextBox txtInvoiceNo = (e.Item.FindControl("txtInvoiceNo")) as TextBox;
                    if (txtInvoiceNo.Text != null)
                    {
                        obj.InvoiceNo = txtInvoiceNo.Text.Trim();
                    }

                    TextBox txt_InvoiceDate = (e.Item.FindControl("txt_InvoiceDate")) as TextBox;
                    if (txt_InvoiceDate.Text != null || txt_InvoiceDate.Text != "-")
                    {
                        DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text, "dd/MM/yyyy", null);
                        obj.InvoiceDate = SOrderDate;
                    }

                    TextBox txtInvoiceValue = (e.Item.FindControl("txtInvoiceValue")) as TextBox;
                    if (txtInvoiceValue.Text != null)
                    {
                        obj.TotalInvoiceValue = txtInvoiceValue.Text.Trim();
                    }

                    if (uc_SupplyType.ddlPos_SelectedIndex > 0)
                    {
                        obj.PlaceofSupply = Convert.ToByte(uc_SupplyType.ddlPos_SelectedValue);
                    }

                    if (uc_SupplyType.ddlSupplyType_SelectedIndex > 0)
                    {
                        obj.SupplyType = Convert.ToByte(uc_SupplyType.ddlSupplyType_SelectedValue);
                    }

                    DropDownList ddl_InvoiceType = (e.Item.FindControl("ddl_InvoiceType")) as DropDownList;
                    if (ddl_InvoiceType.SelectedIndex > 0)
                    {
                        obj.InvoiceType = Convert.ToByte(ddl_InvoiceType.SelectedValue);
                    }

                    TextBox txtECommerce = (e.Item.FindControl("txtECommerce")) as TextBox;
                    if (txtECommerce.Text != null)
                    {
                        obj.ECommerce_GSTIN = txtECommerce.Text.Trim();
                    }

                    CheckBox chkReverse = (e.Item.FindControl("chkReverse")) as CheckBox;
                    obj.ReverseCharge = chkReverse.Checked;
                }
                //viveksinha-start
                obj.UserID      = Common.LoggedInUserID();
                obj.CreatedBy   = Common.LoggedInUserID();
                obj.CreatedDate = DateTime.Now;
                //end
                unitOfwork.OfflineinvoiceRepository.Create(obj);
                unitOfwork.Save();
                lv_B2b_Invoice.EditIndex = -1;
                BindItems(ReturnType);
                lkbDelete.Visible = true;
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
Esempio n. 21
0
        protected void lv_B2b_Invoice_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            try
            {
                LinkButton lkbUpdate = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("lkbUpdate")) as LinkButton;
                if (lkbUpdate.CommandName == "Update")
                {
                    int id = Convert.ToInt32(lkbUpdate.CommandArgument);
                    GST_TRN_OFFLINE_INVOICE invoice = unitOfwork.OfflineinvoiceRepository.Filter(x => x.ValueId == id).SingleOrDefault();
                    if (invoice != null)
                    {
                        uc_SupplyType uc_SupplyType = (uc_SupplyType)lv_B2b_Invoice.Items[e.ItemIndex].FindControl("uc_SupplyType");

                        TextBox txtGSTIN = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("txtGSTIN")) as TextBox;
                        if (txtGSTIN.Text != null || txtGSTIN.Text != "")
                        {
                            invoice.ReceiverGSTIN = txtGSTIN.Text.Trim();
                        }

                        TextBox txtInvoiceNo = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("txtInvoiceNo")) as TextBox;
                        if (txtInvoiceNo.Text != null || txtInvoiceNo.Text != "")
                        {
                            invoice.InvoiceNo = txtInvoiceNo.Text.Trim();
                        }

                        TextBox txt_InvoiceDate = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("txt_InvoiceDate")) as TextBox;
                        if (txt_InvoiceDate.Text != null || txt_InvoiceDate.Text != "-")
                        {
                            DateTime SOrderDate = DateTime.ParseExact(txt_InvoiceDate.Text.Trim(), "dd/MM/yyyy", null);
                            invoice.InvoiceDate = SOrderDate;
                        }

                        TextBox txtInvoiceValue = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("txtInvoiceValue")) as TextBox;
                        if (txtInvoiceValue.Text != null || txtInvoiceValue.Text != "")
                        {
                            invoice.TotalInvoiceValue = txtInvoiceValue.Text.Trim();
                        }

                        if (uc_SupplyType.ddlPos_SelectedIndex > 0)
                        {
                            invoice.PlaceofSupply = Convert.ToByte(uc_SupplyType.ddlPos_SelectedValue);
                        }

                        if (uc_SupplyType.ddlSupplyType_SelectedIndex > 0)
                        {
                            invoice.SupplyType = Convert.ToByte(uc_SupplyType.ddlSupplyType_SelectedValue);
                        }

                        DropDownList ddl_InvoiceType = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("ddl_InvoiceType")) as DropDownList;
                        if (ddl_InvoiceType.SelectedIndex > 0)
                        {
                            invoice.InvoiceType = Convert.ToByte(ddl_InvoiceType.SelectedValue);
                        }

                        TextBox txtECommerce = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("txtECommerce")) as TextBox;
                        if (txtECommerce.Text != null || txtECommerce.Text != "")
                        {
                            invoice.ECommerce_GSTIN = txtECommerce.Text.Trim();
                        }

                        CheckBox chkReverse = (lv_B2b_Invoice.Items[e.ItemIndex].FindControl("chkReverse")) as CheckBox;
                        invoice.ReverseCharge = chkReverse.Checked;
                    }
                    //viveksinha-start
                    invoice.UserID      = Common.LoggedInUserID();
                    invoice.UpdatedBy   = Common.LoggedInUserID();
                    invoice.UpdatedDate = DateTime.Now;
                    //end
                    unitOfwork.OfflineinvoiceRepository.Update(invoice);
                    unitOfwork.Save();
                }
                lv_B2b_Invoice.EditIndex = -1;
                BindItems(ReturnType);
            }
            catch (Exception ex)
            {
                cls_ErrorLog ob = new cls_ErrorLog();
                cls_ErrorLog.LogError(ex, Common.LoggedInUserID());
            }
        }
Esempio n. 22
0
        private GST_TRN_OFFLINE_INVOICE GetInvoiceInformation(DataRow dataRow, string SupplierGSTIN, byte sheetCode, string UserId, string offlineid)
        {
            GST_TRN_OFFLINE_INVOICE invoice = new GST_TRN_OFFLINE_INVOICE();

            try
            {
                //B2B
                string  stateCode;
                Boolean ReverseChr;
                if (sheetCode == 0)
                {
                    stateCode = dataRow.ItemArray[4].ToString().Split('-')[0];

                    invoice.ReceiverGSTIN     = dataRow.Field <string>("Column0");
                    invoice.InvoiceNo         = dataRow.Field <string>("Column1");
                    invoice.InvoiceDate       = dataRow.Field <DateTime>("Column2");
                    invoice.TotalInvoiceValue = Convert.ToString(dataRow.ItemArray[3]);
                    invoice.PlaceofSupply     = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.ReverseCharge     = dataRow.ItemArray[5].ToString() == "Y" ? true : false;
                    invoice.InvoiceType       = sheetCode; //Convert.ToByte(dataRow.ItemArray[6]);
                    invoice.ECommerce_GSTIN   = dataRow.Field <string>("Column7");
                    invoice.SectionType       = sheetCode;
                }
                //B2CL
                else if (sheetCode == 1)
                {
                    stateCode                 = dataRow.ItemArray[3].ToString().Split('-')[0];
                    invoice.InvoiceNo         = Convert.ToString(dataRow.ItemArray[0]);
                    invoice.InvoiceDate       = dataRow.Field <DateTime>("Column1");
                    invoice.TotalInvoiceValue = Convert.ToString(dataRow.ItemArray[2]);
                    invoice.ECommerce_GSTIN   = dataRow.Field <string>("Column7");
                    invoice.PlaceofSupply     = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.SectionType       = sheetCode;
                }
                //B2CS
                else if (sheetCode == 2)
                {
                    stateCode               = dataRow.ItemArray[1].ToString().Split('-')[0];
                    invoice.Type            = Convert.ToByte((EnumConstants.URType)Enum.Parse(typeof(EnumConstants.OfflineType), dataRow.ItemArray[0].ToString())); //dataRow.Field<string>("Column0");
                    invoice.ECommerce_GSTIN = dataRow.Field <string>("Column5");
                    invoice.PlaceofSupply   = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.SectionType     = sheetCode;
                }
                //CDNR
                else if (sheetCode == 3)
                {
                    invoice.ReceiverGSTIN = dataRow.Field <string>("Column0");
                    invoice.InvoiceNo     = Convert.ToString(dataRow.ItemArray[1]);
                    invoice.InvoiceDate   = Convert.ToDateTime(dataRow.ItemArray[2]);
                    invoice.Voucher_No    = Convert.ToString(dataRow.ItemArray[3]);
                    invoice.Voucher_date  = Convert.ToDateTime(dataRow.ItemArray[4]);
                    invoice.Document_Type = Convert.ToString(dataRow.ItemArray[5]);
                    string NoteCode = dataRow.ItemArray[6].ToString().Split('-')[0];
                    invoice.Issuing_Note  = unitOfWork.OfflineissuingnoteRepository.Find(x => x.NoteCode == NoteCode).NoteID;
                    stateCode             = dataRow.ItemArray[7].ToString().Split('-')[0];
                    invoice.PlaceofSupply = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.Voucher_Value = Convert.ToString(dataRow.ItemArray[8]);
                    invoice.Pre_GST       = dataRow.ItemArray[12].ToString() == "Y" ? true : false;
                    invoice.SectionType   = sheetCode;
                    //invoice.InvoiceType = Convert.ToByte(dataRow.Field<string>("Column10"));
                    //invoice.ECommerece_GSTIN = dataRow.Field<string>("Column11");
                }
                //CDNUR
                else if (sheetCode == 4)
                {
                    stateCode             = dataRow.ItemArray[7].ToString().Split('-')[0];
                    invoice.URType        = Convert.ToByte((EnumConstants.URType)Enum.Parse(typeof(EnumConstants.URType), dataRow.ItemArray[0].ToString()));
                    invoice.Voucher_No    = dataRow.Field <string>("Column1");
                    invoice.Voucher_date  = Convert.ToDateTime(dataRow.ItemArray[2]);
                    invoice.Document_Type = Convert.ToString(dataRow.ItemArray[3]);//Convert.ToString((EnumConstants.NoteType)Enum.Parse(typeof(EnumConstants.NoteType), dataRow.ItemArray[3].ToString())); //Convert.ToByte(dataRow.ItemArray[3]);
                    invoice.InvoiceNo     = Convert.ToString(dataRow.ItemArray[4]);
                    invoice.InvoiceDate   = Convert.ToDateTime(dataRow.ItemArray[5]);
                    string NoteCode = dataRow.ItemArray[6].ToString().Split('-')[0];
                    invoice.Issuing_Note  = unitOfWork.OfflineissuingnoteRepository.Find(x => x.NoteCode == NoteCode).NoteID; invoice.Voucher_Value = Convert.ToString(dataRow.ItemArray[8]);
                    invoice.Pre_GST       = dataRow.ItemArray[12].ToString() == "Y" ? true : false;
                    invoice.PlaceofSupply = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.SectionType   = sheetCode;
                }
                //EXP
                else if (sheetCode == 5)
                {
                    invoice.InvoiceType       = sheetCode; //invoice.InvoiceType = Convert.ToByte(dataRow.Field<string>("Column0"));
                    invoice.InvoiceNo         = Convert.ToString(dataRow.ItemArray[1]);
                    invoice.InvoiceDate       = Convert.ToDateTime(dataRow.ItemArray[2]);
                    invoice.TotalInvoiceValue = Convert.ToString(dataRow.ItemArray[3]);
                    invoice.PortCode          = Convert.ToString(dataRow.ItemArray[4]);
                    invoice.ShippingBillNo    = Convert.ToString(dataRow.ItemArray[5]);
                    invoice.ShippingBillDate  = Convert.ToDateTime(dataRow.ItemArray[6]);
                    invoice.SectionType       = sheetCode;
                }
                //at
                else if (sheetCode == 6)
                {
                    stateCode             = dataRow.ItemArray[0].ToString().Split('-')[0];
                    invoice.PlaceofSupply = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.SectionType   = sheetCode;
                }
                //atadj
                else if (sheetCode == 7)
                {
                    stateCode             = dataRow.ItemArray[0].ToString().Split('-')[0];
                    invoice.PlaceofSupply = unitOfWork.StateRepository.Filter(x => x.StateCode == stateCode).FirstOrDefault().StateID;
                    invoice.SectionType   = sheetCode;
                }
                //exemp
                else if (sheetCode == 8)
                {
                    invoice.HSNDescription = dataRow.Field <string>("Column0");
                    invoice.NilRated       = Convert.ToBoolean(dataRow.ItemArray[1]);
                    invoice.IsExempted     = Convert.ToBoolean(dataRow.ItemArray[2]);
                    invoice.NonGSTSupplies = Convert.ToBoolean(dataRow.ItemArray[3]);
                    invoice.SectionType    = sheetCode;
                }
                //hsn
                else if (sheetCode == 9)
                {
                    invoice.HSN            = Convert.ToString(dataRow.ItemArray[0]);
                    invoice.HSNDescription = dataRow.Field <string>("Column1");
                    invoice.UQC            = Convert.ToByte((EnumConstants.Unit)Enum.Parse(typeof(EnumConstants.Unit), dataRow.ItemArray[2].ToString().Split('-')[0]));//Convert.ToByte(dataRow.ItemArray[2]);
                    invoice.SectionType    = sheetCode;
                }
                invoice.UserID      = UserId;
                invoice.OfflineID   = Convert.ToInt64(offlineid);
                invoice.CreatedBy   = UserId;
                invoice.CreatedDate = DateTime.Now;
                unitOfWork.OfflineinvoiceRepository.Create(invoice);
                unitOfWork.Save();
            }


            catch (DbEntityValidationException ex)
            {
                foreach (var eve in ex.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
            }
            return(invoice);
        }