//protected void lkbDelete_Click(object sender, EventArgs e) //{ // } //Eti protected void lv_AuditTrail_ItemUpdating(object sender, ListViewUpdateEventArgs e) { LinkButton lkbDelete = (lv_AuditTrail.Items[e.ItemIndex].FindControl("lkbDelete")) as LinkButton; if (lkbDelete.CommandName == "Update") { int auditTrailIda = Convert.ToInt32(lkbDelete.CommandArgument); GST_TRN_OFFLINE_INVOICE_AUDIT_TRAIL auditTrail = unitOfWork.OfflineAudittrailRepository.Filter(f => f.AuditTrailID == auditTrailIda).SingleOrDefault(); auditTrail.Status = Convert.ToByte(EnumConstants.Status.Deactive); unitOfWork.OfflineAudittrailRepository.Update(auditTrail); unitOfWork.Save(); BindItems(); } }
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { try { Page.Validate(); bool datadone = (bool)Session["datadone"]; if (Page.IsValid && !datadone) { Session["datadone"] = true; string filePath = "~/Offline/" + e.FileName; GST_TRN_OFFLINE_INVOICE_AUDIT_TRAIL Auditrail; GST_TRN_OFFLINE offlineupload; string xml = string.Empty; if (AsyncFileUpload1.FailedValidation) { uc_sucess.ErrorMessage = "Your File Have Some Errors"; uc_sucess.Visible = true; } else if (!AsyncFileUpload1.HasFile) { uc_sucess.ErrorMessage = "Please Select File First"; uc_sucess.Visible = true; } else { Auditrail = new GST_TRN_OFFLINE_INVOICE_AUDIT_TRAIL(); offlineupload = new GST_TRN_OFFLINE(); Auditrail.ExcelName = e.FileName; Auditrail.JobName = e.FileName; Auditrail.CreatedBy = Common.LoggedInUserID(); Auditrail.CreatedDate = DateTime.Now; int MonthId = Convert.ToInt32(Session["MonthId"]); Auditrail.Month = Convert.ToByte(MonthId); Auditrail.Status = 1; Auditrail.UserID = unitOfwork.AspnetRepository.Find(x => x.GSTNNo == txtGstNo.Text).Id; Auditrail.InvoiceDate = DateTime.Now; var audittrailSaved = unitOfwork.OfflineAudittrailRepository.Create(Auditrail); //// getting the max audit trailID based on logged in user //// placed into // Session[""]=unitOfwork.OfflineAudittrailRepository.Find(a=>a.AuditTrailID wherer unitOfwork.Save(); Session["AuditTrailId"] = audittrailSaved.AuditTrailID; uc_B2B_Invoices.AuditTrailId = Convert.ToInt16(Session["AuditTrailId"].ToString()); //xml = ds.GetXml(); offlineupload.CreatedBy = Common.LoggedInUserID(); offlineupload.CreatedDate = DateTime.Now; offlineupload.AggregateTurnover = Convert.ToDecimal(txtTurnover.Text.Trim()); offlineupload.AggregateTurnoverQuater = Convert.ToDecimal(txtTurnoverAToJ.Text.Trim()); offlineupload.FileType = Convert.ToByte(ddlGST.SelectedValue.ToString()); offlineupload.SupplierGSTIN = txtGstNo.Text.Trim(); offlineupload.Month = Convert.ToByte(MonthId); offlineupload.Fin_ID = Convert.ToInt32(ddlfinYear.SelectedValue.ToString()); offlineupload.UploadedBy = Common.LoggedInUserID(); offlineupload.UploadStatus = 1; offlineupload.Section = 0; offlineupload.AuditTrailID = Auditrail.AuditTrailID; // finyear.ExcelData = xml; unitOfwork.OfflineRepository.Create(offlineupload); unitOfwork.Save(); filePath = "~/Offline/" + AsyncFileUpload1.FileName; //ds = cls_ExcelReader.ExcelReadDataSet(Server.MapPath(filePath)); uc_sucess.SuccessMessage = "Import file return successfully."; uc_sucess.Visible = true; AsyncFileUpload1.SaveAs(Server.MapPath(filePath)); // SaveOfflineData(filePath) ; // offlineObj.SaveOfflineData(ds, txtGstNo.Text.Trim(), Common.LoggedInUserID()); DataSet ds = cls_ExcelReader.ExcelReadDataSet(Server.MapPath(filePath)); ofline.SaveExcelOffLineData(ds, txtGstNo.Text.Trim(), Common.LoggedInUserID(), offlineupload.OfflineID.ToString()); } } else { throw new Exception(); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }