示例#1
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            ledgermodel l = new ledgermodel();
            url = null;
            OleDbDataReader dr = l.getgroup(3);
            while (dr.Read())
            {
                string img = @System.AppDomain.CurrentDomain.BaseDirectory + "\\images\\" + dr.GetValue(1).ToString() + ".jpg";
                if (!File.Exists(img))
                {
                    img = @System.AppDomain.CurrentDomain.BaseDirectory + "\\images\\default.jpg";
                }
                ledgerbalance x = (from a in application.tb where a.Lid == int.Parse(dr.GetValue(0).ToString()) select a).First<ledgerbalance>();
                String y = x.Balance.ToString();
                if (y == "0")
                {
                    y = "Nil";
                }

                ledger lb = new ledger()
                {
                    Lid = int.Parse(dr.GetValue(0).ToString()),
                    Lname = dr.GetValue(1).ToString(),
                    Laddress = dr.GetValue(2).ToString(),
                    Lphoneno = dr.GetValue(3).ToString(),
                    Lemail = dr.GetValue(4).ToString(),
                    Limage = img,
                    Balance = y,
                    BalanceType = x.BalanceType
                };
                lc.Add(lb);

            }
            listBox1.ItemsSource = lc;
        }
示例#2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ledgermodel l = new ledgermodel(txtlname.Text, 3, txtladd.Text, txtlno.Text, txtlmail.Text);
            //Hashtable error = l.checkvalid();
            //int a = l.
              if (txtladd.Text.Trim().ToString() == "" || txtlmail.Text.Trim().ToString() == "" || txtlname.Text.Trim().ToString() == "" || txtlno.Text.Trim().ToString()=="")
              {
                  Show("Please Enter all Data of Supplier",2);
                  return;
              }
              if (!(Regex.IsMatch(txtlno.Text, @"^\+?(\d[\d-. ]+)?(\([\d-. ]+\))?[\d-. ]+\d$")) || txtlno.Text.Length < 6 || txtlno.Text.Length > 10)
              {
                  Show("Please Enter Valid Phone No.",2);
                  return;
              }
              if (!Regex.IsMatch(txtlmail.Text, @"^\S+@\S+$"))
              {
                  Show("Please Enter Valid Email id No.",2);
                  return;
              }

            if (l.insert(this))
            {
                Show("Supplier Saved",1);
                txtlname.ClearValue(TextBox.BorderBrushProperty);
                int sid = l.lastid();
                MessageBox.Show(sid.ToString());
                ledger nlb = new ledger()
                {
                    Lid = sid,
                    Lname= txtlname.Text,
                    Lgroup = 3,
                    Laddress = txtladd.Text,
                    Lphoneno = txtlno.Text,
                    Lemail = txtlmail.Text
                };
                ledgerbalance lb = new ledgerbalance() { Lid = sid, Lname = txtlname.Text, Balance = 0 };
                application.tb.Add(lb);
                if (url != null)
                {
                    string targetPath = @System.AppDomain.CurrentDomain.BaseDirectory + "\\images\\" + txtlname.Text + ".jpg";
                    System.IO.File.Copy(url, targetPath, true);
                    nlb.Limage = targetPath;
                }
                else
                {
                    nlb.Limage = @System.AppDomain.CurrentDomain.BaseDirectory + "\\images\\default.jpg";
                }
                lc.Add(nlb);
                clr();
            }
            else
            {
                Show("Supplier Not Saved",2);
            }
            //   l.showerror(error,this);
        }
