Пример #1
0
 public void Remove(Kategori obj)
 {
     this.List.Remove(obj);
 }
Пример #2
0
 public int IndexOf(Kategori obj)
 {
     return(this.List.IndexOf(obj));
 }
Пример #3
0
 public bool Contains(Kategori obj)
 {
     return(this.List.Contains(obj));
 }
Пример #4
0
 public void Insert(int index, Kategori obj)
 {
     this.List.Insert(index, obj);
 }
Пример #5
0
 public int Add(Kategori obj)
 {
     return(this.List.Add(obj));
 }
Пример #6
0
 void urunIceAktarButton_Click(object sender, EventArgs e)
 {
     try
     {
         using (OpenFileDialog file = new OpenFileDialog())
         {
             file.Title = L.AktarilacakExcelDosyasi;
             Kategori k = (this.kategoriAktarimLookUpEdit.GetSelectedDataRow() as Kategori);
             if (k != null)
             {
                 file.FileName = k.Adi.Replace("/", "").Replace("\\", "") + " - " + L.AlisFiyati + " - " + DateTime.Now.ToString("yyyy-MM-dd") + ".xls";
             }
             else
             {
                 dxErrorProvider1.SetError(kategoriAktarimLookUpEdit, L.BosGecilemez);
                 return;
             }
             file.Filter = "Excel (2003)|*.xls";
             switch (file.ShowDialog())
             {
             case System.Windows.Forms.DialogResult.OK:
             case System.Windows.Forms.DialogResult.Yes:
                 using (BAYMYO.MultiSQLClient.MDataAdapter dap = new BAYMYO.MultiSQLClient.MDataAdapter("select * from [DATA$A:D]", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file.FileName + ";Extended Properties=Excel 8.0", BAYMYO.MultiSQLClient.MClientProvider.OleDb))
                 {
                     using (DataTable dt = new DataTable("ProductList"))
                     {
                         dap.Fill(dt);
                         if (dt.Rows.Count > 0)
                         {
                             using (xFrmUrunYeni sd = new xFrmUrunYeni())
                             {
                                 sd.Text  = L.YeniUrunKategoriBazinda;
                                 sd.Mesaj = string.Format(L.KategoridekiUrunListesi, k.Adi);
                                 sd.Data  = new List <Urun>();
                                 foreach (DataRow dr in dt.Rows)
                                 {
                                     Urun u = new Urun
                                     {
                                         KategoriID = k.ID,
                                         Kod        = Commons.CreateImpaCode(dr[0]),//BAYMYO.UI.Converts.NullToInt(BAYMYO.UI.Converts.NullToString(dr[0]).Replace(" ", "").Trim()).ToString("00 00 00"),
                                         Adi        = BAYMYO.UI.Converts.NullToString(dr[1]),
                                         Miktar     = 1,
                                         Birim      = BAYMYO.UI.Converts.NullToString(dr[2]),
                                         Kdv        = BAYMYO.UI.Converts.NullToFloat(dr[3]),
                                         Tarih      = DateTime.Now
                                     };
                                     if (!string.IsNullOrWhiteSpace(u.Adi))
                                     {
                                         sd.Data.Add(u);
                                     }
                                 }
                                 switch (sd.ShowDialog())
                                 {
                                 case DialogResult.Yes:
                                     Commons.Loading("Product updates.. .");
                                     foreach (Urun stk in sd.Data)
                                     {
                                         UrunMethods.Insert(stk);
                                     }
                                     Commons.Update(TableNames.Urun);
                                     Commons.Status(string.Format(L.KategoriUrunlerEklendi, k.Adi));
                                     dxErrorProvider1.ClearErrors();
                                     GetData(k.ID);
                                     break;
                                 }
                                 sd.Data = null;
                             }
                         }
                     }
                 }
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FUN", 8) + ex.Message);
     }
     finally
     {
         Commons.Loaded();
     }
 }