public Int64 Insert(GLATransactionDetails Details) { try { string SQL = "INSERT INTO tblgla_f_dtl_chk_headers (" + "fk_business_date," + "fk_location_def," + "fk_emp_def," + "status_flag," + "chk_headers_seq_number," + "chk_num," + "chk_id," + "ot_number," + "Ot_Name," + "Tbl_Number," + "Chk_Open_Date_Time," + "Chk_Closed_Date_Time," + "Uws_Number," + "Is_HotelMark_Promo," + "Sub_Ttl," + "Tax_Ttl," + "Auto_Svc_Ttl," + "Other_Svc_Ttl," + "Dsc_Ttl," + "Pymnt_Ttl," + "Chk_Prntd_Cnt," + "Cov_Cnt," + "Num_Dtl," + "Itemizer1," + "Itemizer2," + "Itemizer3," + "Itemizer4," + "Itemizer5," + "Itemizer6," + "Itemizer7," + "Itemizer8," + "Itemizer9," + "Itemizer10," + "Itemizer11," + "Itemizer12," + "Itemizer13," + "Itemizer14," + "Itemizer15," + "Itemizer16," + "Tip_ttl," + "DateCreated," + "CreatedBy," + "Filename," + "BatchID" + ") VALUES (" + "@fk_business_date," + "@fk_location_def," + "@fk_emp_def," + "@status_flag," + "@chk_headers_seq_number," + "@chk_num," + "@chk_id," + "@ot_number," + "@Ot_Name," + "@Tbl_Number," + "@Chk_Open_Date_Time," + "@Chk_Closed_Date_Time," + "@Uws_Number," + "@Is_HotelMark_Promo," + "@Sub_Ttl," + "@Tax_Ttl," + "@Auto_Svc_Ttl," + "@Other_Svc_Ttl," + "@Dsc_Ttl," + "@Pymnt_Ttl," + "@Chk_Prntd_Cnt," + "@Cov_Cnt," + "@Num_Dtl," + "@Itemizer1," + "@Itemizer2," + "@Itemizer3," + "@Itemizer4," + "@Itemizer5," + "@Itemizer6," + "@Itemizer7," + "@Itemizer8," + "@Itemizer9," + "@Itemizer10," + "@Itemizer11," + "@Itemizer12," + "@Itemizer13," + "@Itemizer14," + "@Itemizer15," + "@Itemizer16," + "@Tip_ttl," + "@DateCreated," + "@CreatedBy," + "@Filename," + "@BatchID);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@fk_business_date", Details.fk_business_date.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@fk_location_def", Details.fk_location_def); cmd.Parameters.AddWithValue("@fk_emp_def", Details.fk_emp_def); cmd.Parameters.AddWithValue("@status_flag", Details.status_flag); cmd.Parameters.AddWithValue("@chk_headers_seq_number", Details.chk_headers_seq_number); cmd.Parameters.AddWithValue("@chk_num", Details.chk_num); cmd.Parameters.AddWithValue("@chk_id", Details.chk_id); cmd.Parameters.AddWithValue("@ot_number", Details.ot_number); cmd.Parameters.AddWithValue("@Ot_Name", Details.Ot_Name); cmd.Parameters.AddWithValue("@Tbl_Number", Details.Tbl_Number); cmd.Parameters.AddWithValue("@Chk_Open_Date_Time", Details.Chk_Open_Date_Time.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Chk_Closed_Date_Time", Details.Chk_Closed_Date_Time.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Uws_Number", Details.Uws_Number); cmd.Parameters.AddWithValue("@Is_HotelMark_Promo", Details.Is_HotelMark_Promo); cmd.Parameters.AddWithValue("@Sub_Ttl", Details.Sub_Ttl); cmd.Parameters.AddWithValue("@Tax_Ttl", Details.Tax_Ttl); cmd.Parameters.AddWithValue("@Auto_Svc_Ttl", Details.Auto_Svc_Ttl); cmd.Parameters.AddWithValue("@Other_Svc_Ttl", Details.Other_Svc_Ttl); cmd.Parameters.AddWithValue("@Dsc_Ttl", Details.Dsc_Ttl); cmd.Parameters.AddWithValue("@Pymnt_Ttl", Details.Pymnt_Ttl); cmd.Parameters.AddWithValue("@Chk_Prntd_Cnt", Details.Chk_Prntd_Cnt); cmd.Parameters.AddWithValue("@Cov_Cnt", Details.Cov_Cnt); cmd.Parameters.AddWithValue("@Num_Dtl", Details.Num_Dtl); cmd.Parameters.AddWithValue("@Itemizer1", Details.Itemizer1); cmd.Parameters.AddWithValue("@Itemizer2", Details.Itemizer2); cmd.Parameters.AddWithValue("@Itemizer3", Details.Itemizer3); cmd.Parameters.AddWithValue("@Itemizer4", Details.Itemizer4); cmd.Parameters.AddWithValue("@Itemizer5", Details.Itemizer5); cmd.Parameters.AddWithValue("@Itemizer6", Details.Itemizer6); cmd.Parameters.AddWithValue("@Itemizer7", Details.Itemizer7); cmd.Parameters.AddWithValue("@Itemizer8", Details.Itemizer8); cmd.Parameters.AddWithValue("@Itemizer9", Details.Itemizer9); cmd.Parameters.AddWithValue("@Itemizer10", Details.Itemizer10); cmd.Parameters.AddWithValue("@Itemizer11", Details.Itemizer11); cmd.Parameters.AddWithValue("@Itemizer12", Details.Itemizer12); cmd.Parameters.AddWithValue("@Itemizer13", Details.Itemizer13); cmd.Parameters.AddWithValue("@Itemizer14", Details.Itemizer14); cmd.Parameters.AddWithValue("@Itemizer15", Details.Itemizer15); cmd.Parameters.AddWithValue("@Itemizer16", Details.Itemizer16); cmd.Parameters.AddWithValue("@Tip_ttl", Details.Tip_ttl); cmd.Parameters.AddWithValue("@DateCreated", Details.DateCreated); cmd.Parameters.AddWithValue("@CreatedBy", Details.CreatedBy); cmd.Parameters.AddWithValue("@Filename", Details.Filename); cmd.Parameters.AddWithValue("@BatchID", Details.BatchID); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID"); base.MySqlDataAdapterFill(cmd, dt); Int64 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int64.Parse(dr[0].ToString()); } return(iID); } catch (Exception ex) { throw base.ThrowException(ex); } }
private GLATransactionDetails setTranHdrDetails(string line, DateTime DateCreated, string CreatedBy, string filename, string BatchID) { DateTime dteRetvalue = Constants.C_DATE_MIN_VALUE; int intRetValue = 0; //bool boRetValue = false; decimal decRetValue = 0; GLATransactionDetails clsDetails = new GLATransactionDetails(); int iCol = 0; foreach (string col in line.Split(',')) { dteRetvalue = Constants.C_DATE_MIN_VALUE; intRetValue = 0; switch (iCol) { case 0: clsDetails.fk_business_date = DateTime.TryParse(col, out dteRetvalue) ? dteRetvalue : Constants.C_DATE_MIN_VALUE; break; case 1: clsDetails.fk_location_def = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 2: clsDetails.fk_emp_def = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 3: clsDetails.status_flag = col; break; case 4: clsDetails.chk_headers_seq_number = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 5: clsDetails.chk_num = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 6: clsDetails.chk_id = col; break; case 7: clsDetails.ot_number = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 8: clsDetails.Ot_Name = col; break; case 9: clsDetails.Tbl_Number = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 10: clsDetails.Chk_Open_Date_Time = DateTime.TryParse(col, out dteRetvalue) ? dteRetvalue : Constants.C_DATE_MIN_VALUE; break; case 11: clsDetails.Chk_Closed_Date_Time = DateTime.TryParse(col, out dteRetvalue) ? dteRetvalue : Constants.C_DATE_MIN_VALUE; break; case 12: clsDetails.Uws_Number = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 13: clsDetails.Is_HotelMark_Promo = Convert.ToBoolean(int.TryParse(col, out intRetValue) ? intRetValue : 0); break; case 14: clsDetails.Sub_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 15: clsDetails.Tax_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 16: clsDetails.Auto_Svc_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 17: clsDetails.Other_Svc_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 18: clsDetails.Dsc_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 19: clsDetails.Pymnt_Ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 20: clsDetails.Chk_Prntd_Cnt = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 21: clsDetails.Cov_Cnt = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 22: clsDetails.Num_Dtl = int.TryParse(col, out intRetValue) ? intRetValue : 0; break; case 23: clsDetails.Itemizer1 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 24: clsDetails.Itemizer2 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 25: clsDetails.Itemizer3 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 26: clsDetails.Itemizer4 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 27: clsDetails.Itemizer5 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 28: clsDetails.Itemizer6 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 29: clsDetails.Itemizer7 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 30: clsDetails.Itemizer8 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 31: clsDetails.Itemizer9 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 32: clsDetails.Itemizer10 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 33: clsDetails.Itemizer11 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 34: clsDetails.Itemizer12 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 35: clsDetails.Itemizer13 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 36: clsDetails.Itemizer14 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 37: clsDetails.Itemizer15 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 38: clsDetails.Itemizer16 = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; case 39: clsDetails.Tip_ttl = decimal.TryParse(col, out decRetValue) ? decRetValue : 0; break; } iCol++; } clsDetails.DateCreated = DateCreated; clsDetails.CreatedBy = CreatedBy; clsDetails.Filename = filename; clsDetails.BatchID = BatchID; return clsDetails; }
private SalesTransactionDetails setSalesTransactionDetails(GLATransactionDetails glaDetails) { SalesTransactionDetails mclsSalesTransactionDetails = new SalesTransactionDetails(); // for insert mclsSalesTransactionDetails.CustomerID = glaDetails.fk_emp_def; mclsSalesTransactionDetails.AgentID = Constants.C_RETAILPLUS_AGENTID; mclsSalesTransactionDetails.AgentName = Constants.C_RETAILPLUS_AGENT; mclsSalesTransactionDetails.AgentPositionName = Constants.C_RETAILPLUS_AGENT_POSITIONNAME; mclsSalesTransactionDetails.AgentDepartmentName = Constants.C_RETAILPLUS_AGENT_DEPARTMENT_NAME; mclsSalesTransactionDetails.WaiterID = Constants.C_RETAILPLUS_WAITERID; mclsSalesTransactionDetails.WaiterName = Constants.C_RETAILPLUS_WAITER; mclsSalesTransactionDetails.CreatedByID = glaDetails.fk_emp_def; mclsSalesTransactionDetails.CreatedByName = Constants.C_RETAILPLUS_WAITER; mclsSalesTransactionDetails.CashierID = glaDetails.fk_emp_def; mclsSalesTransactionDetails.CashierName = glaDetails.Filename; mclsSalesTransactionDetails.CustomerID = Constants.C_RETAILPLUS_CUSTOMERID; mclsSalesTransactionDetails.CustomerName = Constants.C_RETAILPLUS_CUSTOMER; mclsSalesTransactionDetails.TransactionDate = glaDetails.Chk_Open_Date_Time; mclsSalesTransactionDetails.DateSuspended = Constants.C_DATE_MIN_VALUE; mclsSalesTransactionDetails.TerminalNo = Constants.C_DEFAULT_TERMINAL_01; mclsSalesTransactionDetails.BranchID = Constants.BRANCH_ID_MAIN; mclsSalesTransactionDetails.BranchCode = Constants.BRANCH_MAIN; mclsSalesTransactionDetails.TransactionStatus = TransactionStatus.Closed; mclsSalesTransactionDetails.TransactionType = TransactionTypes.POSNormal; mclsSalesTransactionDetails.TransactionNo = glaDetails.chk_headers_seq_number.ToString(); //for update mclsSalesTransactionDetails.Charge = glaDetails.Auto_Svc_Ttl + glaDetails.Other_Svc_Ttl + glaDetails.Tip_ttl; mclsSalesTransactionDetails.Discount = -glaDetails.Dsc_Ttl; mclsSalesTransactionDetails.AmountDue = glaDetails.Sub_Ttl + glaDetails.Tax_Ttl + mclsSalesTransactionDetails.Charge - mclsSalesTransactionDetails.Discount; mclsSalesTransactionDetails.SubTotal = glaDetails.Sub_Ttl + glaDetails.Tax_Ttl + mclsSalesTransactionDetails.Charge; mclsSalesTransactionDetails.DiscountableAmount = mclsSalesTransactionDetails.Discount <= 0 ? 0 : glaDetails.Dsc_Ttl; mclsSalesTransactionDetails.ItemsDiscount = 0; mclsSalesTransactionDetails.VAT = glaDetails.Tax_Ttl; mclsSalesTransactionDetails.VATableAmount = glaDetails.Sub_Ttl + glaDetails.Tax_Ttl; mclsSalesTransactionDetails.NonVATableAmount = 0; mclsSalesTransactionDetails.EVAT = 0; mclsSalesTransactionDetails.EVATableAmount = 0; mclsSalesTransactionDetails.NonEVATableAmount = glaDetails.Sub_Ttl + glaDetails.Tax_Ttl; mclsSalesTransactionDetails.LocalTax = 0; mclsSalesTransactionDetails.ItemSold = glaDetails.Cov_Cnt; mclsSalesTransactionDetails.QuantitySold = glaDetails.Num_Dtl; mclsSalesTransactionDetails.AmountPaid = glaDetails.Pymnt_Ttl; mclsSalesTransactionDetails.CashPayment = mclsSalesTransactionDetails.SubTotal; mclsSalesTransactionDetails.ChangeAmount = glaDetails.Pymnt_Ttl; mclsSalesTransactionDetails.ChequePayment = 0; mclsSalesTransactionDetails.CreditCardPayment = 0; mclsSalesTransactionDetails.CreditPayment = 0; mclsSalesTransactionDetails.CreditChargeAmount = 0; mclsSalesTransactionDetails.DebitPayment = 0; mclsSalesTransactionDetails.RewardPointsPayment = 0; mclsSalesTransactionDetails.DateClosed = glaDetails.Chk_Closed_Date_Time; mclsSalesTransactionDetails.DateResumed = glaDetails.DateCreated; mclsSalesTransactionDetails.DataSource = glaDetails.BatchID; return mclsSalesTransactionDetails; }
private void Upload() { GLATransaction clsTransactionGLA = new GLATransaction(); try { string BatchID = string.Empty; List<HttpPostedFile> pfiles = new List<HttpPostedFile>(); List<string> pfilesName = new List<string>(); for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFile file = Request.Files[i]; if (file.ContentLength > 0) { pfiles.Add(file); pfilesName.Add(System.IO.Path.GetFileName(file.FileName.ToLower())); } } Label1.Text = ""; #region checking // Label1.Text += "Files to upload:"; //Label1.Text += " " if (pfilesName.IndexOf(Constants.GLA_file_batch_id) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the batch file in the upload. Filename: " + Constants.GLA_file_batch_id + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_d_dsc_def) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the discount file in the upload. Filename: " + Constants.GLA_file_d_dsc_def + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_d_emp_def) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the employees file in the upload. Filename: " + Constants.GLA_file_d_emp_def + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_d_location_def) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the location file in the upload. Filename: " + Constants.GLA_file_d_location_def + "</font></b><br />"; //do not check the item. it's ok not to upload the item //if (pfilesName.IndexOf(Constants.GLA_file_d_mi_def) < 0) // Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the menu items file in the upload. Filename: " + Constants.GLA_file_d_mi_def + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_d_svc_def) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the service charge file in the upload. Filename: " + Constants.GLA_file_d_svc_def + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_d_tmd_def) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the tender definitions file in the upload. Filename: " + Constants.GLA_file_d_tmd_def + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_dsc) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the discount details file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_dsc + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_headers) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the check information file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_headers + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_svc) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the service charge file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_svc + "</font></b><br />"; if (pfilesName.IndexOf(Constants.GLA_file_f_dtl_chk_tmd) < 0) Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the tender detail file in the upload. Filename: " + Constants.GLA_file_f_dtl_chk_tmd + "</font></b><br />"; //if (pfilesName.IndexOf(Constants.GLA_file_otntender) < 0) // Label1.Text += "<br /><br /><b><font class='ms-error'>Please include the OTN_Tender file in the upload. Filename: " + Constants.GLA_file_otntender + "</font></b><br />"; #endregion if (!string.IsNullOrEmpty(Label1.Text)) return; string strfile = ""; string strfolder = "/RetailPlus/temp/uploaded/gla/"; Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"]; DateTime DateCreated = DateTime.Now; int iTranCount = 0; #region Constants.GLA_file_batch if (1==1) //process batchfile { strfile = Server.MapPath(strfolder + Constants.GLA_file_batch_id); if (System.IO.File.Exists(strfile)) System.IO.File.Delete(strfile); pfiles[pfilesName.IndexOf(Constants.GLA_file_batch_id)].SaveAs(strfile); using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { //get the firstline as the batchid BatchID = line; break; } } } if (string.IsNullOrEmpty(BatchID)) { Label1.Text += "<br /><br /><b><font class='ms-error'>Cannot get any information from batch file. Please double check the batch file: " + Constants.GLA_file_batch_id + "</font></b><br />"; return; } Label1.Text += "<br /><br /><b><font class='ms-error'>Uploading Batch ID: " + BatchID + "</font></b><br />"; #endregion #region saveallfiles // delete the temporary batch file if (System.IO.File.Exists(strfile)) System.IO.File.Delete(strfile); // save it again in a folder strfolder = strfolder + BatchID + "/"; foreach (HttpPostedFile pfile in pfiles) { strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(pfile.FileName)); if (!System.IO.Directory.Exists(Server.MapPath(strfolder))) System.IO.Directory.CreateDirectory(Server.MapPath(strfolder)); if (System.IO.File.Exists(strfile)) System.IO.File.Delete(strfile); pfile.SaveAs(strfile); } //pfiles[pfilesName.IndexOf(Constants.GLA_file_batch)].SaveAs(strfile); //pfiles[pfilesName.IndexOf(Constants.GLA_file_batch)].SaveAs(strfile + Constants.GLA_file_batch); #endregion #region GLA_file_d_dsc_def /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_d_dsc_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_dsc_def)); IList<GLADiscountDetails> lstGLADiscountDetails = new List<GLADiscountDetails>(); GLADiscountDetails clsGLADiscountDetails = new GLADiscountDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLADiscountDetails = setDscDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_dsc_def, BatchID); lstGLADiscountDetails.Add(clsGLADiscountDetails); iTranCount++; } } GLADiscount clsGLADiscount = new GLADiscount(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLADiscount.Delete(BatchID); foreach (GLADiscountDetails det in lstGLADiscountDetails) { clsGLADiscount.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLADiscountDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; #endregion #region GLA_file_d_emp_def /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_d_emp_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_emp_def)); IList<GLAEmployeeDetails> lstGLAEmployeeDetails = new List<GLAEmployeeDetails>(); GLAEmployeeDetails clsGLAEmployeeDetails = new GLAEmployeeDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLAEmployeeDetails = setEmpDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_emp_def, BatchID); lstGLAEmployeeDetails.Add(clsGLAEmployeeDetails); iTranCount++; } } GLAEmployee clsGLAEmployee = new GLAEmployee(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLAEmployee.Delete(BatchID); foreach (GLAEmployeeDetails det in lstGLAEmployeeDetails) { clsGLAEmployee.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLAEmployeeDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_d_location_def /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_d_location_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_location_def)); IList<GLALocationDetails> lstGLALocationDetails = new List<GLALocationDetails>(); GLALocationDetails clsGLALocationDetails = new GLALocationDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLALocationDetails = setLocDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_location_def, BatchID); lstGLALocationDetails.Add(clsGLALocationDetails); iTranCount++; } } GLALocation clsGLALocation = new GLALocation(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLALocation.Delete(BatchID); foreach (GLALocationDetails det in lstGLALocationDetails) { clsGLALocation.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLALocationDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_d_mi_def /***** upload the transaction *****/ if (pfilesName.IndexOf(Constants.GLA_file_d_mi_def) >= 0) { Label1.Text += "Processing " + Constants.GLA_file_d_mi_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_mi_def)); IList<GLAItemDetails> lstGLAItemDetails = new List<GLAItemDetails>(); GLAItemDetails clsGLAItemDetails = new GLAItemDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLAItemDetails = setItemDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_mi_def, BatchID); lstGLAItemDetails.Add(clsGLAItemDetails); iTranCount++; } } if (lstGLAItemDetails.Count > 0) { GLAItem clsGLAItem = new GLAItem(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLAItem.Delete(BatchID); foreach (GLAItemDetails det in lstGLAItemDetails) { clsGLAItem.Insert(det); } } Label1.Text += " <b><font class='ms-error'>" + lstGLAItemDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; } /***** upload the discount end *****/ #endregion #region GLA_file_d_svc_def /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_d_svc_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_svc_def)); IList<GLAServiceChargeDetails> lstGLAServiceChargeDetails = new List<GLAServiceChargeDetails>(); GLAServiceChargeDetails clsGLAServiceChargeDetailss = new GLAServiceChargeDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLAServiceChargeDetailss = setSvcDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_svc_def, BatchID); lstGLAServiceChargeDetails.Add(clsGLAServiceChargeDetailss); iTranCount++; } } GLAServiceCharge clsGLAServiceCharge = new GLAServiceCharge(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLAServiceCharge.Delete(BatchID); foreach (GLAServiceChargeDetails det in lstGLAServiceChargeDetails) { clsGLAServiceCharge.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLAServiceChargeDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_d_tmd_def /***** upload the tenders *****/ Label1.Text += "Processing " + Constants.GLA_file_d_tmd_def + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_d_tmd_def)); IList<GLATenderDetails> lstGLATenderDetails = new List<GLATenderDetails>(); GLATenderDetails clsGLATenderDetails = new GLATenderDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATenderDetails = setTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_d_tmd_def, BatchID); lstGLATenderDetails.Add(clsGLATenderDetails); iTranCount++; } } GLATender clsGLATender = new GLATender(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLATender.Delete(BatchID); foreach (GLATenderDetails det in lstGLATenderDetails) { clsGLATender.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATenderDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_f_dtl_chk_dsc /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_dsc + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_dsc)); IList<GLATransactionDiscountDetails> lstGLATransactionDiscountDetails = new List<GLATransactionDiscountDetails>(); IList<GLATransactionDiscountDetails> lstGLATransactionDiscountDetailsContactCode = new List<GLATransactionDiscountDetails>(); GLATransactionDiscountDetails clsGLATransactionDiscountDetails = new GLATransactionDiscountDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATransactionDiscountDetails = setTranDscDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_dsc, BatchID); lstGLATransactionDiscountDetails.Add(clsGLATransactionDiscountDetails); if (!string.IsNullOrEmpty(clsGLATransactionDiscountDetails.ContactCode)) lstGLATransactionDiscountDetailsContactCode.Add(clsGLATransactionDiscountDetails); iTranCount++; } } GLATransactionDiscount clsGLATransactionDiscount = new GLATransactionDiscount(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLADiscount.Delete(BatchID); foreach (GLATransactionDiscountDetails det in lstGLATransactionDiscountDetails) { clsGLATransactionDiscount.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionDiscountDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_f_dtl_chk_headers /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_headers + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_headers)); List<GLATransactionDetails> lstGLATransactionDetails = new List<GLATransactionDetails>(); GLATransactionDetails clsGLATransactionDetails = new GLATransactionDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATransactionDetails = setTranHdrDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_headers, BatchID); lstGLATransactionDetails.Add(clsGLATransactionDetails); iTranCount++; } } GLATransaction clsGLATransaction = new GLATransaction(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLATransaction.Delete(BatchID); foreach (GLATransactionDetails det in lstGLATransactionDetails) { clsGLATransaction.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the transaction end *****/ #endregion #region GLA_file_f_dtl_chk_mi /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_mi + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_mi)); IList<GLATransactionItemDetails> lstGLATransactionItemDetails = new List<GLATransactionItemDetails>(); IList<GLATransactionItemDetails> lstGLATransactionItemDetailsContactCode = new List<GLATransactionItemDetails>(); GLATransactionItemDetails clsGLATransactionItemDetails = new GLATransactionItemDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATransactionItemDetails = setTranItemDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_mi, BatchID); lstGLATransactionItemDetails.Add(clsGLATransactionItemDetails); iTranCount++; } } GLATransactionItem clsGLATransactionItem = new GLATransactionItem(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLATransactionItem.Delete(BatchID); foreach (GLATransactionItemDetails det in lstGLATransactionItemDetails) { clsGLATransactionItem.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionItemDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_f_dtl_chk_svc /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_svc + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_svc)); IList<GLATransactionSvcDetails> lstGLATransactionSvcDetails = new List<GLATransactionSvcDetails>(); IList<GLATransactionSvcDetails> lstGLATransactionSvcDetailsContactCode = new List<GLATransactionSvcDetails>(); GLATransactionSvcDetails clsGLATransactionSvcDetails = new GLATransactionSvcDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATransactionSvcDetails = setTranSvcDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_svc, BatchID); lstGLATransactionSvcDetails.Add(clsGLATransactionSvcDetails); iTranCount++; } } GLATransactionSvc clsGLATransactionSvc = new GLATransactionSvc(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLATransactionSvc.Delete(BatchID); foreach (GLATransactionSvcDetails det in lstGLATransactionSvcDetails) { clsGLATransactionSvc.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionSvcDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region GLA_file_f_dtl_chk_tmd /***** upload the transaction *****/ Label1.Text += "Processing " + Constants.GLA_file_f_dtl_chk_tmd + " ..."; strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_f_dtl_chk_tmd)); IList<GLATransactionTenderDetails> lstGLATransactionTenderDetails = new List<GLATransactionTenderDetails>(); IList<GLATransactionTenderDetails> lstGLATransactionTenderDetailsContactCode = new List<GLATransactionTenderDetails>(); GLATransactionTenderDetails clsGLATransactionTenderDetails = new GLATransactionTenderDetails(); iTranCount = 0; using (var reader = new StreamReader(strfile)) { string line; while ((line = reader.ReadLine()) != null) { clsGLATransactionTenderDetails = setTranTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_f_dtl_chk_tmd, BatchID); lstGLATransactionTenderDetails.Add(clsGLATransactionTenderDetails); iTranCount++; } } GLATransactionTender clsGLATransactionTender = new GLATransactionTender(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsGLATransactionTender.Delete(BatchID); foreach (GLATransactionTenderDetails det in lstGLATransactionTenderDetails) { clsGLATransactionTender.Insert(det); } Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionTenderDetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; /***** upload the discount end *****/ #endregion #region clsTransaction Label1.Text += "Processing transactions by members... "; Data.SalesTransactions clsTransaction = new SalesTransactions(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); clsTransaction.DeleteByDataSource(BatchID); clsTransactionGLA.ProcessBatch(BatchID); Label1.Text += " <b><font class='ms-error'>" + lstGLATransactionDiscountDetailsContactCode.Count.ToString() + " has been successfully uploaded...</font></b><br />"; #endregion #region GLA_file_otntender ///***** upload the otn tender *****/ //Label1.Text += "Processing " + Constants.GLA_file_otntender + " ..."; //strfile = Server.MapPath(strfolder + System.IO.Path.GetFileName(Constants.GLA_file_otntender)); //List<OrderTenderGLADetails> lstOrderTenderGLADetails = new List<OrderTenderGLADetails>(); //OrderTenderGLADetails clsOrderTenderGLADetails = new OrderTenderGLADetails(); //iTranCount = 0; //using (var reader = new StreamReader(strfile)) //{ // string line; // while ((line = reader.ReadLine()) != null) // { // clsOrderTenderGLADetails = setOrderTenderDetails(line, DateCreated, clsAccessUserDetails.Name, Constants.GLA_file_otntender, BatchID); // lstOrderTenderGLADetails.Add(clsOrderTenderGLADetails); // iTranCount++; // } //} //OrderTenderGLA clsOrderTenderGLA = new OrderTenderGLA(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); //Data.Contacts clsContacts = new Contacts(clsTransactionGLA.Connection, clsTransactionGLA.Transaction); //Data.ContactDetails clsContactDetails = new ContactDetails(); //foreach (OrderTenderGLADetails det in lstOrderTenderGLADetails) //{ // clsOrderTenderGLA.Insert(det); // clsSalesTransactionDetails = clsTransaction.Details(det.tender_seq.ToString(), Constants.C_DEFAULT_TERMINAL_01, Constants.BRANCH_ID_MAIN); // // update the customer information // clsSalesTransactionDetails = setSalesTransactionDetails(det, clsSalesTransactionDetails); // clsContactDetails = clsContacts.Details(det.auth_acct_no); // clsTransaction.UpdateContact(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.TransactionDate, clsContactDetails); // //clsTransaction.Close(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.SubTotal, clsSalesTransactionDetails.ItemsDiscount, clsSalesTransactionDetails.Discount, clsSalesTransactionDetails.TransDiscount, clsSalesTransactionDetails.TransDiscountType, clsSalesTransactionDetails.VAT, clsSalesTransactionDetails.VatableAmount, clsSalesTransactionDetails.EVAT, clsSalesTransactionDetails.EVatableAmount, clsSalesTransactionDetails.LocalTax, clsSalesTransactionDetails.AmountPaid, clsSalesTransactionDetails.CashPayment, clsSalesTransactionDetails.ChequePayment, clsSalesTransactionDetails.CreditCardPayment, clsSalesTransactionDetails.CreditPayment, clsSalesTransactionDetails.DebitPayment, clsSalesTransactionDetails.RewardPointsPayment, clsSalesTransactionDetails.RewardConvertedPayment, clsSalesTransactionDetails.BalanceAmount, clsSalesTransactionDetails.ChangeAmount, clsSalesTransactionDetails.PaymentType, clsSalesTransactionDetails.DiscountCode, clsSalesTransactionDetails.DiscountRemarks, clsSalesTransactionDetails.Charge, clsSalesTransactionDetails.ChargeAmount, clsSalesTransactionDetails.ChargeCode, clsSalesTransactionDetails.ChargeRemarks, clsSalesTransactionDetails.CashierID, clsSalesTransactionDetails.CashierName); // //clsTransaction.UpdateDateClosed(clsSalesTransactionDetails.TransactionID, clsSalesTransactionDetails.DateClosed); //} //Label1.Text += " <b><font class='ms-error'>" + lstOrderTenderGLADetails.Count.ToString() + " has been successfully uploaded...</font></b><br />"; #endregion clsTransactionGLA.CommitAndDispose(); } catch (Exception ex){ clsTransactionGLA.ThrowException(ex); throw ex; } }
public Int64 Insert(GLATransactionDetails Details) { try { string SQL = "INSERT INTO tblgla_f_dtl_chk_headers (" + "fk_business_date," + "fk_location_def," + "fk_emp_def," + "status_flag," + "chk_headers_seq_number," + "chk_num," + "chk_id," + "ot_number," + "Ot_Name," + "Tbl_Number," + "Chk_Open_Date_Time," + "Chk_Closed_Date_Time," + "Uws_Number," + "Is_HotelMark_Promo," + "Sub_Ttl," + "Tax_Ttl," + "Auto_Svc_Ttl," + "Other_Svc_Ttl," + "Dsc_Ttl," + "Pymnt_Ttl," + "Chk_Prntd_Cnt," + "Cov_Cnt," + "Num_Dtl," + "Itemizer1," + "Itemizer2," + "Itemizer3," + "Itemizer4," + "Itemizer5," + "Itemizer6," + "Itemizer7," + "Itemizer8," + "Itemizer9," + "Itemizer10," + "Itemizer11," + "Itemizer12," + "Itemizer13," + "Itemizer14," + "Itemizer15," + "Itemizer16," + "Tip_ttl," + "DateCreated," + "CreatedBy," + "Filename," + "BatchID" + ") VALUES (" + "@fk_business_date," + "@fk_location_def," + "@fk_emp_def," + "@status_flag," + "@chk_headers_seq_number," + "@chk_num," + "@chk_id," + "@ot_number," + "@Ot_Name," + "@Tbl_Number," + "@Chk_Open_Date_Time," + "@Chk_Closed_Date_Time," + "@Uws_Number," + "@Is_HotelMark_Promo," + "@Sub_Ttl," + "@Tax_Ttl," + "@Auto_Svc_Ttl," + "@Other_Svc_Ttl," + "@Dsc_Ttl," + "@Pymnt_Ttl," + "@Chk_Prntd_Cnt," + "@Cov_Cnt," + "@Num_Dtl," + "@Itemizer1," + "@Itemizer2," + "@Itemizer3," + "@Itemizer4," + "@Itemizer5," + "@Itemizer6," + "@Itemizer7," + "@Itemizer8," + "@Itemizer9," + "@Itemizer10," + "@Itemizer11," + "@Itemizer12," + "@Itemizer13," + "@Itemizer14," + "@Itemizer15," + "@Itemizer16," + "@Tip_ttl," + "@DateCreated," + "@CreatedBy," + "@Filename," + "@BatchID);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@fk_business_date", Details.fk_business_date.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@fk_location_def", Details.fk_location_def); cmd.Parameters.AddWithValue("@fk_emp_def", Details.fk_emp_def); cmd.Parameters.AddWithValue("@status_flag", Details.status_flag); cmd.Parameters.AddWithValue("@chk_headers_seq_number", Details.chk_headers_seq_number); cmd.Parameters.AddWithValue("@chk_num", Details.chk_num); cmd.Parameters.AddWithValue("@chk_id", Details.chk_id); cmd.Parameters.AddWithValue("@ot_number", Details.ot_number); cmd.Parameters.AddWithValue("@Ot_Name", Details.Ot_Name); cmd.Parameters.AddWithValue("@Tbl_Number", Details.Tbl_Number); cmd.Parameters.AddWithValue("@Chk_Open_Date_Time", Details.Chk_Open_Date_Time.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Chk_Closed_Date_Time", Details.Chk_Closed_Date_Time.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Uws_Number", Details.Uws_Number); cmd.Parameters.AddWithValue("@Is_HotelMark_Promo", Details.Is_HotelMark_Promo); cmd.Parameters.AddWithValue("@Sub_Ttl", Details.Sub_Ttl); cmd.Parameters.AddWithValue("@Tax_Ttl", Details.Tax_Ttl); cmd.Parameters.AddWithValue("@Auto_Svc_Ttl", Details.Auto_Svc_Ttl); cmd.Parameters.AddWithValue("@Other_Svc_Ttl", Details.Other_Svc_Ttl); cmd.Parameters.AddWithValue("@Dsc_Ttl", Details.Dsc_Ttl); cmd.Parameters.AddWithValue("@Pymnt_Ttl", Details.Pymnt_Ttl); cmd.Parameters.AddWithValue("@Chk_Prntd_Cnt", Details.Chk_Prntd_Cnt); cmd.Parameters.AddWithValue("@Cov_Cnt", Details.Cov_Cnt); cmd.Parameters.AddWithValue("@Num_Dtl", Details.Num_Dtl); cmd.Parameters.AddWithValue("@Itemizer1", Details.Itemizer1); cmd.Parameters.AddWithValue("@Itemizer2", Details.Itemizer2); cmd.Parameters.AddWithValue("@Itemizer3", Details.Itemizer3); cmd.Parameters.AddWithValue("@Itemizer4", Details.Itemizer4); cmd.Parameters.AddWithValue("@Itemizer5", Details.Itemizer5); cmd.Parameters.AddWithValue("@Itemizer6", Details.Itemizer6); cmd.Parameters.AddWithValue("@Itemizer7", Details.Itemizer7); cmd.Parameters.AddWithValue("@Itemizer8", Details.Itemizer8); cmd.Parameters.AddWithValue("@Itemizer9", Details.Itemizer9); cmd.Parameters.AddWithValue("@Itemizer10", Details.Itemizer10); cmd.Parameters.AddWithValue("@Itemizer11", Details.Itemizer11); cmd.Parameters.AddWithValue("@Itemizer12", Details.Itemizer12); cmd.Parameters.AddWithValue("@Itemizer13", Details.Itemizer13); cmd.Parameters.AddWithValue("@Itemizer14", Details.Itemizer14); cmd.Parameters.AddWithValue("@Itemizer15", Details.Itemizer15); cmd.Parameters.AddWithValue("@Itemizer16", Details.Itemizer16); cmd.Parameters.AddWithValue("@Tip_ttl", Details.Tip_ttl); cmd.Parameters.AddWithValue("@DateCreated", Details.DateCreated); cmd.Parameters.AddWithValue("@CreatedBy", Details.CreatedBy); cmd.Parameters.AddWithValue("@Filename", Details.Filename); cmd.Parameters.AddWithValue("@BatchID", Details.BatchID); base.ExecuteNonQuery(cmd); SQL = "SELECT LAST_INSERT_ID();"; cmd.Parameters.Clear(); cmd.CommandText = SQL; System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID"); base.MySqlDataAdapterFill(cmd, dt); Int64 iID = 0; foreach (System.Data.DataRow dr in dt.Rows) { iID = Int64.Parse(dr[0].ToString()); } return iID; } catch (Exception ex) { throw base.ThrowException(ex); } }