public ActionResult Create(archive arch) { HttpClient Client = new HttpClient(); Client.BaseAddress = new Uri("http://localhost:8080"); //arch.dateArchivage = DateTime.Now; Client.PostAsJsonAsync <archive>("/PIDEV-web/rest/archive", arch) .ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode()); return(RedirectToAction("Index")); }
public void addToArchive(string hesab, string subject, string productType) { if (context.Archives.Any(x => x.subject == subject)) { return; } archive ARCHIVE = new archive() { }; context.Archives.Add(ARCHIVE); context.SaveChanges(); }
private void shomareSanad1_Leave(object sender, EventArgs e) { var number = shomareSanad1.Text; using (Context dbcontext = new Context()) { archive model = dbcontext.Archives.FirstOrDefault(x => x.shomareSanad == number); if (model != null) { header.Text = "این شماره قبلا ثبت شده است"; header.ForeColor = Color.Red; } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { int iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex; int rowindex = dataGridView1.CurrentCell.RowIndex; int rowID = Int32.Parse(dataGridView1.Rows[rowindex].Cells[2].Value.ToString()); Model.tamin model = dbcontext.tamins.SingleOrDefault(x => x.ID == rowID); if (iSelectedGridIndex == 0) { label1.Text = "بانک تامین"; label1.ForeColor = Color.Black; string imageName = model.imageName; if (imageName != "") { var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); try { if (Path.GetExtension(imageName) == ".pdf") { try { //label1.Text = "takes too far"; factorPdf factore = new factorPdf(directory + imageName); factore.Show(); } catch (Exception error) { label1.Text = error.InnerException.Message; } } else { factorImage factor = new factorImage(directory + imageName); factor.Show(); } } catch (Exception error) { label1.Text = "0000-" + error.InnerException.Message; } } } else if (iSelectedGridIndex == 1) { string IDsrt = rowID.ToString(); archive rmodel = dbcontext.Archives.SingleOrDefault(x => x.shomareTamin == model.shomareSanad); if (rmodel == null) { dbcontext.tamins.Remove(model); dbcontext.SaveChanges(); List <Model.tamin> lst = (from p in dbcontext.tamins where p.hesab == "0" select p).OrderBy(x => x.ID).ToList(); dataGridView1.DataSource = lst; } else { label1.Text = "تامین مورد نظر دارای فاکتور می باشد"; label1.ForeColor = Color.Red; } } } catch (Exception er) { label1.Text = "111-" + er.InnerException.Message; } }
private void filter_Click(object sender, EventArgs e) { string sourcAddress = sourceLable.Text; int index = 0; int indeximage = 0; bool factorimage = false; int indexpdf = 0; bool factorpdf = false; foreach (Form form in Application.OpenForms) { if (form.Name == "factorPdf") { factorpdf = true; indexpdf = index; break; } if (form.Name == "factorImage") { factorimage = true; indeximage = index; break; } index += 1; } if (factorimage == true) { Application.OpenForms[indeximage].Close(); } if (factorpdf == true) { Application.OpenForms[indexpdf].Close(); } Context dbcontext = new Context(); string sanad = shomareSanad1.Text; string prj = project.SelectedValue.ToString(); var shenasname = dbcontext.shenasnames.SingleOrDefault(x => x.ID == prj); string shenasnameID = shenasname.ID; string shenasnameTitle = shenasname.title; var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string mrk = ""; var mrkobject = (from sh in dbcontext.shenasnames join ma in dbcontext.markazs on sh.markaz equals ma.parent where sh.title == shenasnameTitle select ma); if (mrkobject != null) { mrk = mrkobject.First().title; } string root = Path.Combine(directory, "FIM"); System.IO.Directory.CreateDirectory(root); string markazPath = Path.Combine(root, mrk); System.IO.Directory.CreateDirectory(markazPath); string shenasnamePath = Path.Combine(markazPath, shenasnameTitle); System.IO.Directory.CreateDirectory(shenasnamePath); string pardPath = Path.Combine(shenasnamePath, "فاکتور های دریافتی"); System.IO.Directory.CreateDirectory(pardPath); string trkh = date.GetSelectedDateInPersianDateTime().ToShortDateString().Replace("/", ""); string finalPrice = ""; if (shomareSanad1.Text == "") { header.Text = "شماره سند را وارد نمایید"; header.ForeColor = Color.Red; return; } if (price.Text == "") { header.Text = "مبلغ را وارد نمایید"; header.ForeColor = Color.Red; return; } float intprice = float.Parse(price.Text); if (intprice / 1000000 > 1) { finalPrice = (intprice / 1000000) + "MT"; } else { finalPrice = (intprice / 1000) + "HT"; } string finalname = ""; if (bank.Text == "") { finalname = "تامینی" + "_" + shomareSanad1.Text + Path.GetExtension(sourcAddress); } else { finalname = trkh + "_" + finalPrice + "_" + bank.Text + Path.GetExtension(sourcAddress); } imageName.Text = Path.Combine(pardPath, finalname).Replace(directory, ""); string finalPath = pardPath + "\\" + finalname; webBrowser1.Navigate("http://localhost/."); archive pastmodel = dbcontext.Archives.SingleOrDefault(x => x.hesab == "1" && x.shomareSanad == sanad && x.shnesnameTitle == shenasnameTitle && referbish.Text == "0" && x.type == moneytype.Text); if (moneytype.SelectedItem == null) { header.Text = "واحد پولی را انتخاب کنید"; header.ForeColor = Color.Red; return; } if (pastmodel != null) { header.Text = "برای پارامتر های موجود فاکتور انتخاب شده است"; header.ForeColor = Color.Red; return; } DateTime trk = date.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime(); string typ = moneytype.SelectedItem.ToString(); bool isreferbish = referbish.Text == "0" ? false : true; long mbl = (long)intprice; archive newITem = new archive() { mablagh = mbl, markaz = "", project = shenasnameID, shnesnameTitle = shenasnameTitle, shomareSanad = sanad, tarikh = trk, type = typ, hesab = "1", imageName = imageName.Text, bankName = bank.Text, checkNumber = sanadType.Text, referbish = isreferbish, subject = subject.Text }; dbcontext.Archives.Add(newITem); dbcontext.SaveChanges(); DataTable dt = new DataTable(); daryaftiReport daryaftirp = new daryaftiReport(dt); daryaftirp.Show(); this.Close(); System.IO.File.Move(sourcAddress, finalPath); }
public void addToArchive(string id, string name) { long ID = Convert.ToInt64(id); if (context.Archives.Any(x => x.number == ID && x.userName == name)) { return; } item selectedITEM = context.items.Where(x => x.number == ID).FirstOrDefault(); archive ARCHIVE = new archive() { address = selectedITEM.address, address1 = selectedITEM.address1, address2 = selectedITEM.address2, address3 = selectedITEM.address3, anbari1 = selectedITEM.anbari1, anbari2 = selectedITEM.anbari2, anbari3 = selectedITEM.anbari3, apartment = selectedITEM.apartment, asansor1 = selectedITEM.asansor1, asansor2 = selectedITEM.asansor2, asansor3 = selectedITEM.asansor3, ashpazkhane = selectedITEM.ashpazkhane, ashpazkhane1 = selectedITEM.ashpazkhane1, ashpazkhane2 = selectedITEM.ashpazkhane2, ashpazkhane3 = selectedITEM.ashpazkhane3, balkon1 = selectedITEM.balkon1, balkon2 = selectedITEM.balkon2, balkon3 = selectedITEM.balkon3, bed1 = selectedITEM.bed1, bed2 = selectedITEM.bed2, bed3 = selectedITEM.bed3, date_updated = selectedITEM.date_updated, desc = selectedITEM.desc, ertefa = selectedITEM.ertefa, eslahi = selectedITEM.eslahi, garmayesh_sarmayesh = selectedITEM.garmayesh_sarmayesh, gozar = selectedITEM.gozar, hasEstakhr = selectedITEM.hasEstakhr, hasGym = selectedITEM.hasGym, hasHall = selectedITEM.hasHall, hasJakoozi = selectedITEM.hasJakoozi, hasLobbyMan = selectedITEM.hasLobbyMan, hasRoofGarden = selectedITEM.hasRoofGarden, hasSauna = selectedITEM.hasSauna, hasShooting = selectedITEM.hasShooting, ID = selectedITEM.ID, isEjare = selectedITEM.isEjare, isForoosh = selectedITEM.isForoosh, isMoaveze = selectedITEM.isMoaveze, isMoble = selectedITEM.isMoble, isMosharekat = selectedITEM.isMosharekat, isRahn = selectedITEM.isRahn, kaf_type = selectedITEM.kaf_type, kolangi = selectedITEM.kolangi, maghaze = selectedITEM.maghaze, malek = selectedITEM.malek, mantaghe_id = selectedITEM.mantaghe_id, mantaghe_name = selectedITEM.mantaghe_name, masahat_zamin = selectedITEM.masahat_zamin, mostaghellat = selectedITEM.mostaghellat, no_tabdit = selectedITEM.no_tabdit, number = selectedITEM.number, office = selectedITEM.office, parking1 = selectedITEM.parking1, parking2 = selectedITEM.parking2, parking3 = selectedITEM.parking3, phones = selectedITEM.phones, samt = selectedITEM.samt, sanad = selectedITEM.sanad, sell2khareji = selectedITEM.sell2khareji, senn = selectedITEM.senn, seraydar = selectedITEM.seraydar, suit = selectedITEM.suit, tabaghe1 = selectedITEM.tabaghe_1_rahn, tabaghe_1_rahn = selectedITEM.tabaghe_1_rahn, tabaghe2 = selectedITEM.tabaghe2, tabaghe3 = selectedITEM.tabaghe3, tabaghe_1_ejare = selectedITEM.tabaghe_1_ejare, tabaghe_1_metri = selectedITEM.tabaghe_1_metri, tabaghe_1_total_price = selectedITEM.tabaghe_1_total_price, tabaghe_2_ejare = selectedITEM.tabaghe_2_ejare, tabaghe_2_metri = selectedITEM.tabaghe_2_metri, tabaghe_2_rahn = selectedITEM.tabaghe_2_rahn, tabaghe_2_total_price = selectedITEM.tabaghe_2_total_price, tabaghe_3_ejare = selectedITEM.tabaghe_3_ejare, tabaghe_3_metri = selectedITEM.tabaghe_3_metri, tabaghe_3_rahn = selectedITEM.tabaghe_3_rahn, tabaghe_3_total_price = selectedITEM.tabaghe_3_total_price, tabaghe_4_ejare = selectedITEM.tabaghe_4_ejare, tabaghe_4_metri = selectedITEM.tabaghe_4_metri, tabaghe_4_rahn = selectedITEM.tabaghe_4_rahn, tabaghe_4_total_price = selectedITEM.tabaghe_4_total_price, tabdil = selectedITEM.tabdil, takhlie = selectedITEM.takhlie, tarakom = selectedITEM.tarakom, title = selectedITEM.title, toole_bar = selectedITEM.toole_bar, total_floor = selectedITEM.total_floor, total_vahed = selectedITEM.total_vahed, userName = selectedITEM.userName, vahed_per_floor = selectedITEM.vahed_per_floor, villa = selectedITEM.villa, wc = selectedITEM.wc, zirbana1 = selectedITEM.zirbana1, wc1 = selectedITEM.wc1, wc2 = selectedITEM.wc2, wc3 = selectedITEM.wc3, zirbana2 = selectedITEM.zirbana2, zirbana3 = selectedITEM.zirbana3, zirzamin = selectedITEM.zirzamin, }; ARCHIVE.userName = name; context.Archives.Add(ARCHIVE); context.SaveChanges(); }
private void filter_Click(object sender, EventArgs e) { var number = shomareSanad.Text; using (Model.Context dbcontext = new Model.Context()) { tamin model = dbcontext.tamins.FirstOrDefault(x => x.shomareSanad == number); if (model != null) { header.Text = "این شماره قبلا ثبت شده است"; return; } } if (radif.SelectedValue == null && subject.SelectedItem.ToString() != "سایر هزینه ها") { header.Text = "ردیف انتخاب نشده است"; header.ForeColor = Color.Red; return; } header.Text = "1"; string sanad = shomareSanad.Text; Int64 mbl = Int64.Parse(price.Text); string prj = project.SelectedValue.ToString(); var shenasname = context.shenasnames.SingleOrDefault(x => x.ID == prj); string shenasnameID = shenasname.ID; string shenasnameTitle = shenasname.title; string rd = subject.SelectedText != "مواد اولیه" ? "" : radif.SelectedValue.ToString(); header.Text = "2"; archive pastmodel = context.Archives.SingleOrDefault(x => x.hesab == "0" && x.shomareSanad == sanad && x.mablagh == mbl && x.shnesnameTitle == shenasnameTitle && x.radif == rd); if (pastmodel != null) { header.Text = "برای پارامتر های موجود فاکتور انتخاب شده است"; header.ForeColor = Color.Red; return; } functions fns = new functions(); var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string mrk = ""; mrk = (from sh in context.shenasnames join ma in context.markazs on sh.markaz equals ma.parent where sh.title == shenasnameTitle select ma).First().title; header.Text = "3"; string root = Path.Combine(directory, "FIM"); System.IO.Directory.CreateDirectory(root); string taminPath = Path.Combine(root, "tamin"); System.IO.Directory.CreateDirectory(taminPath); string trkh = date.GetSelectedDateInPersianDateTime().ToShortDateString().Replace("/", ""); string finalPrice = ""; if (shomareSanad.Text == "") { header.Text = "شماره سند را وارد نمایید"; header.ForeColor = Color.Red; return; } if (price.Text == "") { header.Text = "مبلغ را وارد نمایید"; header.ForeColor = Color.Red; return; } float intprice = float.Parse(price.Text); if (intprice / 1000000 > 1) { finalPrice = (intprice / 1000000) + "MT"; } else { finalPrice = (intprice / 1000) + "HT"; } string finalname = ""; string random = RandomNumber(10000, 99999).ToString(); string sourcAddress = sourceLable.Text; finalname = random + Path.GetExtension(sourcAddress); imageName.Text = Path.Combine(taminPath, finalname).Replace(directory, ""); string finalPath = taminPath + "\\" + finalname; //try //{ // System.IO.File.Delete(sourcAddress); //} //catch (IOException error) //{ //} if (moneytype.SelectedItem == null) { header.Text = "واحد پولی را انتخاب کنید"; header.ForeColor = Color.Red; return; } if (pastmodel != null) { header.Text = "برای پارامتر های موجود فاکتور انتخاب شده است"; header.ForeColor = Color.Red; return; } //string rd = ""; string rdTitle = ""; string choosenSubject = subject.Text; if (radif.SelectedValue != null) { rd = radif.SelectedValue.ToString(); int intrd = Int32.Parse(rd); switch (choosenSubject) { case "اجراییات": rdTitle = context.ejraeiats.SingleOrDefault(x => x.ID == intrd).title; break; case "سرمایه": rdTitle = context.sarmayes.SingleOrDefault(x => x.ID == intrd).title; break; case "قرارداد": rdTitle = context.gharardads.SingleOrDefault(x => x.ID == intrd).title; break; case "عمرانی": rdTitle = context.omranis.SingleOrDefault(x => x.ID == intrd).title; break; case "اداری": rdTitle = context.edaris.SingleOrDefault(x => x.ID == intrd).title; break; case "مصرفی": rdTitle = context.masrafis.SingleOrDefault(x => x.ID == intrd).title; break; case "مواد": rdTitle = context.sayers.SingleOrDefault(x => x.ID == intrd).title; break; case "تشویقی": rdTitle = context.tashvighis.SingleOrDefault(x => x.ID == intrd).title; break; } } bool isreferbish = referbish.Text == "0" ? false : true; string sbj = choosenSubject; DateTime trk = date.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime(); string typ = moneytype.SelectedItem.ToString(); tamin newITem = new tamin() { radif = rd, mablagh = mbl, markaz = "", project = shenasnameID, shnesnameTitle = shenasnameTitle, radifTitle = rdTitle, shomareSanad = sanad, subject = sbj, tarikh = trk, type = typ, hesab = "0", imageName = imageName.Text, //bankName = bank.Text, //checkNumber = checkNumber.Text, //referbish = isreferbish }; context.tamins.Add(newITem); context.SaveChanges(); webBrowser1.Navigate("http://localhost/"); DataTable dt = new DataTable(); tamin_Report taminform = new tamin_Report(dt); taminform.Show(); this.Close(); File.Move(sourcAddress, finalPath); try { File.Delete(sourcAddress); } catch (IOException error) { } }
private void filter_Click(object sender, EventArgs e) { var tamintxt = tamin.Text; if (tamintxt == "") { header.Text = "تامین انتخاب نشده است"; header.ForeColor = Color.Red; return; } tamin model = context.tamins.SingleOrDefault(x => x.shomareSanad == tamintxt); if (model == null) { header.Text = "شماره تامین وجود ندارد"; header.ForeColor = Color.Red; return; } Context dbcontext = new Context(); string sanad = shomareSanad1.Text; if (sanad == "") { header.Text = "شماره سند انتخاب نشده است"; header.ForeColor = Color.Red; return; } Int64 mbl = model.mablagh; string shenasnameTitle = model.shnesnameTitle; archive pastmodel = dbcontext.Archives.SingleOrDefault(x => x.shomareTamin == tamintxt && x.shomareSanad == sanad); if (pastmodel != null) { header.Text = "برای پارامتر های موجود فاکتور انتخاب شده است"; header.ForeColor = Color.Red; return; } functions fns = new functions(); var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string mrk = ""; mrk = (from sh in dbcontext.shenasnames join ma in dbcontext.markazs on sh.markaz equals ma.parent where sh.title == shenasnameTitle select ma).First().title; string root = Path.Combine(directory, "FIM"); System.IO.Directory.CreateDirectory(root); string markazPath = Path.Combine(root, mrk); System.IO.Directory.CreateDirectory(markazPath); string shenasnamePath = Path.Combine(markazPath, shenasnameTitle); System.IO.Directory.CreateDirectory(shenasnamePath); string pardPath = Path.Combine(shenasnamePath, "فاکتور های پرداختی"); System.IO.Directory.CreateDirectory(pardPath); string sourcAddress = sourceLable.Text; string trkh = date.GetSelectedDateInPersianDateTime().ToShortDateString().Replace("/", ""); string finalPrice = ""; float intprice = model.mablagh; if (intprice / 1000000 > 1) { finalPrice = (intprice / 1000000) + "MT"; } else { finalPrice = (intprice / 1000) + "HT"; } string finalname = ""; if (bank.Text == "") { finalname = "تامینی" + "_" + shomareSanad1.Text + Path.GetExtension(sourcAddress); } else { string sv = checkNumber.SelectedValue.ToString(); finalname = "check" + "_" + bank.Text + "_" + sv + Path.GetExtension(sourcAddress); } imageName.Text = Path.Combine(pardPath, finalname).Replace(directory, ""); string finalPath = pardPath + "\\" + finalname; bool isreferbish = referbish.Text == "0" ? false : true; DateTime trk = date.GetSelectedDateInPersianDateTime().ToShortDateString().ToGeorgianDateTime(); archive newITem = new archive() { radif = "", mablagh = 0, markaz = "", project = "", shnesnameTitle = "", radifTitle = "", shomareSanad = sanad, shomareTamin = tamintxt, subject = "", tarikh = trk, type = "", hesab = "0", imageName = imageName.Text, bankName = bank.Text, checkNumber = checkNumber.Text, referbish = isreferbish }; check checkitem = context.checks.SingleOrDefault(x => x.checkNumber == checkNumber.Text); checkitem.isUsed = true; context.Archives.Add(newITem); context.SaveChanges(); System.IO.File.Move(sourcAddress, finalPath); DataTable dt = new DataTable(); PardakhtiReport daryaftirp = new PardakhtiReport(dt); daryaftirp.Show(); this.Hide(); }
public ActionResult Update(archive arch) { return(View(arch)); }