예제 #1
0
        private void btDelete_Click(object sender, EventArgs e)
        {
            string del = dgvSuppliers.CurrentRow.Cells[0].ToString();

            DataSuppliers.Delete(del);
            OpenForm();
        }
예제 #2
0
        public bool CreateSupplier(DataSuppliers supplier)
        {
            bool noError = true;

            try
            {
                using (SqlConnection connection = new SqlConnection(ConnectionString))
                {
                    using (SqlCommand command = new SqlCommand("dbo.sp_SuppliersCreate", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;

                        command.Parameters.AddWithValue("@SupplierName", supplier.SupplierName);
                        command.Parameters.AddWithValue("@ContactName", supplier.ContactName);
                        command.Parameters.AddWithValue("@ContactEmail", supplier.ContactEmail);
                        command.Parameters.AddWithValue("@Address", supplier.Address);
                        command.Parameters.AddWithValue("@SupplierCreateDate", supplier.SupplierCreateDate);
                        command.Parameters.AddWithValue("@SuppliersPhotoURL", supplier.SuppliersPhotoURL);
                        command.Parameters.AddWithValue("@WebsiteURL", supplier.WebsiteURL);

                        connection.Open();
                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception exception)
            {
                noError = false;
                Logger.LogError(exception);
            }
            return(noError);
        }
예제 #3
0
        public ActionResult Stationery()
        {
            List <Stationary> stationerylist = DataSuppliers.GetStationeryInfo();

            //  ViewData["stationerylist"] = stationerylist;

            ViewBag.StatList = stationerylist;

            return(View());
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name   = tbName.Text;
            string region = tbRegion.Text;
            string city   = tbCity.Text;
            string adres  = tbAdres.Text;
            string tel    = tbTel.Text;
            string email  = tbEMail.Text;

            DataSuppliers.Insert(name, region, city, adres, tel, email);
            SuppliersForm suppliersform = new SuppliersForm();

            suppliersform.OpenForm();
            suppliersform.Show();
            this.Close();
        }
예제 #5
0
        public ModelSuppliers Map(DataSuppliers dSupplier)
        {
            ModelSuppliers returnSupplier = new ModelSuppliers();

            returnSupplier.SupplierID         = dSupplier.SupplierID;
            returnSupplier.SupplierName       = dSupplier.SupplierName;
            returnSupplier.ContactName        = dSupplier.ContactName;
            returnSupplier.SupplierName       = dSupplier.SupplierName;
            returnSupplier.ContactEmail       = dSupplier.ContactEmail;
            returnSupplier.Address            = dSupplier.Address;
            returnSupplier.SupplierCreateDate = dSupplier.SupplierCreateDate;
            returnSupplier.SuppliersPhotoURL  = dSupplier.SuppliersPhotoURL;
            returnSupplier.WebsiteURL         = dSupplier.WebsiteURL;

            return(returnSupplier);
        }
예제 #6
0
        public DataSuppliers Map(ModelSuppliers mSupplier)
        {
            DataSuppliers returnSupplier = new DataSuppliers();

            returnSupplier.SupplierID         = mSupplier.SupplierID;
            returnSupplier.SupplierName       = mSupplier.SupplierName;
            returnSupplier.ContactName        = mSupplier.ContactName;
            returnSupplier.SupplierName       = mSupplier.SupplierName;
            returnSupplier.ContactEmail       = mSupplier.ContactEmail;
            returnSupplier.Address            = mSupplier.Address;
            returnSupplier.SupplierCreateDate = mSupplier.SupplierCreateDate;
            returnSupplier.SuppliersPhotoURL  = mSupplier.SuppliersPhotoURL;
            returnSupplier.WebsiteURL         = mSupplier.WebsiteURL;


            return(returnSupplier);
        }
예제 #7
0
        public void OpenForm()
        {
            DataSuppliers.Load();
            DataTable dt = DataSuppliers.DBOperation();
            DataView  dv = new DataView(dt);

            bsSuppliers.DataSource  = dv;
            dgvSuppliers.DataSource = bsSuppliers;
            //фильтры
            if (dgvSuppliers.Rows.Count > 0)
            {
                cbRegion.DataSource    = dv.ToTable(true, "Область");
                cbRegion.DisplayMember = "Область";
                cbRegion.Text          = String.Empty;
                btDelRegion.Visible    = false;

                cbCity.DataSource    = dv.ToTable(true, "Город");
                cbCity.DisplayMember = "Город";
                cbCity.Text          = String.Empty;
                btDelCity.Visible    = false;
            }
        }
예제 #8
0
        public ActionResult ViewSupplier(Stationary s)
        {
            Stationary st = DataSuppliers.iteminfo(s.ItemID);

            List <Suppliers> SupplierList = new List <Suppliers>();

            Suppliers s1 = DataSuppliers.supplierDetails(st.PrioritySupplier1);

            SupplierList.Add(s1);

            Suppliers s2 = DataSuppliers.supplierDetails(st.PrioritySupplier2);

            SupplierList.Add(s2);

            Suppliers s3 = DataSuppliers.supplierDetails(st.PrioritySupplier3);

            SupplierList.Add(s3);

            ViewBag.supplierInfo = SupplierList;

            return(View());
        }
예제 #9
0
        public List <DataSuppliers> GetSuppliers()
        {
            List <DataSuppliers> allProducts = new List <DataSuppliers>();

            try
            {
                using (SqlConnection connection = new SqlConnection(ConnectionString))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand("dbo.sp_SuppliersGetAll", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        SqlDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            DataSuppliers dSupplier = new DataSuppliers();

                            dSupplier.SupplierID         = reader.GetInt32(0);
                            dSupplier.SupplierName       = reader.GetString(1);
                            dSupplier.ContactName        = reader.GetString(2);
                            dSupplier.ContactEmail       = reader.GetString(3);
                            dSupplier.Address            = reader.GetString(4);
                            dSupplier.SupplierCreateDate = reader.GetDateTime(5);
                            dSupplier.SuppliersPhotoURL  = reader.GetString(6);
                            dSupplier.WebsiteURL         = reader.GetString(7);
                            allProducts.Add(dSupplier);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.LogError(exception);
            }

            return(allProducts);
        }
예제 #10
0
        public DataSuppliers SuppliersGetByID(int SupplierID)
        {
            DataSuppliers dSupplier = new DataSuppliers();

            try
            {
                using (SqlConnection connection = new SqlConnection(ConnectionString))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand("dbo.sp_SuppliersGetByID", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("@SupplierID", SupplierID);
                        SqlDataReader reader = command.ExecuteReader();

                        while (reader.Read())
                        {
                            dSupplier.SupplierID         = reader.GetInt32(0);
                            dSupplier.SupplierName       = reader.GetString(1);
                            dSupplier.ContactName        = reader.GetString(2);
                            dSupplier.ContactEmail       = reader.GetString(3);
                            dSupplier.Address            = reader.GetString(4);
                            dSupplier.SupplierCreateDate = reader.GetDateTime(5);
                            dSupplier.SuppliersPhotoURL  = reader.GetString(6);
                            dSupplier.WebsiteURL         = reader.GetString(7);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.LogError(exception);
            }

            return(dSupplier);
        }