Ejemplo n.º 1
0
        private void addwhse_btn_Click(object sender, EventArgs e)
        {
            Warehouse_Master wm = new Warehouse_Master(Partnumber_txt.Text, plant_cbo.Text);

            if (whse_cbo.Items.Count > 0)
            {
                wm.Whse_DS.Tables.Add();

                wm.Whse_DS.Tables[0].Columns.Add(new DataColumn("WarehouseCode", typeof(System.String)));

                wm.Whse_DS.Tables[0].Columns.Add(new DataColumn("WarehouseName", typeof(System.String)));

                for (int i = 0; i < whse_cbo.Items.Count; i++)
                {
                    DataRow dr = wm.Whse_DS.Tables[0].NewRow();

                    whse_cbo.SelectedIndex = i;

                    dr["WarehouseCode"] = whse_cbo.SelectedValue;

                    dr["WarehouseName"] = whse_cbo.Text;

                    wm.Whse_DS.Tables[0].Rows.Add(dr);
                }
            }
            wm.ShowDialog();

            //get added warehouse list from form
            whse_cbo.DataSource = wm.Whse_DS.Tables[0];

            whse_cbo.DisplayMember = "WarehouseName";

            whse_cbo.ValueMember = "WarehouseCode";

            wm.Dispose();

            DataList.EpicClose();

            if (whse_cbo.Items.Count > 0)
                addwhse_btn.Text = "&Edit";
            else
                addwhse_btn.Text = "&Add";
        }
Ejemplo n.º 2
0
        private void addwhse_btn_Click(object sender, EventArgs e)
        {
            RefreshTransaction();

            Warehouse_Master wm = new Warehouse_Master(itemtemplatename_txt.Text, plant_cbo.Text);

            if (whse_cbo.Items.Count > 0)
            {
                wm.Whse_DS.Tables.Add();

                wm.Whse_DS.Tables[0].Columns.Add(new DataColumn("WarehouseCode", typeof(System.String)));

                wm.Whse_DS.Tables[0].Columns.Add(new DataColumn("WarehouseName", typeof(System.String)));

                for (int i = 0; i < whse_cbo.Items.Count; i++)
                {
                    DataRow dr = wm.Whse_DS.Tables[0].NewRow();

                    whse_cbo.SelectedIndex = i;

                    dr["WarehouseCode"] = whse_cbo.SelectedValue;

                    dr["WarehouseName"] = whse_cbo.Text;

                    wm.Whse_DS.Tables[0].Rows.Add(dr);
                }
            }
            wm.ShowDialog();

            //get added warehouse list from form
            whse_cbo.DataSource = wm.Whse_DS.Tables[0];

            whse_cbo.DisplayMember = "WarehouseName";

            whse_cbo.ValueMember = "WarehouseCode";

            wm.Dispose();

            DataList.EpicClose();

            if (whse_cbo.Items.Count > 0)
                addwhse_btn.Text = "&Edit";
            else
                addwhse_btn.Text = "&Add";

            #region Add to SQL

            TemplateAdapter.DeleteWarehousePerItem(itemtemplatename_txt.Text);

            for (int i = 0; i < whse_cbo.Items.Count; i++)
            {
                whse_cbo.SelectedIndex = i;

                TemplateAdapter.InsertPropertyLine(itemtemplatename_txt.Text, "ITEM", "WAREHOUSE", whse_cbo.Text, whse_cbo.SelectedValue.ToString(), "", "");
            }

            #endregion
        }