示例#3
0
        private void btn_update_Click(object sender, RoutedEventArgs e)
        {
            if (txtladd.Text.Trim().ToString() == "" || txtlmail.Text.Trim().ToString() == "" || txtlname.Text.Trim().ToString() == "" || txtlno.Text.Trim().ToString() == "")
            {
                Show("Please Enter all Data of Supplier", 2);
                return;
            }
            if (!(Regex.IsMatch(txtlno.Text, @"^\+?(\d[\d-. ]+)?(\([\d-. ]+\))?[\d-. ]+\d$")) || txtlno.Text.Length < 6 || txtlno.Text.Length > 10)
            {
                Show("Please Enter Valid Phone No.", 2);
                return;
            }
            if (!Regex.IsMatch(txtlmail.Text, @"^\S+@\S+$"))
            {
                Show("Please Enter Valid Email id ", 2);
                return;
            }
            ledgermodel lm = new ledgermodel(txtlname.Text, 3, txtladd.Text, txtlno.Text, txtlmail.Text, l.Lid);
            if (lm.update(this))
            {
               Show("Supplier Updated",1);
                if (url != null)
                {
                    string targetPath = @System.AppDomain.CurrentDomain.BaseDirectory + "\\images\\" + txtlname.Text + ".jpg";
                    System.IO.File.Copy(url, targetPath, true);
                }
                btn_edit.IsEnabled = true;
                can_edit.Visibility = Visibility.Visible;
                btn_update.Visibility = Visibility.Hidden;
                edittoggle(false);
                var x = lc.FirstOrDefault(i => i.Lid == l.Lid);
                x.Lname = txtlname.Text;

            }
        }
示例#4
0
文件: cashmodel.cs 项目: sumit10/BMS
 public bool createaccount(string name, double ob, string type, string date)
 {
     ledgermodel l;
         int a = -1;
         transactionmodel t;
         bool ldr;
         if (type == "Cash")
         {
             a = 1;
             ldr = true;
         }
         else if(type == "Bank A/c")
         {
             a = 14;
             ldr = true;
         }
         else if (type == "expance")
         {
             a = 12;
             ldr = false;
         }
         else
         {
             a = 15;
             ldr = true;
         }
         l = new ledgermodel(name, a, "", "", "");
         int lid = l.getlid();
         if (ldr)
         {
             t = new transactionmodel(lid, 76, ob, ob, date);
         }
         else
         {
             t = new transactionmodel(76, lid, ob, ob, date);
         }
         OleDbTransaction olt;
       try
     {
         con.Open();
         olt = con.BeginTransaction();
         l.tinsert(con, olt).ExecuteNonQuery();
         t.tinsert(olt, con).ExecuteNonQuery();
         olt.Commit();
         MessageBox.Show("Account Created Succesfull");
         return true;
     }
     catch (Exception e)
     {
         MessageBox.Show("Error " + e.ToString());
         return false;
     }
     finally
     {
         con.Close();
     }
 }
示例#5
0
 private void btnac_Click(object sender, RoutedEventArgs e)
 {
     ledgermodel l = new ledgermodel(txtac.Text, 11, "", "", "");
     if (l.insert(this))
     {
         Show("Saved Susessfully",1);
         txtac.Text = "";
     }
 }
示例#6
0
 private void print_Click(object sender, RoutedEventArgs e)
 {
     ledger l = new ledgermodel().getprintdetail(lid);
      report.print_invoice p = new BMS.report.print_invoice();
      p.tax_no.Content = rp_vno.Content;
      p.challan_no.Content = rp_vno.Content;
      p.lbl_cusname.Content = rp_customer.Content;
      p.grand_tot.Content = rp_total.Content;
      p.freight.Content = rp_tnsp.Content;
      p.roundoff.Content = rp_round.Content;
      p.vat_Copy.Content = rp_vatrate.Content;
      p.vat.Content = rp_vat.Content;
      p.tax_date.Content = rp_datePicker.Text;
      p.challan_date.Content = rp_datePicker.Text;
      p.lbl_address.Content = l.Laddress;
      // p.lbl_vatrate.Content = txtvat.Text;
      //p.lbl_aworld.Text = NumberToWords(int.Parse(txttotalamount.Text));
      p.total_amt.Content = rp_total.Content; ;
      p.lst_item.ItemsSource = listBox2.Items;
      PrintDialog pd = new PrintDialog();
      if (pd.ShowDialog() != true) return;
      FixedDocument document = new FixedDocument();
      document.DocumentPaginator.PageSize = new Size(96 * 8.5, 96 * 11);
      FixedPage page1 = new FixedPage();
      page1.Width = document.DocumentPaginator.PageSize.Width;
      page1.Height = document.DocumentPaginator.PageSize.Height;
      Canvas can = p.layout;
      page1.Children.Add(can);
      PageContent page1Content = new PageContent();
      ((IAddChild)page1Content).AddChild(page1);
      document.Pages.Add(page1Content);
      pd.PrintDocument(document.DocumentPaginator, "My first document");
 }