protected void lv_Adjust_Advances_ItemDataBound(object sender, ListViewItemEventArgs e) { try { uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); uc_SupplyType.ddlPos_enable = false; HiddenField hdnPos = (HiddenField)e.Item.FindControl("hdnPos"); if (hdnPos.Value != null && hdnPos.Value != "") { uc_SupplyType.ddlPos_SelectedValue = hdnPos.Value; } //supply type HiddenField HdnSupply = (HiddenField)e.Item.FindControl("HdnSupply"); if (HdnSupply.Value != null && HdnSupply.Value != "") { uc_SupplyType.ddlSupplyType_SelectedValue = HdnSupply.Value; } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void lv_B2b_Invoice_ItemCreated(object sender, ListViewItemEventArgs e) { try { uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); DropDownList ddl_InvoiceType = (DropDownList)e.Item.FindControl("ddl_InvoiceType"); if (ddl_InvoiceType != null) { foreach (EnumConstants.InvoiceType r in Enum.GetValues(typeof(EnumConstants.InvoiceType))) { ListItem item = new ListItem(Enum.GetName(typeof(EnumConstants.InvoiceType), r), Convert.ToByte(r).ToString()); ddl_InvoiceType.Items.Add(item); } ddl_InvoiceType.Items.Insert(0, new ListItem(" [ SELECT ] ", "-1")); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
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()); } }
protected void lv_crdrRegister_ItemDataBound(object sender, ListViewItemEventArgs e) { try { if (lv_crdrRegister.EditIndex == (e.Item as ListViewDataItem).DataItemIndex) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("InvoiceNo")); //dt.Rows.Add("InvoiceNo"); } uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); if (Convert.ToInt32(Session["DisplayIndex"]) != e.Item.DisplayIndex) { uc_SupplyType.ddlPos_enable = false; } else { uc_SupplyType.ddlPos_enable = true; Session["DisplayIndex"] = -1; } //Place of Supply HiddenField hdnPos = (HiddenField)e.Item.FindControl("hdnPos"); if (hdnPos.Value != null && hdnPos.Value != "") { uc_SupplyType.ddlPos_SelectedValue = hdnPos.Value; } //Supply Type HiddenField hdnSupplyType = (HiddenField)e.Item.FindControl("hdnSupplyType"); if (hdnSupplyType.Value != null && hdnSupplyType.Value != "") { uc_SupplyType.ddlSupplyType_SelectedValue = hdnSupplyType.Value; } // Document type DropDownList ddl_DocumentType = (DropDownList)e.Item.FindControl("ddl_DocumentType"); HiddenField hdnDoc = (HiddenField)e.Item.FindControl("hdnDoc"); if (hdnDoc.Value != null && hdnDoc.Value != "") { ddl_DocumentType.Items.FindByValue(hdnDoc.Value).Selected = true; } // Reason for issuing note DropDownList ddl_IssuingNote = (DropDownList)e.Item.FindControl("ddl_IssuingNote"); HiddenField hdnIssuingNote = (HiddenField)e.Item.FindControl("hdnIssuingNote"); if (hdnIssuingNote.Value != null && hdnIssuingNote.Value != "") { ddl_IssuingNote.Items.FindByValue(hdnIssuingNote.Value).Selected = true; } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void lv_B2b_Invoice_ItemDataBound(object sender, ListViewItemEventArgs e) { try { if (lv_B2b_Invoice.EditIndex == (e.Item as ListViewDataItem).DataItemIndex) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("InvoiceNo")); //dt.Rows.Add("InvoiceNo"); } //DropDownList ddlPos = (DropDownList)e.Item.FindControl("ddlPos"); uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); if (Convert.ToInt32(DisplayIndex) != e.Item.DisplayIndex) { uc_SupplyType.ddlPos_enable = false; } else { uc_SupplyType.ddlPos_enable = true; } HiddenField hdnPos = (HiddenField)e.Item.FindControl("hdnPos"); if (hdnPos.Value != null && hdnPos.Value != "") { uc_SupplyType.ddlPos_SelectedValue = hdnPos.Value; } //ddlPos.Items.FindByValue(hdnPos.Value).Selected = true; //supply type //DropDownList ddl_SupplyType = (DropDownList)e.Item.FindControl("ddl_SupplyType"); HiddenField hdnSupplyType = (HiddenField)e.Item.FindControl("hdnSupplyType"); if (hdnSupplyType.Value != null && hdnSupplyType.Value != "") { uc_SupplyType.ddlSupplyType_SelectedValue = hdnSupplyType.Value; } // ddl_SupplyType.Items.FindByValue(hdnSupplyType.Value).Selected = true; //Invoice Type DropDownList ddl_InvoiceType = (DropDownList)e.Item.FindControl("ddl_InvoiceType"); HiddenField hdnInvoiceType = (HiddenField)e.Item.FindControl("hdnInvoiceType"); if (hdnInvoiceType.Value != null && hdnInvoiceType.Value != "") { ddl_InvoiceType.Items.FindByValue(hdnInvoiceType.Value).Selected = true; } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void lv_Tax_Liability_ItemCreated(object sender, ListViewItemEventArgs e) { try { uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void lv_crdrRegister_ItemCreated(object sender, ListViewItemEventArgs e) { try { uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); uc_SupplyType.BindItems(); // Document Type DropDownList ddl_DocumentType = (DropDownList)e.Item.FindControl("ddl_DocumentType"); if (ddl_DocumentType != null) { foreach (EnumConstants.NoteType r in Enum.GetValues(typeof(EnumConstants.NoteType))) { ddl_DocumentType.Items.Add(new ListItem(Enum.GetName(typeof(EnumConstants.NoteType), r), Convert.ToString(r).ToString())); } ddl_DocumentType.Items.Insert(0, new ListItem(" [SELECT] ", "-1")); } // Reason for issuing note DropDownList ddl_IssuingNote = (DropDownList)e.Item.FindControl("ddl_IssuingNote"); if (ddl_IssuingNote != null) { var data = unitOfwork.OfflineissuingnoteRepository.All().ToList(); data.Insert(0, new GST_TRN_OFFLINE_ISSUINGNOTE_REASON { IssuingNoteName = "[ SELECT ]", NoteID = -1 }); ddl_IssuingNote.DataSource = data; ddl_IssuingNote.DataTextField = "IssuingNoteName"; ddl_IssuingNote.DataValueField = "NoteID"; ddl_IssuingNote.DataBind(); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
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()); } }
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()); } }
protected void lv_crdrRegister_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.CreditDebitReg; uc_SupplyType uc_SupplyType = (uc_SupplyType)e.Item.FindControl("uc_SupplyType"); TextBox txtRcvrGSTIN = (e.Item.FindControl("txtRcvrGSTIN")) as TextBox; if (txtRcvrGSTIN.Text != null) { obj.ReceiverGSTIN = txtRcvrGSTIN.Text.Trim(); } 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 != "-") { obj.Voucher_date = DateTime.ParseExact(txt_VoucherDate.Text, "dd/MM/yyyy", null); } 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; } 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 != null) { obj.Voucher_Value = txt_VoucherValue.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); } CheckBox chk_PreGST = (e.Item.FindControl("chk_PreGST")) as CheckBox; obj.Pre_GST = chk_PreGST.Checked; } //viveksinha-start obj.UserID = Common.LoggedInUserID(); obj.CreatedDate = DateTime.Now; obj.CreatedBy = Common.LoggedInUserID(); //end unitOfwork.OfflineinvoiceRepository.Create(obj); unitOfwork.Save(); lv_crdrRegister.EditIndex = -1; //lv_crdrRegister.EditIndex++; BindItems(ReturnType); lkbDelete.Visible = true; } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }