Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlProgramName.SelectedValue.ToString() == "0")
            {
                //   IQCareWindowMsgBox.ShowWindow("ProgramType", this);
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Program Name";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlProgramName.Focus();
                return;
            }
            if (ddlItemType.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Item Type";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlItemType.Focus();
                return;
            }
            try
            {
                DtItem = CreateItemtTable();

                arrItemList = new ArrayList();
                for (int i = 0; i < chkItemList.Items.Count; i++)
                {
                    DataRow theDR = DtItem.NewRow();
                    theDR["ItemID"] = Convert.ToInt32((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString());
                    if (chkItemList.GetItemChecked(i) == true)
                    {
                        theDR["Checked"] = 1;
                    }
                    else
                    {
                        theDR["Checked"] = 0;
                    }
                    DtItem.Rows.Add(theDR);

                    //DataView theDV = new DataView(theItemList);
                    //theDV.RowFilter = "ItemID =" + theDR["ItemID"].ToString();
                    //theDR["DrugGeneric"] = theDV.ToTable().Rows[0]["DrugGeneric"].ToString();
                    // arrItemList.Add((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString());
                }

                string      ItemType      = ddlItemType.SelectedValue.ToString();
                IMasterList objMasterlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                int         ret           = objMasterlist.SaveItemList(DtItem, Convert.ToInt32(ddlItemType.SelectedValue), GblIQCare.AppUserId, Convert.ToInt32(ddlProgramName.SelectedValue));
                if (ret > 0)
                {
                    IQCareWindowMsgBox.ShowWindow("ProgramSave", this);

                    chkItemList.DataSource = null;
                    chkItemList.Items.Clear();
                    ddlProgramName.SelectedValue = 0;
                    ddlItemType.SelectedValue    = 0;
                    ddlItemSubType.SelectedValue = 0;
                    //BindItemList(0, 0, 0);
                    return;
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }