private static string CreateDocument(string path, QuoteInformation satisBilgileri, string folderName) { string path1 = string.Empty; { byte[] bytes = (byte[])null; DataSet dataSet1 = new DataSet(); DataSet dataSet2 = satisBilgileri.DataSet; if (satisBilgileri.Fields.ContainsKey("accountname") && projectNameGlobal != "827 Inistanbul Topkapı")//Satış Yapan Firma Var ise ve Topkapı projesi değil ise { bytes = DocumentMerge.WordDokumanOlustur(path + "DocumentMerge\\Templates\\presalesform2.docx", dataSet2, satisBilgileri.Fields); path1 = path + "DocumentMerge\\Document\\" + folderName + "\\presalesform2.docx"; } else if (!satisBilgileri.Fields.ContainsKey("accountname") && projectNameGlobal != "827 Inistanbul Topkapı")//Satış Yapan Firma yok ise ve Topkapı projesi değil ise { bytes = DocumentMerge.WordDokumanOlustur(path + "DocumentMerge\\Templates\\presalesform.docx", dataSet2, satisBilgileri.Fields); path1 = path + "DocumentMerge\\Document\\" + folderName + "\\presalesform.docx"; } else { bytes = DocumentMerge.WordDokumanOlustur(path + "DocumentMerge\\Templates\\Topkapipresalesform.docx", dataSet2, satisBilgileri.Fields); path1 = path + "DocumentMerge\\Document\\" + folderName + "\\Topkapipresalesform.docx"; } if (path1 != string.Empty) { System.IO.File.WriteAllBytes(path1, bytes); } } return(path1); }
public string ExecutePreSalesForm(Guid QuoteId, string Path) { string folder = PreSalesFormHelper.CreateFolder(QuoteId, Path); QuoteDetail quote = new QuoteDetail(); quote = GetQuoteDetail(QuoteId); QuoteInformation quoteInformation = this.CreateQuoteInformation(quote); return(CreateDocument(Path, quoteInformation, folder)); }
private QuoteInformation CreateQuoteInformation(QuoteDetail quote) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(quote.ContractDate)) { dictionary.Add("tarih", quote.ContractDate);//Sözleşme Tarihinden 1 gün önce istendi } else { dictionary.Add("tarih", string.Empty); } if (!string.IsNullOrEmpty(quote.NameSurname)) { dictionary.Add("adsoyad", quote.NameSurname); } else { dictionary.Add("adsoyad", string.Empty); } if (!string.IsNullOrEmpty(quote.Address)) { dictionary.Add("adres", quote.Address); } else { dictionary.Add("adres", string.Empty); } if (!string.IsNullOrEmpty(quote.ForeignAddress)) { dictionary.Remove("adres"); dictionary.Add("adres", quote.ForeignAddress); } if (!string.IsNullOrEmpty(quote.Address) && !string.IsNullOrEmpty(quote.Nationality) && quote.Nationality != "TC") { dictionary.Add("tcadresi", quote.Address); } else { dictionary.Add("tcadresi", string.Empty); } if (!string.IsNullOrEmpty(quote.Phone)) { dictionary.Add("telefon", quote.Phone); } else { dictionary.Add("telefon", string.Empty); } if (!string.IsNullOrEmpty(quote.TcTaxNo)) { dictionary.Add("tcno", quote.TcTaxNo); } else { dictionary.Add("tcno", string.Empty); } if (!string.IsNullOrEmpty(quote.Email)) { dictionary.Add("eposta", quote.Email); } else { dictionary.Add("eposta", string.Empty); } if (quote.ProjectName == "853 NEF 03 Kağıthane") { dictionary.Add("projeadi", "NEF KAĞITHANE 03"); } else { dictionary.Add("projeadi", string.Empty); } if (!string.IsNullOrEmpty(quote.garden)) { dictionary.Add("bahce", quote.garden); } else { dictionary.Add("bahce", string.Empty); } if (!string.IsNullOrEmpty(quote.terracegross)) { dictionary.Add("teras", quote.terracegross); } else { dictionary.Add("teras", string.Empty); } if (!string.IsNullOrEmpty(quote.balconym2)) { dictionary.Add("balkon", quote.balconym2); } else { dictionary.Add("balkon", string.Empty); } if (!string.IsNullOrEmpty(quote.satisaesasalanm2)) { dictionary.Add("satisesasalanm2", quote.satisaesasalanm2); } else { dictionary.Add("satisesasalanm2", string.Empty); } if (!string.IsNullOrEmpty(quote.CityCounty)) { dictionary.Add("ililcemahalle", quote.CityCounty); } else { dictionary.Add("ililcemahalle", string.Empty); } if (!string.IsNullOrEmpty(quote.AdaParsel)) { dictionary.Add("adaparsel", quote.AdaParsel); } else { dictionary.Add("adaparsel", string.Empty); } if (!string.IsNullOrEmpty(quote.Blok)) { dictionary.Add("blokno", quote.Blok); } else { dictionary.Add("blokno", string.Empty); } if (!string.IsNullOrEmpty(quote.Konum)) { dictionary.Add("konum", quote.Konum); } else { dictionary.Add("konum", string.Empty); } if (!string.IsNullOrEmpty(quote.Floor)) { dictionary.Add("kat", quote.Floor); } else { dictionary.Add("kat", string.Empty); } if (!string.IsNullOrEmpty(quote.ApartmentNo)) { dictionary.Add("daireno", quote.ApartmentNo); } else { dictionary.Add("daireno", string.Empty); } if (!string.IsNullOrEmpty(quote.ApartmentType)) { dictionary.Add("dairetipi", quote.ApartmentType); } else { dictionary.Add("dairetipi", string.Empty); } if (!string.IsNullOrEmpty(quote.m2)) { dictionary.Add("satisaesasbrutm2", quote.m2); } else { dictionary.Add("satisaesasbrutm2", string.Empty); } if (!string.IsNullOrEmpty(quote.AdvanceAmount)) { dictionary.Add("toplamtaksitlisatisbedeli", quote.AdvanceAmount); } else { dictionary.Add("toplamtaksitlisatisbedeli", string.Empty); } dictionary.Add("toplampesinsatisbedeli", "0");//Sabit 0 basıyor if (!string.IsNullOrEmpty(quote.DeliveryDate)) { dictionary.Add("teslimtarihi", quote.DeliveryDate); } else { dictionary.Add("teslimtarihi", string.Empty); } if (!string.IsNullOrEmpty(quote.RegistrationDate)) { dictionary.Add("yapiruhsatininalinistarihi", quote.RegistrationDate); } else { dictionary.Add("yapiruhsatininalinistarihi", string.Empty); } if (!string.IsNullOrEmpty(quote.Guarantees)) { dictionary.Add("teminat", quote.Guarantees); } else { dictionary.Add("teminat", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountName))//Satış Yapan Firma Var ise { if (!string.IsNullOrEmpty(quote.SalesAccountName)) { dictionary.Add("accountname", quote.SalesAccountName); } else { dictionary.Add("accountname", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountAddress)) { dictionary.Add("accountaddress", quote.SalesAccountAddress); } else { dictionary.Add("accountaddress", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountEmail)) { dictionary.Add("accountemail", quote.SalesAccountEmail); } else { dictionary.Add("accountemail", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountMersisno)) { dictionary.Add("accountmersisno", quote.SalesAccountMersisno); } else { dictionary.Add("accountmersisno", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountTel)) { dictionary.Add("accounttelephone", quote.SalesAccountTel); } else { dictionary.Add("accounttelephone", string.Empty); } if (!string.IsNullOrEmpty(quote.SalesAccountFax)) { dictionary.Add("accountfax", quote.SalesAccountFax); } else { dictionary.Add("accountfax", string.Empty); } } if (!string.IsNullOrEmpty(quote.bbnetalan)) { dictionary.Add("bbnetalan", quote.bbnetalan); } else { dictionary.Add("bbnetalan", string.Empty); } if (!string.IsNullOrEmpty(quote.bbbrutalan)) { dictionary.Add("bbbrutalan", quote.bbbrutalan); } else { dictionary.Add("bbbrutalan", string.Empty); } if (!string.IsNullOrEmpty(quote.satisesasalan)) { dictionary.Add("satisesasalan", quote.satisesasalan); } else { dictionary.Add("satisesasalan", string.Empty); } if (!string.IsNullOrEmpty(quote.bbgenelbrutalan)) { dictionary.Add("bbgenelbrutalan", quote.bbgenelbrutalan); } else { dictionary.Add("bbgenelbrutalan", string.Empty); } QuoteInformation quoteInformation = new QuoteInformation(); DataSet dataSet = new DataSet(); quoteInformation.DataSet = dataSet; quoteInformation.Fields = dictionary; return(quoteInformation); }