Ejemplo n.º 1
0
        private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (obj == null)
            {
                obj = new PRODUCT_SIZE();

                int proID = Int32.Parse(cboxProduct.Text.Substring(cboxProduct.Text.IndexOf('0'), cboxProduct.Text.IndexOf(' ') - cboxProduct.Text.IndexOf('0')));
                obj.PRODUCT_ID = proID;

                obj.SIZE = cboxSize.Text;
                obj.IN_STOCK_QUANTITY = Int32.Parse(tboxQuantity.Text);

                preProductSize.saveProductSize(obj);
            }
            else
            {
                int proID = Int32.Parse(cboxProduct.Text.Substring(cboxProduct.Text.IndexOf('0'), cboxProduct.Text.IndexOf(' ') - cboxProduct.Text.IndexOf('0')));
                obj.PRODUCT_ID = proID;

                obj.SIZE = cboxSize.Text;
                obj.IN_STOCK_QUANTITY = Int32.Parse(tboxQuantity.Text);
                preProductSize.updateProductSize(obj);
            }

            beforeForm.WindowState = FormWindowState.Maximized;
            beforeForm.Activate();
            //Close();
        }
Ejemplo n.º 2
0
        public frmAddProductSize(ProductSizePresenter preProductSize, Model.PRODUCT_SIZE obj)
        {
            this.preProductSize = preProductSize;
            this.obj            = obj;
            InitializeComponent();

            tboxQuantity.Text = obj.IN_STOCK_QUANTITY.ToString();

            foreach (DataRow d in preProductSize.loadProductDT(false).Rows)
            {
                int proID = Int32.Parse(d[0].ToString().Substring(d[0].ToString().IndexOf('0'), d[0].ToString().Length - d[0].ToString().IndexOf('0')));
                if (obj.PRODUCT_ID.Equals(proID))
                {
                    string str = d[0].ToString() + " - " + d[1].ToString();
                    cboxProduct.Text = str;
                    break;
                }
            }

            cboxSize.Text = obj.SIZE;

            setSource();

            foreach (DataRow d in preProductSize.loadProductDT(false).Rows)
            {
                int proID = Int32.Parse(d[0].ToString().Substring(d[0].ToString().IndexOf('0'), d[0].ToString().Length - d[0].ToString().IndexOf('0')));
                if (obj.PRODUCT_ID.Equals(proID))
                {
                    string str = d[0].ToString() + " - " + d[1].ToString();
                    cboxProduct.Text = str;
                    break;
                }
            }

            if (obj != null)
            {
                cboxProduct.ReadOnly = true;
                cboxSize.ReadOnly    = true;
            }
        }
Ejemplo n.º 3
0
 public frmAddProductSize(ProductSizePresenter preProductSize, Model.PRODUCT_SIZE obj, Form beforeForm)
     : this(preProductSize, obj)
 {
     this.beforeForm = beforeForm;
 }