private ShuratHaklada CreateShuratHakladaHavshavshevet(string line) { ShuratHaklada shurat_haklada = new ShuratHaklada(); int pos = 0; String CountryID = Convert.ToInt32(line.Substring(pos, 4)).ToString(); pos += 4; String CompanyVAT = line.Substring(pos, 9); pos += 9; String CompanyName = line.Substring(pos, 30); pos += 30; Company company = CompanyIdentification.Identify(dblayer, Company_Info, CountryID, CompanyVAT, CompanyName, null); if (company != null) { shurat_haklada.CompanyID = dblayer.GetCompany(CountryID, CompanyVAT).CompanyID; shurat_haklada.ActionCode = Convert.ToInt32(line.Substring(pos, 2)); pos += 2; shurat_haklada.MisparMismach = Convert.ToInt32(line.Substring(pos, 9)); pos += 9; shurat_haklada.TarichMismach = Convert.ToDateTime(line.Substring(pos, 10)); pos += 10; shurat_haklada.TarichAcher = Convert.ToDateTime(line.Substring(pos, 10)); pos += 10; shurat_haklada.ActionDetails = line.Substring(pos, 70); pos += 70; shurat_haklada.AhuzHaMaam = Convert.ToDouble(line.Substring(pos, 5)); pos += 5; shurat_haklada.SchumPaturMaam = Convert.ToDouble(line.Substring(pos, 12)); pos += 12; shurat_haklada.SchumMaam = Convert.ToDouble(line.Substring(pos, 12)); pos += 12; shurat_haklada.SchumKolelMaam = Convert.ToDouble(line.Substring(pos, 12)); pos += 12; shurat_haklada.Attachment = line.Substring(pos, line.Length - pos); shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID; shurat_haklada.CompamyInfoVAT = Company_Info.CompanyVAT; } return(shurat_haklada); }
//////////////////////////////////////////////////////////////////////////////////////////// private ShuratHaklada CreateShuratHakladaMokupINI(string line, string delimiter) { PrepareIniFileName(); ShuratHaklada shurat_haklada = new ShuratHaklada(); string[] parts = line.Split(new string[] { delimiter }, StringSplitOptions.None); String CompanyVAT = GetOutboxImportStringValue("VAT", parts).ToString(); String CompanyName = GetOutboxImportStringValue("CompanyName", parts); Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null); if (company != null) { CompanyVAT = company.CompanyVAT; CompanyName = company.CompanyName; shurat_haklada.CompanyID = company.CompanyID; shurat_haklada.CountryID = GetOutboxImportIntValue("CountryID", parts); shurat_haklada.CompanyVAT = CompanyVAT; // iniFile.IniReadValue(companyinfo.CompanySerialNumber + " Import Outbox Structure", "VAT"); shurat_haklada.CompanyName = CompanyName; // iniFile.IniReadValue(companyinfo.CompanySerialNumber + " Import Outbox Structure", "CountryName"); shurat_haklada.ActionCode = GetOutboxImportIntValue("ActionCode", parts); shurat_haklada.MisparMismach = GetOutboxImportIntValue("MisparMismach", parts); shurat_haklada.TarichMismach = GetOutboxImportDateTimeValue("TarichMismach", parts); shurat_haklada.TarichAcher = GetOutboxImportDateTimeValue("TarichAcher", parts); shurat_haklada.ActionDetails = GetOutboxImportStringValue("ActionDetails", parts); shurat_haklada.AhuzHaMaam = GetOutboxImportDoubleValue("Maam", parts); shurat_haklada.SchumPaturMaam = GetOutboxImportIntValue("SchumPaturMaam", parts); shurat_haklada.SchumMaam = GetOutboxImportIntValue("SchumMaam", parts); shurat_haklada.SchumKolelMaam = GetOutboxImportIntValue("SchumKolelMaam", parts); shurat_haklada.Attachment = GetOutboxImportStringValue("Attachment", parts); shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID; shurat_haklada.CompamyInfoVAT = Company_Info.CompanyVAT; } return(shurat_haklada); }
private ShuratHaklada CreateShuratHakladaDelimter(string line, string delimiter) { ShuratHaklada shurat_haklada = null; string[] parts = line.Split(new string[] { delimiter }, StringSplitOptions.None); String CountryID = parts[0]; String CompanyVAT = parts[1]; String CompanyName = parts[2].Replace("'", "''"); Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null); if (company != null) { shurat_haklada = new ShuratHaklada(); shurat_haklada.CompanyID = company.CompanyID;// dblayer.GetCompany(CountryID, CompanyVAT).CompanyID; shurat_haklada.ActionCode = Convert.ToInt32(parts[3]); shurat_haklada.MisparMismach = Convert.ToInt32(parts[4]); shurat_haklada.TarichMismach = DateTime.Parse(parts[5], new System.Globalization.CultureInfo("en-AU", false)); //Convert.ToDateTime(parts[5]); shurat_haklada.TarichAcher = DateTime.Parse(parts[6], new System.Globalization.CultureInfo("en-AU", false)); //Convert.ToDateTime(parts[6]); shurat_haklada.ActionDetails = parts[7].Replace("'", "''");; if (parts[8] != "") { shurat_haklada.AhuzHaMaam = Convert.ToDouble(parts[8]); } if (parts[9] != "") { shurat_haklada.SchumPaturMaam = Convert.ToDouble(parts[9]); } if (parts[10] != "") { shurat_haklada.SchumMaam = Convert.ToDouble(parts[10]); } if (parts[11] != "") { shurat_haklada.SchumKolelMaam = Convert.ToDouble(parts[11]); } shurat_haklada.Attachment = parts[12]; if ((parts[13] != "") && (parts[13] != "0")) { shurat_haklada.LeTkufaMe = DateTime.Parse(parts[13], new System.Globalization.CultureInfo("en-AU", false)); } else { shurat_haklada.LeTkufaMe = shurat_haklada.TarichAcher; } //shurat_haklada.LeTkufaMe = new DateTime(shurat_haklada.LeTkufaMe.Year, shurat_haklada.LeTkufaMe.Month, 1); if ((parts[14] != "") && (parts[14] != "0")) { shurat_haklada.LeTkufaUd = DateTime.Parse(parts[14], new System.Globalization.CultureInfo("en-AU", false)); } else { shurat_haklada.LeTkufaUd = shurat_haklada.TarichAcher; } //shurat_haklada.LeTkufaUd = new DateTime(shurat_haklada.LeTkufaUd.Year, shurat_haklada.LeTkufaUd.Month, 1); shurat_haklada.MisparProyect = parts[15]; shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID; shurat_haklada.CompamyInfoVAT = Company_Info.CompanyVAT; } return(shurat_haklada); }
//private void MoveAttachment(String TransactionGUID, String Attachmnent) //{ // string ServerPath = Application.StartupPath + @"\TransientStorage"; // if (!Directory.Exists(ServerPath)) // { // Directory.CreateDirectory(ServerPath); // } // if (Company_Info.CompanyCountryID != 0) // { // if (!Directory.Exists(ServerPath + "/" + Company_Info.CompanyCountryID)) // { // Directory.CreateDirectory(ServerPath + "/" + Company_Info.CompanyCountryID); // } // } // if (Company_Info.CompanyVAT != null) // { // if (!Directory.Exists(ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT)) // { // Directory.CreateDirectory(ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT); // } // } // String fileName = TransactionGUID + Path.GetExtension(Attachmnent); // File.Move(Attachmnent, ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT + "/" + fileName); //} public void ImportHakladaMokup(String filename, CompanyInfo _companyinfo, DBLayer _dblayer, char delimiter) { Company_Info = _companyinfo; dblayer = _dblayer; FiledHolder filedHolder = new FiledHolder(); filedHolder.InitINI(); filedHolder.Company_Info = Company_Info; filedHolder.Add("CountryID"); filedHolder.Add("CompanyVAT"); filedHolder.Add("CompanyName"); filedHolder.Add("ActionCode"); filedHolder.Add("MisparMismach"); filedHolder.Add("TarichMismach"); filedHolder.Add("TarichAcher"); filedHolder.Add("ActionDetails"); filedHolder.Add("Maam"); filedHolder.Add("SchumPaturMaam"); filedHolder.Add("SchumMaam"); filedHolder.Add("SchumKolelMaam"); filedHolder.Add("Attachment"); filedHolder.LoadData(); StreamReader sr = new StreamReader(filename, CheckEncoder()); //Encoding.GetEncoding("iso-8859-8") //Hebrew From Magic String line = ""; ArrayList flds = filedHolder.GetFileds(); //filedHolder.GetFiled("ActionCode") dblayer.Current_Company_Info = _companyinfo; //bool bSkipRow = false; while (!sr.EndOfStream) { line = sr.ReadLine(); filedHolder.CurrentDataLine = line; ShuratHaklada shurat_haklada = new ShuratHaklada(); String CompanyVAT = filedHolder.GetFiledValue(filedHolder.GetFiledPosition("CompanyVAT"), delimiter); String CompanyName = filedHolder.GetFiledValue(filedHolder.GetFiledOrder("CompanyName"), delimiter); Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null); if (company != null) { shurat_haklada.CompanyID = company.CompanyID; shurat_haklada.ActionCode = Convert.ToInt32(filedHolder.GetFiledValue("ActionCode")); shurat_haklada.MisparMismach = Convert.ToInt32(filedHolder.GetFiledValue("MisparMismach")); shurat_haklada.TarichMismach = Convert.ToDateTime(filedHolder.GetFiledValue("TarichMismach")); shurat_haklada.TarichAcher = Convert.ToDateTime(filedHolder.GetFiledValue("TarichAcher")); shurat_haklada.ActionDetails = filedHolder.GetFiledValue("ActionDetails"); shurat_haklada.AhuzHaMaam = Convert.ToDouble(filedHolder.GetFiledValue("Maam")); shurat_haklada.SchumPaturMaam = Convert.ToDouble(filedHolder.GetFiledValue("SchumPaturMaam")); shurat_haklada.SchumMaam = Convert.ToDouble(filedHolder.GetFiledValue("SchumMaam")); shurat_haklada.SchumKolelMaam = Convert.ToDouble(filedHolder.GetFiledValue("SchumKolelMaam")); shurat_haklada.Attachment = filedHolder.GetFiledValue("Attachment"); shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID; shurat_haklada.CompamyInfoVAT = Company_Info.CompanyVAT; dblayer.AddHakladaRecord(shurat_haklada); } } sr.Close(); }