public string ConcateStringHSS02007(CUSTOM_S02007_TEMP HS) { StringBuilder strHS = new StringBuilder(1000); strHS.Append("HS|"); strHS.Append(HS.PONUMBER); strHS.Append("|"); strHS.Append(HS.VERSIONPOSERA); strHS.Append("|"); strHS.Append(HS.BILLINGNO); strHS.Append("|"); strHS.Append(HS.INVOICERECEIPTDATE == null ? "19000101" : string.Format("{0:yyyyMMdd}", HS.INVOICERECEIPTDATE)); strHS.Append("|"); strHS.Append(HS.DATAVERSION); strHS.Append("|"); strHS.Append(HS.payPlan == null ? "19000101" : string.Format("{0:yyyyMMdd}", HS.payPlan)); return(strHS.ToString()); }
public int DeleteTempHSS02007(CUSTOM_S02007_TEMP tempHS) { int result = 1; try { EntityCommand cmd = new EntityCommand("EProcEntities.sp_DeleteTempHSS02007", entityConnection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PONUMBER", DbType.String).Value = tempHS.PONUMBER; OpenConnection(); cmd.ExecuteNonQuery(); } catch (Exception ex) { result = 0; throw ex; } finally { CloseConnection(); } return(result); }
public List <CUSTOM_S02007_TEMP> CheckingHistoryHS(List <CUSTOM_S02007_TEMP> tempHS) { LogEvent logEvent = new LogEvent(); List <CUSTOM_S02007_TEMP> listDataHS = new List <CUSTOM_S02007_TEMP>(); try { if (tempHS.Count > 0) { listDataHS = tempHS; var existingRow = (from o in tempHS where entities.CUSTOM_S02007.Any(e => o.PONUMBER == e.PONUMBER) select new S02007ViewModel { PONUMBER = o.PONUMBER, VERSIONPOSERA = o.VERSIONPOSERA, BILLINGNO = o.BILLINGNO, INVOICERECEIPTDATE = o.INVOICERECEIPTDATE, DATAVERSION = o.DATAVERSION, CompanyCodeAI = o.CompanyCodeAI, payPlan = o.payPlan }).ToList(); for (int i = 0; i < existingRow.Count; i++) { string existPoNumber = existingRow[i].PONUMBER; var q = (from o in entities.CUSTOM_S02007 where o.PONUMBER == existPoNumber select new S02007ViewModel { PONUMBER = o.PONUMBER, VERSIONPOSERA = o.VERSIONPOSERA, BILLINGNO = o.BILLINGNO, INVOICERECEIPTDATE = o.INVOICERECEIPTDATE, DATAVERSION = o.DATAVERSION, payPlan = o.payPlan }).SingleOrDefault(); var compare = EqualS02007HS(existingRow[i], q); //jika ada yg beda di salah satu field atau lebih, maka update list if (!compare) { //removeat(index) var rowDel = (from o in listDataHS where o.PONUMBER == existingRow[i].PONUMBER select o).SingleOrDefault(); listDataHS.Remove(rowDel); CUSTOM_S02007_TEMP row = new CUSTOM_S02007_TEMP(); row.PONUMBER = existingRow[i].PONUMBER; row.VERSIONPOSERA = existingRow[i].VERSIONPOSERA; //q.VERSIONPOSERA != null ? q.VERSIONPOSERA + 1 : existingRow[i].VERSIONPOSERA != null ? existingRow[i].VERSIONPOSERA : 1; row.BILLINGNO = existingRow[i].BILLINGNO; row.INVOICERECEIPTDATE = existingRow[i].INVOICERECEIPTDATE; row.DATAVERSION = q.DATAVERSION != null ? q.DATAVERSION + 1 : existingRow[i].DATAVERSION != null ? existingRow[i].DATAVERSION : 1; row.CompanyCodeAI = existingRow[i].CompanyCodeAI; row.payPlan = existingRow[i].payPlan; listDataHS.Add(row); } else { //removeat(index) var rowDel = (from o in listDataHS where o.PONUMBER == existingRow[i].PONUMBER select o).SingleOrDefault(); listDataHS.Remove(rowDel); } } } } catch (Exception ex) { //add task kill : by fhi 05.06.2014 logEvent.WriteDBLog("", "UploadS02007_Load", false, "", ex.Message, "S02007", "SERA"); Process.Start("taskkill.exe", "/f /im B2BAISERA_S02007.exe"); //end throw ex; } return(listDataHS); }