public void fofo() { try { //-------- List <string> ListSt1 = new List <string>(); List <string> ListSt2 = new List <string>(); List <string> ListSt3 = new List <string>(); var accc = new Assest.OrcDataAcess(); DataTable DT = new DataTable(); accc.Show_(DT); try { foreach (DataRow DR in DT.Rows) { ListSt1.Add(DR.Field <string>("NAME")); ListSt2.Add(DR.Field <string>("BARCODE")); ListSt3.Add(DR.Field <string>("PRICE")); } } catch (Exception ex) { DXMessageBox.Show(ex.Message, "خطأ", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { } }
/// public void add1(string id, string name, string price, string date, string darec, string conprou, string typeprou, string discounts, int isdone) { var d = new Assest.OrcDataAcess(); SQLiteConnection cna = new SQLiteConnection(); cna.ConnectionString = d.ConnectionString("", ""); string insert_query = null; insert_query = "INSERT INTO MEGARIP2 (NAME,PRICE,DAT,discounts,datrec,conprou,typeprou,isdone,ID) VALUES ('" + name + "','" + price + "','" + date + "','" + discounts + "','" + darec + "','" + conprou + "','" + typeprou + "','" + isdone + "','" + id.ToString().Replace("-", "") + "')"; // string insert_query = "INSERT INTO MEGARIP ([ID],[NAME],[PRICE],[DAT],[discounts],[datrec],[conprou],[typeprou],[isdone]) VALUES(?,?,?,?,?,?,?,?,?)"; // string insert = "INSERT INTO MEGARIP(ID,NAME,PRICE,DAT,discounts,datrec,conprou,typeprou,isdone) VALUES('"+"g"+"','"+"A"+"','"+"123"+"','"+"ABC"+"','"+"HG"+"','"+"ABC"+"','"+"as"+"','"+"HGT"+"','"+Booolint+"')"; // String Ainsert="INSERT INTO MEGARIP(ID,NAME,PRICE,DAT,discounts,datrec)" System.Data.SQLite.SQLiteCommand cm = new System.Data.SQLite.SQLiteCommand(); cm.Connection = cna; // cm.CommandType = CommandType.Text; cm.CommandText = insert_query; //cm.Parameters.AddWithValue("?", id);//1 //cm.Parameters.AddWithValue("?", name);//2 //cm.Parameters.AddWithValue("?", price);//3 //cm.Parameters.AddWithValue("?", date);//4 //cm.Parameters.AddWithValue("?", discounts);//5 //cm.Parameters.AddWithValue("?", "FG");//6 //cm.Parameters.AddWithValue("?", conprou);//7 //cm.Parameters.AddWithValue("?", typeprou);//8 //cm.Parameters.AddWithValue("?", isdone);//9 cna.Open(); cm.ExecuteNonQuery(); cna.Close(); }
private void k100_() { try { Barco = Barcode.Text + "\n"; DataTable Datatable = new DataTable(); DataTable _datatable = new DataTable(); var OracleData = new Assest.OrcDataAcess(); OracleData.Show(Datatable); listStrings.Clear(); listStrings1.Clear(); listStrings2.Clear(); liqua.Clear(); liststring4.Clear(); foreach (DataRow Dt in Datatable.Rows) { listStrings.Add(Dt.Field <string>("BARCODE")); listStrings1.Add(Dt.Field <string>("NAME")); listStrings2.Add(Dt.Field <string>("PRICE")); liqua.Add(Dt.Field <string>("QUANTITY")); liststring4.Add(Dt.Field <String>("ID")); liststring8.Add(Dt.Field <String>("Dis")); } int numric = 0; for (int i = 0; i < listStrings.Count; i++) { if (listStrings[i] == Barcode.Text || listStrings[i] == Barcode.Text + "\n") { Name.Text = listStrings1[i]; price.Text = getwholeprice(i, listStrings2, liststring8).ToString(); Quan_li = int.Parse(liqua[i]); id_li = liststring4[i]; numric++; break; } } if (numric == 0) { DXMessageBox.Show("لم يتم العثور على نتيجة", "خطـأ", MessageBoxButton.OK, MessageBoxImage.Error); Exists = 0; } if (numric != 0) { Exists = 1; PPP(); } } catch (Exception ex) { } }
public void Delete(String index) { var d = new Assest.OrcDataAcess(); SQLiteConnection cn = new SQLiteConnection(); cn.ConnectionString = d.ConnectionString("", ""); string insert_query = $"DELETE from [MEGARIP] WHERE ID ='{index}'"; System.Data.SQLite.SQLiteCommand cm = new System.Data.SQLite.SQLiteCommand(insert_query, cn); cn.Open(); cm.ExecuteNonQuery(); cn.Close(); }
/// </summary> public void Delete1() { var d = new Assest.OrcDataAcess(); SQLiteConnection cn = new SQLiteConnection(); cn.ConnectionString = d.ConnectionString("", ""); string insert_query = "DELETE from [MEGARIP2]"; System.Data.SQLite.SQLiteCommand cm = new System.Data.SQLite.SQLiteCommand(insert_query, cn); // cm.Parameters.AddWithValue("?", index); cn.Open(); cm.ExecuteNonQuery(); cn.Close(); }
public ObservableCollectionCore <Coustomer> Sales(string name) { var NAME = new List <string>(); var PRICE = new List <string>(); var PRICE_A = new List <string>(); var DAT = new List <string>(); var QUANTITY = new List <string>(); var BARCODE = new List <string>(); var Dis = new List <string>(); var Price_F = new List <string>(); var ID = new List <string>(); DataTable dt = new DataTable(); var Getdata = new Assest.OrcDataAcess(); Getdata.Show(dt); foreach (DataRow item in dt.Rows) { NAME.Add(item.Field <String>("NAME")); PRICE.Add(item.Field <String>("PRICE")); PRICE_A.Add(item.Field <String>("PRICE_A")); DAT.Add(item.Field <String>("DAT")); QUANTITY.Add(item.Field <String>("QUANTITY")); BARCODE.Add(item.Field <String>("BARCODE")); Dis.Add(item.Field <String>("Dis")); Price_F.Add(item.Field <String>("Price_F")); ID.Add(item.Field <String>("ID")); } ObservableCollectionCore <Coustomer> sales = new ObservableCollectionCore <Coustomer>(); for (int i = 0; i < NAME.Count; i++) { if (NAME[i].Contains(name)) { sales.Add(new Coustomer() { QUANTITY = QUANTITY[i], NAME = NAME[i], BARCODE = BARCODE[i], DAT = DAT[i], PRICE_A = PRICE_A[i], Dis = Dis[i], PRICE = PRICE[i], Price_F = Price_F[i], ID = ID[i], }); } } return(sales); }
public void Edit1(string id, string name, string price, string date, string darec, string conprou, string typeprou, string discounts, int isdone) { //ID,NAME,PRICE,DAT,discounts,datrec,conprou,typeprou,isdone SQLiteConnection cn = new SQLiteConnection(); var d = new Assest.OrcDataAcess(); cn.ConnectionString = d.ConnectionString("", ""); string insert_query = $"UPDATE MEGARIP2 SET NAME='{name}',PRICE='{price}' ,DAT='{date}' ,discounts='{discounts}' ,datrec='{darec}' ,conprou='{conprou}' ,typeprou='{typeprou}',isdone='{isdone}' WHERE ID ='{id}'"; System.Data.SQLite.SQLiteCommand cm = new System.Data.SQLite.SQLiteCommand(); cm.Connection = cn; cm.CommandText = insert_query; cn.Open(); cm.ExecuteNonQuery(); cn.Close(); }
string GetPricea() { DataTable a = new DataTable(); var Getdt = new Assest.OrcDataAcess(); Getdt.show4(a); string result = ""; double price = 0; foreach (DataRow item in a.Rows) { price += double.Parse(item.Field <string>("PRICE_A").Replace("SAR ", "")); } result = price.ToString("N0") + "ر.س"; return(result); }
public string SumPrice() { String Result = ""; var NumRess = new List <string>(); var NumRessed = new List <string>(); var ExtractPrice = new List <string>(); var ExtractedPrice = new List <string>(); DataTable CountierOfPrice_NRess = new DataTable(); var accc = new Assest.OrcDataAcess(); accc.show3(CountierOfPrice_NRess); foreach (DataRow r in CountierOfPrice_NRess.Rows) { NumRess.Add(r.Field <string>("NUMF")); ExtractPrice.Add(r.Field <string>("PRICE")); } for (int i = 0; i < NumRess.Count; i++) { NumRessed.Add(NumRess[i]); for (int ii = 0; ii < NumRessed.Count;) { if (NumRessed[i] == NumRessed[ii]) { ExtractedPrice.Add(ExtractPrice[i].Replace("SAR", "").Replace(",", "")); } else { } ii++; } } int result = 0; if (ExtractedPrice.Count > 0) { for (int i = 0; i < ExtractedPrice.Count; i++) { result += int.Parse(ExtractedPrice[i]); } int parsetodecimal = result; return("SAR " + parsetodecimal.ToString("N0")); } else { return(int.Parse("0").ToString("N0")); } }
public string SumPrice() { var list = new List <string>(); DataTable data = new DataTable(); var irc = new Assest.OrcDataAcess(); irc.Show_(data); Int64 Sumpricee = 0; foreach (DataRow r in data.Rows) { Sumpricee += r.Field <Int64>("PRICE"); } return(Sumpricee.ToString("N0") + " ر.س"); }
private void GetInvoice() { DataTable fff = new DataTable(); var orcc = new Assest.OrcDataAcess(); orcc.show3(fff); var list = new List <string>(); int result = 0; foreach (DataRow R in fff.Rows) { //list.Add(R.Field<string>("NUMF")); result = int.Parse(R.Field <string>("NUMF")); } result += 1; xrLabel11.Text = result.ToString(); }
public Printer() { InitializeComponent(); try { var Fdelete = new Assest.OrcDataAcess(); var bind = new System.Windows.Forms.BindingSource(); var datatablea = new DataTable(); Fdelete.Show_(datatablea); var listat = new List <string>(); foreach (DataRow r in datatablea.Rows) { listat.Add(r.Field <string>("PRICE")); } for (int i = 0; i < listat.Count; i++) { Fdelete._Delete(int.Parse(listat[i])); } Barcode.Focus(); }catch (Exception ex) { } }
public string orignial_Sum() { DataTable dt = new DataTable(); var mainclass = new Assest.OrcDataAcess(); mainclass.show4(dt); var Prices = new List <string>(); var Countier = new List <int>(); foreach (DataRow item in dt.Rows) { Prices.Add(item.Field <string>("PRICE").Replace("SAR", "")); } for (int i = 0; i < Prices.Count - 1; i++) { Countier.Add(int.Parse(Prices[i])); } Double Result = Countier.Sum(); return("SAR " + Result.ToString("N2")); }
/* * في نظام الاضافة لقسم الصيانة نحتاج الى * ----------------------------------------------- * اسم الصنف //name * ------------------------------------------ * ترميز الصنف //id * ---------------------------------------------- * تاريخ اضافة الصنف //date * ---------------------------------------------- * * موعد استلام الصنف //darec * --------------------------------------------- * --------------------- * نسبة الخصم.. //discounts * ---------------------------------------------- * وصف العطل في الصنف conprou * -------------------------------------------------- * لمعرفة هل الطلب تم تسليمه ام لا isdone? * -------------------------------------------------------- * نوع الصنف typeprou * ----- -------------------------------------------------------- *//// <summary> /// Erd Sys /// public void add(string id, string name, string price, string date, string darec, string conprou, string typeprou, string discounts, int isdone) { var d = new Assest.OrcDataAcess(); SQLiteConnection cna = new SQLiteConnection(); cna.ConnectionString = d.ConnectionString("", ""); string insert_query = null; insert_query = "INSERT INTO MEGARIP (NAME,PRICE,DAT,discounts,datrec,conprou,typeprou,isdone,ID) VALUES ('" + name + "','" + price + "','" + date + "','" + discounts + "','" + darec + "','" + conprou + "','" + typeprou + "','" + isdone + "','" + id.ToString().Replace("-", "") + "')"; System.Data.SQLite.SQLiteCommand cm = new System.Data.SQLite.SQLiteCommand(); cm.Connection = cna; // cm.CommandType = CommandType.Text; cm.CommandText = insert_query; cna.Open(); cm.ExecuteNonQuery(); cna.Close(); }
public static void FillData(DevExpress.Xpf.Grid.GridControl GC) { var helper = new HelperData <Coustomer>(); var datatable = new System.Data.DataTable(); var GetData = new Assest.OrcDataAcess(); GetData.Show(datatable); foreach (System.Data.DataRow item in datatable.Rows) { helper.Fill().Add(new Coustomer() { NAME = item.Field <string>("NAME"), BARCODE = item.Field <string>("BARCODE"), DAT = item.Field <string>("DAT"), Price_F = item.Field <string>("Price_F"), Dis = item.Field <string>("Dis"), ID = item.Field <string>("ID"), PRICE = item.Field <string>("PRICE"), PRICE_A = item.Field <string>("PRICE_A"), QUANTITY = item.Field <string>("QUANTITY") }); } GC.ItemsSource.Equals(helper.Fill()); }
private async void PrivewDoucmentPrinter_Click(object sender, RoutedEventArgs e) { if (IS_SELECTED) { if (PrintHelper.Print.IsMounth_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (PrintHelper.Print.IsYear_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (PrintHelper.Print.IsDay_) { PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } else if (!PrintHelper.Print.IsDay_ && !PrintHelper.Print.IsMounth_ && !PrintHelper.Print.IsYear_) { SYear(); PrintHelper.Print.GET_STRATED(); var Dataopp = new Assest.OrcDataAcess(); XtraReport4 report = new XtraReport4(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); Dataopp.Delete4(); } } else if (!is_Repair_Selected) { XtraReport1 report = new XtraReport1(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); } if (is_Repair_Selected) { if (Encode1.Text == "/d") { NewModel(type_of_date.day); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = true; PrintHelper.Print.IsYear_ = false; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (Encode1.Text == "/m") { NewModel(type_of_date.month); PrintHelper.Print.IsMounth_ = true; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (Encode1.Text == "/y") { NewModel(type_of_date.year); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = true; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else if (String.IsNullOrEmpty(Encode1.Text)) { NewModel(type_of_date.year); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = true; Reports.XtraReport5 report = new Reports.XtraReport5(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); mo.Delete1(); PrintHelper.Print.IsMounth_ = false; PrintHelper.Print.IsDay_ = false; PrintHelper.Print.IsYear_ = false; } else { //later } } }
private void Print_Click(object sender, RoutedEventArgs e) { var SumPricee = new FunctionsOfSum(); var Fa_delete = new Assest.OrcDataAcess(); var FA = new Assest.OrcDataAcess(); try { double afo = 0; var Filtring = new List <string>(); foreach (string item in PriceList) { Filtring.Add(item.Replace("SAR", "")); } var accc = new Assest.OrcDataAcess(); List <string> L0 = new List <string>(); List <string> L1 = new List <string>(); List <string> L2 = new List <string>(); List <string> L3 = new List <string>(); List <string> L4 = new List <string>(); List <string> L5 = new List <string>(); List <string> L6 = new List <string>(); // List <string> L7 = new List <string>(); //dis List <string> L8 = new List <string>(); //pricef List <string> L9 = new List <string>(); //dat /* * * * */ DataTable tt = new DataTable(); accc.Show(tt); // Finall_Price = (Double)((Price * Discount) / 100) - Price; foreach (DataRow r in tt.Rows) { L1.Add(r.Field <string>("NAME")); L2.Add(r.Field <string>("BARCODE")); L3.Add(r.Field <string>("PRICE_A")); L4.Add(r.Field <string>("PRICE")); L5.Add(r.Field <string>("ID")); L6.Add(r.Field <string>("QUANTITY")); L7.Add(r.Field <string>("Dis")); L8.Add(r.Field <string>("Price_F")); } tt.Clear(); accc.show3(tt); foreach (DataRow r in tt.Rows) { L0.Add(r.Field <String>("NUMF")); } foreach (string asf in Filtring) { afo += double.Parse(asf); } PriceList.Add(afo.ToString()); Pricce.Text = "SAR " + afo.ToString(); var RepHelper = new ReportHelper(); var ILIST = new List <ReportHelper>(); ILIST.Add(new ReportHelper() { Getprice_ = Pricce.Text }); XtraReport3 report = new XtraReport3(); SQLiteConnectionParameters FF = new SQLiteConnectionParameters(); FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db"; ((SqlDataSource)report.DataSource).ConnectionParameters = FF; XtraReportPreviewModel model = new XtraReportPreviewModel(report); DocumentPreviewWindow windoww = new DocumentPreviewWindow() { Model = model }; report.CreateDocument(true); windoww.ShowDialog(); string id_3 = ""; //int finalprice = int.Parse(SumPricee.sumPrice().Replace("SAR", "").Replace(",", "")); //double Ristt = double.Parse(afo.ToString().Replace("SAR", "").Replace(",", "")); //double FInaal = finalprice + Ristt; for (int i = 0; i < L1.Count; i++) { if (L1[i] == Name.Text) { id_3 = L5[i]; } } List <int> sawf = new List <int>(); foreach (string d in L0) { sawf.Add(int.Parse(d)); } #region Convert Days to arabic language string dayoftheweek = ""; switch (DateTime.Now.DayOfWeek) { case DayOfWeek.Sunday: { dayoftheweek = ".الاحد"; break; } case DayOfWeek.Monday: { dayoftheweek = ".الاثنين"; break; } case DayOfWeek.Thursday: { dayoftheweek = ".الخميس"; break; } case DayOfWeek.Saturday: { dayoftheweek = ".السبت"; break; } case DayOfWeek.Friday: { dayoftheweek = "الجمعة."; break; } case DayOfWeek.Tuesday: { dayoftheweek = "الثلاثاء."; break; } case DayOfWeek.Wednesday: { dayoftheweek = "الاربعاء."; break; } } #endregion if (L0.Count == 0) { //null } else { numfa = sawf.Max() + 1; } if (sawf.Count == 0) { UmAlQuraCalendar um = new UmAlQuraCalendar(); String CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() : um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString(); for (int i = 0; i < L1.Count; i++) { double Price = 0; double Discount = 0; double Finall_Price = 0; string Result = ""; DateTime dtttt = new DateTime(); for (int ii = 0; ii < asdf.Count; ii++) { if (L1[i] == asdf[ii]) { accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text); Price = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", "")); Discount = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", "")); Finall_Price = (Double)((Price * Discount) / 100) - Price; Finall_Price = Finall_Price * int.Parse(L6[i]); Result = "SAR " + Finall_Price.ToString("N2").Replace("-", ""); var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result); mainwi.EDIT_MAX(); } /* * * L1.Add(r.Field<string>("NAME")); * L2.Add(r.Field<string>("BARCODE")); * L3.Add(r.Field<string>("PRICE_A")); * L4.Add(r.Field<string>("PRICE")); * L5.Add(r.Field<string>("ID")); * L6.Add(r.Field<string>("QUANTITY")); * L7.Add(r.Field<string>("Dis")); * L8.Add(r.Field<string>("Price_F")); */ } } if (GID.Count > 0) { for (int i = 0; i < GID.Count; i++) { FA.Delete(GID[i]); } } } else { #region Date UmAlQuraCalendar um = new UmAlQuraCalendar(); String CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() : um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString(); #endregion for (int i = 0; i < L1.Count; i++) { double Price = 0; double Discount = 0; double Finall_Price = 0; string Result = ""; DateTime dtttt = new DateTime(); for (int ii = 0; ii < asdf.Count; ii++) { if (L1[i] == asdf[ii]) { accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text); Price = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", "")); Discount = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", "")); Finall_Price = (Double)((Price * Discount) / 100) - Price; Finall_Price = Finall_Price * int.Parse(L6[i]); Result = "SAR " + Finall_Price.ToString("N2").Replace("-", ""); var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result); mainwi.EDIT_MAX(); } } } if (GID.Count > 0) { for (int i = 0; i < GID.Count; i++) { FA.Updating_QUa("0", GID[i].ToString()); } } } asdf.Clear(); for (int i = 0; i < PriceList.Count; i++) { Fa_delete._Delete(double.Parse(PriceList[i].Replace("SAR", "").Replace(",", ""))); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + ":" + ex.HResult.ToString()); } DD.ItemsSource = ""; Observ.Clear(); NameList.Clear(); PriceList.Clear(); }
public void PPP() { try { int Update = 0; DataTable H10 = new DataTable(); DataTable H11 = new DataTable(); var FA = new Assest.OrcDataAcess(); FA.Show(H11); FA.Show_(H10); JSum = H10.Compute("Sum(PRICE)", ""); //listStrings5.Clear(); foreach (DataRow DR in H10.Rows) { listStrings5.Add(DR.Field <string>("BARCODE")); } bool eleno = false; for (int i = 0; i < listStrings.Count; i++) { if (listStrings[i] == listStrings[i] || listStrings[i] == listStrings[i] + "\n") { eleno = true; } } if (eleno == true) { for (int j = 0; j < 1; j++) { if (Quan_li < 1) { DXMessageBox.Show(string.Format("لم يتم العثور على اي نتائج", Name.Text), "خطأ", MessageBoxButton.OK, MessageBoxImage.Error); GID.Add(int.Parse(id_li)); Exists = 0; } else { if (Exists == 1) { Add(); var oracleClassAdd = new Assest.OrcDataAcess(); oracleClassAdd._Add(Name.Text, price.Text, Barcode.Text); A_qua = j; Update = Quan_li - 1;//تنقيص من الكمية الموجودة بالمخزن FA.Updating_QUa(Update.ToString(), id_li); foreach (string s in Price_Report) { price_p += int.Parse(s); } var mainwindow = new MainWindow(); mainwindow.button7_Copy1d_Click(null, null); } else { } } //FA.Updating_QUa(Update.ToString(), liststring4[j]); } } } catch (Exception ex) { } }
public SQLiteConnection cn() { var a = new Assest.OrcDataAcess(); return(new SQLiteConnection(a.ConnectionString("", ""))); }
private void Delete_click(object sender, RoutedEventArgs e) { /// if (DD.Visibility == Visibility.Visible) { #region DataGrid #1 DD.BeginSelection(); string index = ""; var acc = new Assest.OrcDataAcess(); int counting = 0; foreach (int handle in DD.GetSelectedRowHandles()) { if (counting == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { index = (string)DD.GetCellValue(handle, "id"); acc.Delete3(index); break; } case MessageBoxResult.No: break; default: break; } } else if (counting >= 1) { index = (string)DD.GetCellValue(handle, "id"); acc.Delete3(index); } counting++; } if (counting == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع الفواتير, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { acc.Delete3(); break; } case MessageBoxResult.No: break; default: break; } } DD.EndSelection(); var datatablee = new DataTable(); show.show3(datatablee); System.Windows.Forms.BindingSource BindS = new System.Windows.Forms.BindingSource(); BindS.DataSource = datatablee; DD.ItemsSource = BindS; Resultpri.Text = Fos.sumPrice(); Resultpri_a.Text = Fos.sumPrice_a(); #endregion } else if (DDR.Visibility == Visibility.Visible) { #region Datagrid #2 DDR.BeginSelection(); var listU = new List <string>(); listU = SaveDelete(); string iindex = ""; int countingg = 0; var megav = new ModelMega(); foreach (int handle in DDR.GetSelectedRowHandles()) { if (countingg == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات المحدد عليها, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { iindex = (string)DDR.GetCellValue(handle, "رمز المنتج"); megav.Delete(iindex); break; } case MessageBoxResult.No: break; default: break; } } else if (countingg >= 1) { iindex = (string)DDR.GetCellValue(handle, "رمز المنتج"); megav.Delete(iindex); } countingg++; } if (countingg == 0) { MessageBoxResult a = DXMessageBox.Show("سيتم حذف جميع البيانات, هل ترغب بمواصلة العملية؟", "تنبيه", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (a) { case MessageBoxResult.None: break; case MessageBoxResult.OK: { break; } case MessageBoxResult.Cancel: break; case MessageBoxResult.Yes: { ///Need To Fix_+_+_+_+__++_+_+__+_+_++_+_+_+__+_+__+_ megav.Delete(); break; } case MessageBoxResult.No: break; default: break; } } DDR.EndSelection(); var obr = new ObservableCollectionCore <Models.RepairView>(); var megaView = new MegaView(); foreach (DataRow item in megaView.GetAllItemsHasSold().Rows) { obr.Add(new Models.RepairView() { ID = item.Field <string>("ID"), conprou = item.Field <string>("conprou"), PRICE = item.Field <string>("PRICE"), DAT = item.Field <string>("DAT"), NAME = item.Field <string>("NAME"), datrec = item.Field <string>("datrec"), discounts = item.Field <string>("discounts"), typeprou = item.Field <string>("typeprou"), isdone = (item.Field <Int64>("isdone") == -1?true:false) }); } DDR.ItemsSource = obr; Resultpri_a.Text = Fos.sumPrice_a(); #endregion } }