Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // if (GblIQCare.ItemFeatureId == 144)
            // {
            if (ddlSupplierName.SelectedValue.ToString() == "0")
            {
                //IQCareWindowMsgBox.ShowWindow("SupplierName", this);
                MsgBuilder theBuilder = new MsgBuilder();
                if (GblIQCare.ItemFeatureId == 144)
                {
                    theBuilder.DataElements["Control"] = "Supplier Name";
                }
                else if (GblIQCare.ItemFeatureId == 149)
                {
                    theBuilder.DataElements["Control"] = "Store Name";
                }
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlSupplierName.Focus();
                return;
            }
            if (ddlItemType.SelectedValue.ToString() == "0")
            {
                //IQCareWindowMsgBox.ShowWindow("ItemTypeSelect", this);
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Item type";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlItemType.Focus();
                return;
            }
            // }
            try
            {
                DtItem      = CreateItemTable();
                arrItemList = new ArrayList();
                for (int i = 0; i < chkItemList.Items.Count; i++)
                {
                    if (chkItemList.GetItemChecked(i) == true)
                    {
                        DataRow theDR = DtItem.NewRow();
                        theDR["ItemID"] = Convert.ToInt32((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString());
                        DataView theDV = new DataView(theItemList);
                        theDV.RowFilter = "ItemID =" + theDR["ItemID"].ToString();
                        // arrItemList.Add((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString());
                        DtItem.Rows.Add(theDR);
                    }
                }

                IMasterList objMasterlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                int         ret           = 0;
                if (GblIQCare.ItemFeatureId == 144)
                {
                    ret = objMasterlist.SaveSupplierItemList(DtItem, Convert.ToInt32(ddlItemType.SelectedValue), GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue));

                    ddlSupplierName.SelectedValue = 0;
                    ddlItemType.SelectedValue     = 0;
                    ddlItemSubType.SelectedValue  = 0;
                }
                else if (GblIQCare.ItemFeatureId == 149)
                {
                    // ret = objMasterlist.SaveStoreItemList(DtItem, GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue));
                    ret = objMasterlist.SaveStoreItemList_Filtered(DtItem, GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue), Convert.ToInt32(ddlItemType.SelectedValue));
                    ddlSupplierName.SelectedValue = 0;

                    ddlItemType.SelectedValue    = 0;
                    ddlItemSubType.SelectedValue = 0;
                }



                // BindItemListStore(0);

                if (ret > 0)
                {
                    IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
                    chkItemList.DataSource = null;
                    chkItemList.Items.Clear();
                    return;
                }
            }



            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }