Esempio n. 1
0
        public void Assortment_IsEmpty_WhenResellerBlocksProduct()
        {
            _supplier.Add(BuildSupplierProduct());

            _reseller.SaleProductFilter.DefaultInclude   = false;
            _salespoint.SaleProductFilter.DefaultInclude = true;
            var assortment = _salespoint.GetAssortment();

            Assert.That(assortment.StoreProducts, Is.Empty);
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtAddress.Text == null || txtAddress.Text == "" || txtSupName.Text == null || txtSupName.Text == "" || txtContactNo.Text == null || txtContactNo.Text == "" || txtCompany.Text == "" || txtCompany.Text == null)
                {
                    MessageBox.Show("Please enter valid data");
                    return;
                }
                string   supName = txtSupName.Text;
                Supplier supObj  = new Supplier();;
                bool     isExist = supObj.checkNameExit(supName, con);

                if (isExist)
                {
                    PopupNotifier pop = new PopupNotifier();
                    pop.ContentText       = "Supplier Name already exist ";
                    pop.TitleText         = "Redundancy Error";
                    pop.Image             = Resources.warning_sign_48; // or Image.FromFile(--Path--)
                    pop.IsRightToLeft     = false;
                    pop.ContentHoverColor = Color.OrangeRed;
                    pop.BodyColor         = Color.White;
                    pop.HeaderColor       = Color.Teal;
                    pop.Popup();
                    return;
                }

                supObj.Name    = supName;
                supObj.Address = txtAddress.Text;
                supObj.Contact = txtContactNo.Text;
                supObj.Company = txtCompany.Text;

                if (supObj.Add(con))
                {
                    MetroMessageBox.Show(this, "Supplier Data Stored Successfully", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    PopupNotifier pop = new PopupNotifier();
                    pop.ContentText       = "Supplier Data Added Successfully";
                    pop.TitleText         = "Saved";
                    pop.Image             = Resources.success_48; // or Image.FromFile(--Path--)
                    pop.IsRightToLeft     = false;
                    pop.ContentHoverColor = Color.OrangeRed;
                    pop.BodyColor         = Color.White;
                    pop.HeaderColor       = Color.Teal;
                    pop.Popup();
                    LoadCartInitial();
                }
            }

            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "System Error!", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (Supplier.FindByCompany(txtCompanyName.Text).Count > 0)
            {
                MessageBox.Show("This customer ID is exted!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnAdd.Enabled = false;
                return;
            }
            Supplier newSupp = supplierLoad();

            Supplier.Add(newSupp);
            MessageBox.Show("Adding is successful!", "Message Box!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 4
0
        public static SupplierCollection GetSupplierData()
        {
            SupplierCollection suppliers = new SupplierCollection();

            Supplier supplier = new Supplier("Supplier#1");

            suppliers.Add(supplier);
            supplier.Add(CreateProduct(supplier.SupplierID, "Product#1"));
            supplier.Add(CreateProduct(supplier.SupplierID, "Product#2"));
            supplier.Add(CreateProduct(supplier.SupplierID, "Product#3"));

            supplier = new Supplier("Supplier#2");
            suppliers.Add(supplier);
            supplier.Add(CreateProduct(supplier.SupplierID, "Product@1"));
            supplier.Add(CreateProduct(supplier.SupplierID, "Product@2"));

            supplier = new Supplier("Supplier#3");
            suppliers.Add(supplier);
            supplier.Add(CreateProduct(supplier.SupplierID, "Product:1"));
            supplier.Add(CreateProduct(supplier.SupplierID, "Product:2"));
            supplier.Add(CreateProduct(supplier.SupplierID, "Product:3"));

            return(suppliers);
        }
Esempio n. 5
0
        private void btnAddSupplier_Click(object sender, EventArgs e)
        {
            bool addResult = Supplier.Add(new Supplier(txtName.Text, txtAddress.Text,
                                                       txtAddress2.Text, txtCity.Text, txtPostcode.Text, txtPhone.Text, txtEmail.Text));

            if (addResult)
            {
                //customer added successful
                if (MessageBox.Show("Supplier Added!", "Success:", MessageBoxButtons.OK) == DialogResult.OK)
                {
                    this.Close();
                }
            }
            else
            {
                //handle the bad insert
                MessageBox.Show("Check your input!", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
 protected void btnSupplier_Click(object sender, EventArgs e)
 {
     newSupp = new Supplier(txtName.Text, txtAddress.Text, Convert.ToInt32(txtPhoneNum.Text), txtNotes.Text);
     Response.Write(newSupp.Add());
 }
Esempio n. 7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            base.NeedLogin = true;
            base.ReturnUrl = Request.RawUrl;
            if (base.IsPost && base.UserID != -1)
            {
                string text    = WebUtils.GetFormString("_action", "add").ToLower();
                int    formInt = WebUtils.GetFormInt("_idcom");

                SupplierInfo com = new SupplierInfo();
                if (text.Equals("modify"))
                {
                    com = Supplier.GetDataById(formInt);
                }
                com.Name    = WebUtils.GetFormString("name");
                com.Address = WebUtils.GetFormString("address");
                com.Country = WebUtils.GetFormString("country");
                if (text == "del")
                {
                    if (Supplier.Delete(formInt))
                    {
                        base.WriteJsonTip(true, base.GetCaption("Comp_Success"));
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Comp_DeleteFail"));
                    }
                }
                else if (string.IsNullOrEmpty(com.Name))
                {
                    base.WriteJsonTip(base.GetCaption("Comp_NameNotEmpty"));
                }
                else if (string.IsNullOrEmpty(com.Address))
                {
                    base.WriteJsonTip(base.GetCaption("Comp_AddressNotEmpty"));
                }
                else if (string.IsNullOrEmpty(com.Country))
                {
                    base.WriteJsonTip(base.GetCaption("Comp_PhoneNotEmpty"));
                }
                else if (text == "modify")
                {
                    if (Supplier.Update(com))
                    {
                        base.WriteJsonTip(true, base.GetCaption("Comp_Success"));
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Comp_UpdateFail"));
                    }
                }
                else
                {
                    com.AutoTimeStamp = System.DateTime.Now;
                    int num = Supplier.Add(com);
                    if (num > 0)
                    {
                        base.WriteJsonTip(true, base.GetCaption("Comp_Success"));
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Comp_AddFail"));
                    }
                }
            }


            else
            {
                int pageSize = 15;

                StringBuilder builderCondition = new StringBuilder(" 1=1 ");

                string strSort = " AutoID desc ";

                StringBuilder builderUrlPattern = new StringBuilder(base.ResolveUrl("~/List_Supplier.aspx"));
                builderUrlPattern.Append("?");
                builderUrlPattern.Append("&page=$page");

                CMSPager pager = contents.GetPager(BLL.Supplier.GetCount(builderCondition.ToString()), intCurrentPage, pageSize, builderUrlPattern.ToString());
                base.Put("pager", pager);
                IList <SupplierInfo> supplier = BLL.Supplier.GetPagerList(builderCondition.ToString(), strSort, pager.PageIndex, pager.PageSize, ref intTotalCount, ref intTotalPage);
                base.Put("sup", supplier);
                base.UsingClient("temp/content_supplier.html");
            }
        }