示例#1
0
        protected override void Initialize(Supplier t, Dictionary <string, object> dr)
        {
            base.Initialize(t, dr);
            t.Address           = dr.GetValue <string>("Address");
            t.AuthorNameSurname = dr.GetValue <string>("AuthorNameSurname");
            t.CompanyName       = dr.GetValue <string>("CompanyName");
            t.Email             = dr.GetValue <string>("Email");
            t.GSM       = dr.GetValue <string>("GSM");
            t.Score     = dr.GetValue <string>("Score");
            t.Telephone = dr.GetValue <string>("Telephone");
            t.Country   = dr.GetValue <string>("Country");
            t.TaxOffice = dr.GetValue <string>("TaxOffice");
            t.TaxNumber = dr.GetValue <string>("TaxNumber");
            t.IsActive  = dr.GetValue <bool>("IsActive");

            string segments = dr.GetValue <string>("SupplierSegment");

            if (!string.IsNullOrEmpty(segments))
            {
                string[] segmentIds = segments.Split(';');
                if (segmentIds != null && segmentIds.Count() != 0)
                {
                    t.Segments = new List <SupplierSegment>();
                    foreach (var id in segmentIds)
                    {
                        SupplierSegment supplierSegment = SupplierSegmentProvider.Instance.GetItem(int.Parse(id));
                        t.Segments.Add(supplierSegment);
                    }
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            IsEmptyKontrol();
            if (!string.IsNullOrEmpty(txtUnvan.Text.Trim()))
            {
                SupplierSegment supplierSegment = new SupplierSegment();
                supplierSegment.Name = txtUnvan.Text.Trim();
                List <SupplierSegment> existingItem = SupplierSegmentProvider.Instance.GetItems("Name", supplierSegment.Name);

                if (existingItem.Count == 0)
                {
                    SupplierSegmentProvider.Instance.Save(supplierSegment);
                    this.LoadGrid();
                    //frm_MesajFormu mf = new frm_MesajFormu();
                    //mf.lblMesaj.Text = "Faaliyet alanı eklendi...";
                    //mf.ShowDialog();
                    //this._owner.LoadSupplierSegments();
                    //this.Close();
                    UIPopupManager.Instance.ShowPopup();
                    txtUnvan.ResetText();
                    txtUnvan.Focus();
                }
                else
                {
                    MessageBox.Show("Ayni kayit vardir");
                }
            }
        }