コード例 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                StringBuilder theErrorMsg = new StringBuilder();
                if (txtNewCategory.Visible == true && txtNewCategory.Text.Trim() == "")
                {
                    theErrorMsg.Append("Category cannot be blank.").AppendLine();
                }
                if (Convert.ToInt32(cmbCategory.SelectedValue) < 1 && txtNewCategory.Visible == false)
                {
                    theErrorMsg.Append("Select the Category first.").AppendLine();
                }
                if (txtReportName.Text.Trim() == "")
                {
                    theErrorMsg.Append("Report Name cannot be Blank.").AppendLine();
                }
                if (txtQBQuery.Text.Trim() == "")
                {
                    MessageBox.Show("Query cannot be blank");
                }

                if (theErrorMsg.Length > 0)
                {
                    MessageBox.Show("Following are mandatory:" + theErrorMsg.ToString(), "IQCare Management", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (Validation() == false)
                {
                    return;
                }

                string CategoryName = "";
                if (Convert.ToInt32(cmbCategory.SelectedValue) > 0)
                {
                    CategoryName = cmbCategory.Text;
                }
                else
                {
                    CategoryName = txtNewCategory.Text;
                }


                if (CategoryId == 0)
                {
                    CategoryId = cmbCategory.SelectedIndex;
                }

                IQueryBuilder theQBuilder = (IQueryBuilder)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BQueryBuilder, BusinessProcess.FormBuilder");
                DataTable     theDT       = theQBuilder.SaveCustomReport(ReportId, CategoryId, CategoryName, txtReportName.Text, txtQBQuery.Text.Trim(), GblIQCare.AppUserId);
                ReportId          = Convert.ToInt32(theDT.Rows[0][0]);
                CategoryId        = Convert.ToInt32(theDT.Rows[0][1]);
                RepName           = theDT.Rows[0][2].ToString();
                QBControl.Enabled = true;
                pnlSave.Visible   = false;
            }
            catch (Exception err)
            {
                MsgBuilder Builder = new MsgBuilder();
                Builder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", Builder, this);
                return;
            }
        }
コード例 #2
0
        private void CreateGrid()
        {
            try
            {
                //IMasterList objPODetails = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                IPurchase objPODetails   = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
                DataTable theDTPODetails = objPODetails.GetPurchaseOrderDetailsForGRN(GblIQCare.AppUserId, GblIQCare.intStoreId, GblIQCare.AppLocationId);

                dgwGRN.Columns.Clear();
                dgwGRN.AutoGenerateColumns = false;
                dgwGRN.AllowUserToAddRows  = false;


                DataGridViewTextBoxColumn theColumnPoId = new DataGridViewTextBoxColumn();
                //  theColumnItemCode.HeaderText = "Item Code";
                theColumnPoId.Name             = "POId";
                theColumnPoId.DataPropertyName = "POId";

                DataGridViewTextBoxColumn theColumnGRNId = new DataGridViewTextBoxColumn();
                theColumnGRNId.Name             = "GRNId";
                theColumnGRNId.DataPropertyName = "GRNId";
                theColumnGRNId.Visible          = false;

                DataGridViewTextBoxColumn theColumnStatus = new DataGridViewTextBoxColumn();
                theColumnStatus.Name             = "Status";
                theColumnStatus.DataPropertyName = "Status";
                theColumnStatus.Width            = 143;


                DataGridViewTextBoxColumn theColumnOrderNumber = new DataGridViewTextBoxColumn();
                theColumnOrderNumber.HeaderText       = "Order Number";
                theColumnOrderNumber.Name             = "OrderNo";
                theColumnOrderNumber.DataPropertyName = "OrderNo";
                theColumnOrderNumber.Width            = 130;
                theColumnOrderNumber.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnPODate = new DataGridViewTextBoxColumn();
                theColumnPODate.HeaderText       = "Order Date";
                theColumnPODate.DataPropertyName = "OrderDate";
                theColumnPODate.Name             = "OrderDate";
                theColumnPODate.Width            = 140;
                theColumnPODate.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnSupplier = new DataGridViewTextBoxColumn();
                theColumnSupplier.HeaderText       = "Supplier";
                theColumnSupplier.DataPropertyName = "SupplierName";
                theColumnSupplier.Name             = "SupplierName";
                theColumnSupplier.Width            = 175;
                theColumnSupplier.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnSourceStore = new DataGridViewTextBoxColumn();
                theColumnSourceStore.HeaderText       = "Source Store";
                theColumnSourceStore.DataPropertyName = "SourceName";
                theColumnSourceStore.Name             = "SourceName";
                theColumnSourceStore.Width            = 180;
                theColumnSourceStore.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnDestStore = new DataGridViewTextBoxColumn();
                theColumnDestStore.HeaderText       = "Destination Store";
                theColumnDestStore.DataPropertyName = "DestStore";
                theColumnDestStore.Name             = "DestStore";
                theColumnDestStore.Width            = 180;
                theColumnDestStore.ReadOnly         = true;

                dgwGRN.DataSource = theDTPODetails;

                dgwGRN.Columns.Add(theColumnPoId);
                dgwGRN.Columns.Add(theColumnGRNId);
                dgwGRN.Columns.Add(theColumnOrderNumber);
                dgwGRN.Columns.Add(theColumnPODate);
                dgwGRN.Columns.Add(theColumnSupplier);
                dgwGRN.Columns.Add(theColumnSourceStore);
                dgwGRN.Columns.Add(theColumnDestStore);
                dgwGRN.Columns.Add(theColumnStatus);
                theColumnPoId.Visible = false;
                if (GblIQCare.ModePurchaseOrder == 2)
                {
                    theColumnSupplier.Visible    = false;
                    theColumnSourceStore.Visible = true;
                }
                else
                {
                    theColumnSupplier.Visible    = true;
                    theColumnSourceStore.Visible = false;
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #3
0
        private Boolean Validation_Form()
        {
            try
            {
                if (txtStoreID.Text == "")
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "Store ID";
                    IQCareWindowMsgBox.ShowWindow("BlankTextBox", theBuilder, this);
                    txtStoreID.Focus();
                    return(false);
                }

                if (txtStoreName.Text == "")
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "Store Name";
                    IQCareWindowMsgBox.ShowWindow("BlankTextBox", theBuilder, this);
                    txtStoreID.Focus();
                    return(false);
                }
                DataTable theDT = (DataTable)dgwStoreName.DataSource;
                DataView  theDV = new DataView(theDT);
                theDV.RowFilter = "Srno='" + PId + "'";
                if (theDV.Count == 0)
                {
                    foreach (DataRow theDR in theDT.Rows)
                    {
                        if (txtStoreID.Text.ToUpper() == Convert.ToString(theDR["StoreId"]).ToUpper())
                        {
                            IQCareWindowMsgBox.ShowWindow("StoreIdduplicate", this);
                            txtStoreID.Focus();
                            return(false);
                        }

                        else if (txtStoreName.Text.ToUpper() == Convert.ToString(theDR["Name"]).ToUpper())
                        {
                            IQCareWindowMsgBox.ShowWindow("StoreNameduplicate", this);
                            txtStoreName.Focus();
                            return(false);
                        }
                    }
                }

                //if ((ddlPurchasingStore.SelectedIndex != 0) && (cmbDispensing.SelectedIndex != 0))
                //{
                if ((ddlPurchasingStore.SelectedItem == "Yes") && (cmbDispensing.SelectedItem == "Yes"))
                {
                    IQCareWindowMsgBox.ShowWindow("PurchasingDispensingSameStore", this);
                    return(false);
                }
                //}
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
            return(true);
        }
コード例 #4
0
        /// <summary>
        /// This function is used to delete the selected form if no data is available for that form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (strFormNameDb == null)
                {
                    IQCareWindowMsgBox.ShowWindow("PMTCTSelectAtleastOne", this);
                    return;
                }
                else
                {
                    for (int i = 0; i < objDsFormDetails.Tables[0].Rows.Count; i++)
                    {
                        if (strFormNameDb == objDsFormDetails.Tables[0].Rows[i]["FormName"].ToString())
                        {
                            if (objDsFormDetails.Tables[0].Rows[i]["Published"].ToString() == "2")
                            {
                                IQCareWindowMsgBox.ShowWindow("PMTCTPublishedForm", this);
                                return;
                            }
                            else
                            {
                                IManageForms objFormDetail;
                                objFormDetail    = (IManageForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BManageForms,BusinessProcess.FormBuilder");
                                objDsFormDetails = objFormDetail.CheckFormDetail(strFormName, GblIQCare.iFormBuilderId);

                                if (objDsFormDetails.Tables[0].Rows.Count > 0)
                                {
                                    if (objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == "0" || objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == null || objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == "")
                                    {
                                        DialogResult strResult;
                                        //strResult = MessageBox.Show("Do you want to delete this record", "Yes/No", MessageBoxButtons.YesNo);
                                        strResult = IQCareWindowMsgBox.ShowWindowConfirm("PMTCTConfirmDelete", this);

                                        if (strResult.ToString() == "Yes")
                                        {
                                            objFormDetail.DeleteFormTableDetail(strFormName, GblIQCare.iFormBuilderId);
                                            dgwFormDetails.DataSource = null;
                                            BindGrid();
                                            MessageBox.Show("Form " + strFormNameDb + " deleted sucessfully", "Confirm", MessageBoxButtons.OK);
                                            strFormNameDb = null;
                                        }
                                        else
                                        {
                                            dgwFormDetails.DataSource = null;
                                            BindGrid();
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        IQCareWindowMsgBox.ShowWindow("PMTCTNotDeleted", this);
                                        dgwFormDetails.DataSource = null;
                                        BindGrid();
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
        //private void btnImport_Click(object sender, EventArgs e)
        //{
        //    try
        //    {

        //        int iRes = 0;
        //        bool isUpdate = false, isVersionUpdate = false;
        //        if (txtFileName.Text.ToString() != "")
        //        {
        //            DataSet dsCollectDataToSave = new DataSet();
        //            dsCollectDataToSave.ReadXml(txtFileName.Text.ToString());
        //            IImportExportForms objImportFormDetails;
        //            objImportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder");
        //            if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms")
        //            {
        //                string strVerName = "";
        //                if (dsCollectDataToSave.Tables.Count < 11)
        //                {
        //                    IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
        //                    return;

        //                }
        //                else if (dsCollectDataToSave.Tables.Count > 10)
        //                {
        //                    strVerName = dsCollectDataToSave.Tables[10].Rows[0]["AppVer"].ToString();
        //                    if (GblIQCare.AppVersion.ToString() != strVerName)
        //                    {
        //                        IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
        //                        return;
        //                    }

        //                }
        //                for (int i = 0; i < dsCollectDataToSave.Tables[0].Rows.Count; i++)
        //                {
        //                    DataSet DSExitingForm = objImportFormDetails.GetImportExportFormDetail(dsCollectDataToSave.Tables[0].Rows[i]["FeatureName"].ToString());

        //                    if (DSExitingForm.Tables[0].Rows.Count > 0)
        //                    {
        //                        if (!CheckFormVersion(dsCollectDataToSave, DSExitingForm))
        //                        {
        //                            //mark true if same form found with no changes
        //                            isUpdate = true;
        //                            int result = DateTime.Compare(Convert.ToDateTime(DSExitingForm.Tables[15].Rows[0]["VersionDate"]), Convert.ToDateTime(dsCollectDataToSave.Tables[15].Rows[0]["VersionDate"]));
        //                            if ((Convert.ToDecimal(dsCollectDataToSave.Tables[15].Rows[0]["VersionName"]) <= Convert.ToDecimal(DSExitingForm.Tables[15].Rows[0]["VersionName"])) && (result < 0))
        //                            {
        //                                //mark isVersionUpdate = true form with changes found to update version info
        //                                isVersionUpdate = true;
        //                                isUpdate = false;
        //                                DialogResult msgconfirm = IQCareWindowMsgBox.ShowWindow(string.Format("There are field changes on the form.{0} The electronic form version will update upon saving.", Environment.NewLine), "*", "", this);
        //                                if (msgconfirm == DialogResult.OK)
        //                                    iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
        //                                else
        //                                    return;
        //                            }
        //                            else
        //                            {
        //                                if (isUpdate)
        //                                    iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
        //                            }
        //                        }
        //                    }
        //                    else
        //                        iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
        //                }

        //            }
        //            else
        //                iRes = objImportFormDetails.ImportHomeForms(dsCollectDataToSave, GblIQCare.AppUserId, System.Convert.ToInt32(GblIQCare.AppCountryId));

        //            if (iRes == 1)
        //            {
        //                IQCareWindowMsgBox.ShowWindow("ImportSuccess", this);
        //                txtFileName.Text = "";
        //            }
        //        }
        //        else
        //        {
        //            IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
        //            txtFileName.Focus();
        //        }
        //    }
        //    catch (Exception err)
        //    {
        //        MsgBuilder theBuilder = new MsgBuilder();
        //        theBuilder.DataElements["MessageText"] = err.Message.ToString();
        //        IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
        //    }
        //}
        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                int  iRes = 0;
                bool isUpdate = false, isVersionUpdate = false;
                if (txtFileName.Text.ToString() != "")
                {
                    DataSet dsCollectDataToSave = new DataSet();
                    foreach (DataTable dataTable in dsCollectDataToSave.Tables)
                    {
                        dataTable.BeginLoadData();
                    }

                    dsCollectDataToSave.ReadXml(txtFileName.Text.ToString());

                    foreach (DataTable dataTable in dsCollectDataToSave.Tables)
                    {
                        dataTable.EndLoadData();
                    }

                    //dsCollectDataToSave.ReadXml(txtFileName.Text.ToString());
                    IImportExportForms objImportFormDetails;
                    objImportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder");
                    if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms")
                    {
                        string strVerName = "";
                        if (dsCollectDataToSave.Tables.Count < 11)
                        {
                            IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
                            return;
                        }
                        else if (dsCollectDataToSave.Tables.Count > 10)
                        {
                            strVerName = dsCollectDataToSave.Tables[10].Rows[0]["AppVer"].ToString();
                            if (GblIQCare.AppVersion.ToString() != strVerName)
                            {
                                IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
                                return;
                            }
                        }
                        for (int i = 0; i < dsCollectDataToSave.Tables[0].Rows.Count; i++)
                        {
                            if (dsCollectDataToSave.Tables[0].Rows[i]["FeatureId"].ToString() == "126")
                            {
                                iRes = ImportExportDBUpdates(dsCollectDataToSave, false, false, objImportFormDetails);
                            }
                            else
                            {
                                DataSet DSExitingForm = objImportFormDetails.GetImportExportFormDetail(dsCollectDataToSave.Tables[0].Rows[i]["FeatureName"].ToString());

                                if (DSExitingForm.Tables[0].Rows.Count > 0)
                                {
                                    if (!CheckFormVersion(dsCollectDataToSave, DSExitingForm))
                                    {
                                        //mark true if same form found with no changes
                                        isUpdate = true;
                                        int result = DateTime.Compare(Convert.ToDateTime(DSExitingForm.Tables[15].Rows[0]["VersionDate"]), Convert.ToDateTime(dsCollectDataToSave.Tables[15].Rows[0]["VersionDate"]));
                                        if ((Convert.ToDecimal(dsCollectDataToSave.Tables[15].Rows[0]["VersionName"]) <= Convert.ToDecimal(DSExitingForm.Tables[15].Rows[0]["VersionName"])) && (result < 0))
                                        {
                                            //mark isVersionUpdate = true form with changes found to update version info
                                            isVersionUpdate = true;
                                            isUpdate        = false;
                                            DialogResult msgconfirm = IQCareWindowMsgBox.ShowWindow(string.Format("There are field changes on the form.{0} The electronic form version will update upon saving.", Environment.NewLine), "*", "", this);
                                            if (msgconfirm == DialogResult.OK)
                                            {
                                                iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
                                            }
                                            else
                                            {
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            if (isUpdate)
                                            {
                                                iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails);
                                }
                            }
                        }
                    }
                    else
                    {
                        iRes = objImportFormDetails.ImportHomeForms(dsCollectDataToSave, GblIQCare.AppUserId, System.Convert.ToInt32(GblIQCare.AppCountryId));
                    }

                    if (iRes == 1)
                    {
                        IQCareWindowMsgBox.ShowWindow("ImportSuccess", this);
                        txtFileName.Text = "";
                    }
                }
                else
                {
                    IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
                    txtFileName.Focus();
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }
コード例 #7
0
        public void SaveUpdateModule()
        {
            string Anthem = "Star Spangled Banner";

            Anthem = Anthem.Replace(" ", "");

            Hashtable theHT = new Hashtable();

            theHT.Clear();
            IModule objIdentifier;

            strModuleName = "";
            strModuleName = txtModuleName.Text;

            Int32 pharmacyFlag = 0;

            if (chkHivCareTrmt.Checked)
            {
                pharmacyFlag = 1;
            }

            //if (GblIQCare.ModuleName != "SMART ART FORM")
            //{
            //    strModuleName = txtModuleName.Text.Replace(" ", "");
            //}
            //else
            //{
            //    strModuleName = txtModuleName.Text;

            //}

            //By Akhil - To prevent duplicate service name from Form - 3rd April 2014
            IModule objModuleDetail;

            objModuleDetail = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule,BusinessProcess.FormBuilder");
            DataSet objDsModuleDetails = objModuleDetail.GetModuleDetail();
            string  s = txtModuleName.Text.Trim();

            if (objDsModuleDetails.Tables != null && objDsModuleDetails.Tables[0].Rows.Count > 0)
            {
                DataRow[] dr = objDsModuleDetails.Tables[0].Select("ModuleName = '" + s + "'");
                if (dr.Length > 0)
                {
                    IQCareWindowMsgBox.ShowWindow("ModuleExist", this);
                    return;
                }
            }

            if ((GblIQCare.ModuleId == 0) && (intOldModuleId != 0) && (strOldModuleName == strModuleName))
            {
                theHT.Add("ModuleId", intOldModuleId);
            }
            else
            {
                strOldModuleName = strModuleName;
                theHT.Add("ModuleId", GblIQCare.ModuleId);
            }

            theHT.Add("ModuleName", strModuleName);
            theHT.Add("Status", 1);
            theHT.Add("DeleteFlag", 0);
            theHT.Add("UserID", GblIQCare.AppUserId);

            theHT.Add("PharmacyFlag", pharmacyFlag);

            objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder");
            Int32 intExistModuleId = objIdentifier.SaveUpdateModuleDetail(theHT, dtSubmit, GblIQCare.dtServiceBusinessValues);

            intOldModuleId = intExistModuleId;
            if (intExistModuleId == 0)
            {
                IQCareWindowMsgBox.ShowWindow("ModuleExist", this);
                return;
            }
            else
            {
                Form theForm;
                theForm           = (Form)Activator.CreateInstance(Type.GetType("IQCare.FormBuilder.frmModule, IQCare.FormBuilder"));
                theForm.MdiParent = this.MdiParent;
                theForm.Left      = 0;
                theForm.Top       = 0;
                theForm.Focus();
                theForm.Show();
                this.Close();
            }
        }
コード例 #8
0
        /// <summary>
        /// Saves the update module.
        /// </summary>
        public void SaveUpdateModule()
        {
            string Anthem = "Star Spangled Banner";

            Anthem = Anthem.Replace(" ", "");

            Hashtable theHT = new Hashtable();

            theHT.Clear();
            IModule objIdentifier;

            strModuleName = "";
            strModuleName = txtModuleName.Text;

            string strDisplayName = textDisplayName.Text;
            bool   canEnrol       = chkEnroll.Checked;
            Int32  pharmacyFlag   = 0;

            //if (chkHivCareTrmt.Checked)
            //{
            pharmacyFlag = GblIQCare.PharmacyFlag;
            //}

            //if (GblIQCare.ModuleName != "SMART ART FORM")
            //{
            //    strModuleName = txtModuleName.Text.Replace(" ", "");
            //}
            //else
            //{
            //    strModuleName = txtModuleName.Text;

            //}
            if ((GblIQCare.ModuleId == 0) && (intOldModuleId != 0) && (strOldModuleName == strModuleName))
            {
                theHT.Add("ModuleId", intOldModuleId);
            }
            else
            {
                strOldModuleName = strModuleName;
                theHT.Add("ModuleId", GblIQCare.ModuleId);
            }

            theHT.Add("ModuleName", strModuleName);
            theHT.Add("DisplayName", strDisplayName);
            theHT.Add("CanEnroll", canEnrol);
            theHT.Add("Status", 1);
            theHT.Add("DeleteFlag", 0);
            theHT.Add("UserID", GblIQCare.AppUserId);

            theHT.Add("PharmacyFlag", pharmacyFlag);

            objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder");
            Int32 intExistModuleId = objIdentifier.SaveUpdateModuleDetail(theHT, dtSubmit, GblIQCare.dtServiceBusinessValues);

            intOldModuleId = intExistModuleId;
            if (intExistModuleId == 0)
            {
                IQCareWindowMsgBox.ShowWindow("ModuleExist", this);
                return;
            }
            else
            {
                Form theForm;
                theForm           = (Form)Activator.CreateInstance(Type.GetType("IQCare.FormBuilder.frmModule, IQCare.FormBuilder"));
                theForm.MdiParent = this.MdiParent;
                theForm.Left      = 0;
                theForm.Top       = 0;
                theForm.Focus();
                theForm.Show();
                this.Close();
            }
        }
コード例 #9
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Validation_Form() == true)
            {
                try
                {
                    theDTStock = (DataTable)dgwOpeningStock.DataSource;

                    DataTable dtb = theDTStock.Copy();

                    DataTable dtCheck = (DataTable)dgwOpeningStock.DataSource;
                    DataView  dt11    = dtCheck.DefaultView;

                    theDTStock.PrimaryKey = new DataColumn[] { theDTStock.Columns["ItemId"], theDTStock.Columns["BatchId"], theDTStock.Columns["StoreId"], theDTStock.Columns["ExpiryDate"] };
                    DataView  theDV = new DataView(theDTStock);
                    DataTable dtNew = null;
                    theDV.RowFilter = "ItemId=" + theItemIdGbl + " and BatchId=" + BatchId + " and StoreId=" + StoreId + " and ExpiryDate='" + ExpiryDate + "'";
                    if (theDV.Count > 0)
                    {
                        theDV.Delete(0);

                        dtNew = dt11.ToTable();

                        if (dtNew.Rows.Count > 0)
                        {
                            for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++)
                            {
                                if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString())
                                {
                                    ShowGrid(dtb);
                                    IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this);
                                    return;
                                }
                            }
                        }
                        DataRow theDRow = theDTStock.NewRow();
                        if (lstSearchBatch.SelectedValue == null)
                        {
                            BindFunctions theBindManager = new BindFunctions();
                            IMasterList   objItemlist    = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                            DataSet       theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text);
                            theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]);
                            theDTBatch.Clear();
                            theDTBatch = theDSBatchName.Tables[1];
                            theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id");
                        }
                        else
                        {
                            theDRow["BatchId"] = lstSearchBatch.SelectedValue;
                        }
                        theDRow["ItemId"]         = lstSearch.SelectedValue;
                        theDRow["ItemName"]       = txtItemName.Text;
                        theDRow["StoreId"]        = ddlStore.SelectedValue;
                        theDRow["StoreName"]      = ddlStore.Text;
                        theDRow["DispensingUnit"] = txtDispensingUnit.Text;
                        theDRow["BatchNo"]        = txtBatchName.Text;
                        theDRow["ExpiryDate"]     = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDRow["Quantity"]       = txtOpeningQty.Text;
                        theDRow["OpeningStock"]   = 0;
                        //theDRow["TransDate"] = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDTStock.Rows.Add(theDRow);
                    }
                    else
                    {
                        dtNew = dt11.ToTable();
                        if (dtNew.Rows.Count > 0)
                        {
                            for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++)
                            {
                                if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString())
                                {
                                    ShowGrid(theDTStock);
                                    IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this);
                                    return;
                                }
                            }
                        }

                        DataRow theDRow = theDTStock.NewRow();
                        if (lstSearchBatch.SelectedValue == null)
                        {
                            BindFunctions theBindManager = new BindFunctions();
                            IMasterList   objItemlist    = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                            //DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId);

                            DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text);


                            theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]);
                            theDTBatch.Clear();
                            theDTBatch = theDSBatchName.Tables[1];
                            theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id");
                        }
                        else
                        {
                            theDRow["BatchId"] = lstSearchBatch.SelectedValue;
                        }

                        theDRow["ItemId"]         = lstSearch.SelectedValue;
                        theDRow["ItemName"]       = txtItemName.Text;
                        theDRow["StoreId"]        = ddlStore.SelectedValue;
                        theDRow["StoreName"]      = ddlStore.Text;
                        theDRow["DispensingUnit"] = txtDispensingUnit.Text;
                        theDRow["BatchNo"]        = txtBatchName.Text;
                        theDRow["ExpiryDate"]     = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text);
                        theDRow["Quantity"]       = txtOpeningQty.Text;
                        theDRow["OpeningStock"]   = 0;
                        //theDRow["TransacDate"] = string.Format("{0:dd-MMM-yyyy}", dtpTransdate.Text);
                        theDTStock.Rows.Add(theDRow);
                    }
                    theDTStock.AcceptChanges();
                    ShowGrid(theDTStock);
                    Clear();
                }
                catch (Exception err)
                {
                    if (err.GetType().FullName == "System.Data.ConstraintException")
                    {
                        IQCareWindowMsgBox.ShowWindow("DuplicateItemName", this);
                    }
                }
            }
        }
コード例 #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (ddlStoreName.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Store Name";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlStoreName.Focus();
                return;
            }

            GblIQCare.intStoreId = Convert.ToInt32(ddlStoreName.SelectedValue);
            if ((GblIQCare.theArea == "PO") || (GblIQCare.theArea == "CR"))
            {
                DataTable theDT = (DataTable)ddlStoreName.DataSource;
                DataView  theDV = new DataView(theDT);

                theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and CentralStore=1";
                if (theDV.Count < 1)
                {
                    //IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this);
                    //return;
                    GblIQCare.ModePurchaseOrder = 2;
                }
                else
                {
                    GblIQCare.ModePurchaseOrder = 1;
                }
                Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmViewPurchaseOrder, IQCare.SCM"));
                theForm.Top       = 2;
                theForm.Left      = 2;
                theForm.MdiParent = this.MdiParent;
                theForm.Show();
                this.Close();
            }
            if (GblIQCare.theArea == "Dispense")
            {
                DataTable theDT = (DataTable)ddlStoreName.DataSource;
                DataView  theDV = new DataView(theDT);
                theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and DispensingStore=1";
                if (theDV.Count < 1)
                {
                    IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this);
                    return;
                }
                Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmPatientDrugDispense, IQCare.SCM"));
                theForm.Top       = 2;
                theForm.Left      = 2;
                theForm.MdiParent = this.MdiParent;
                theForm.Show();
                this.Close();
            }
            if ((GblIQCare.theArea == "GRN") || (GblIQCare.theArea == "IV"))
            {
                DataTable theDT = (DataTable)ddlStoreName.DataSource;
                DataView  theDV = new DataView(theDT);

                theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and CentralStore=1";
                if (theDV.Count < 1)
                {
                    //IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this);
                    //return;
                    GblIQCare.ModePurchaseOrder = 2;
                }
                else
                {
                    GblIQCare.ModePurchaseOrder = 1;
                }
                Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmViewGoodReceiveNote, IQCare.SCM"));
                theForm.Top       = 2;
                theForm.Left      = 2;
                theForm.MdiParent = this.MdiParent;
                theForm.Show();
                this.Close();
            }
        }
コード例 #11
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                StringBuilder theErrorMsg = new StringBuilder();
                if (txtNewCategory.Visible == true && txtNewCategory.Text.Trim() == "")
                {
                    theErrorMsg.Append("Category cannot be blank.").AppendLine();
                }
                if (Convert.ToInt32(cmbCategory.SelectedValue) < 1 && txtNewCategory.Visible == false)
                {
                    theErrorMsg.Append("Select the Category first.").AppendLine();
                }
                if (txtReportName.Text.Trim() == "")
                {
                    theErrorMsg.Append("Report Name cannot be Blank.").AppendLine();
                }
                if (txtQBQuery.Text.Trim() == "")
                {
                    MessageBox.Show("Query cannot be blank");
                }

                if (theErrorMsg.Length > 0)
                {
                    MessageBox.Show("Following are mandatory:" + theErrorMsg.ToString(), "IQCare Management", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (Validation() == false)
                {
                    return;
                }

                string CategoryName = "";
                if (Convert.ToInt32(cmbCategory.SelectedValue) > 0)
                {
                    CategoryName = cmbCategory.Text;
                }
                else
                {
                    CategoryName = txtNewCategory.Text;
                }


                if (CategoryId == 0)
                {
                    CategoryId = cmbCategory.SelectedIndex;
                }

                QBControl.SQL = txtQBQuery.Text.Trim();
                ActiveDatabaseSoftware.ActiveQueryBuilder.ParameterList pl = QBControl.Parameters;
                XElement xmlDoc = null;
                if (pl != null)
                {
                    var x = (from p in pl
                             select p);
                    xmlDoc = new XElement("parameters",
                                          from p in pl
                                          select new XElement("parameter",
                                                              new XElement("name", p.FullName),
                                                              new XElement("datatype", p.DataType.ToString()),
                                                              new XElement("datatype2", p.DataType.GetType().ToString()),
                                                              new XElement("comparedfield", p.ComparedField),
                                                              new XElement("symbol", p.Symbol),
                                                              new XElement("basetype", this.GetSqlDBTypeFromstring(p.MetadataField.FieldTypeName))));
                }
                if (xmlDoc == null)
                {
                    IQueryBuilder theQBuilder = (IQueryBuilder)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BQueryBuilder, BusinessProcess.FormBuilder");
                    DataTable     theDT       = theQBuilder.SaveCustomReport(ReportId, CategoryId, CategoryName, txtReportName.Text, txtQBQuery.Text.Trim(), GblIQCare.AppUserId);
                    ReportId          = Convert.ToInt32(theDT.Rows[0][0]);
                    CategoryId        = Convert.ToInt32(theDT.Rows[0][1]);
                    RepName           = theDT.Rows[0][2].ToString();
                    QBControl.Enabled = true;
                    pnlSave.Visible   = false;
                }
                else
                {
                    IQueryBuilder theQBuilder = (IQueryBuilder)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BQueryBuilder, BusinessProcess.FormBuilder");
                    DataTable     theDT       = theQBuilder.SaveCustomReport(ReportId, CategoryId, CategoryName, txtReportName.Text, txtQBQuery.Text.Trim(), GblIQCare.AppUserId, xmlDoc.ToString());
                    ReportId          = Convert.ToInt32(theDT.Rows[0][0]);
                    CategoryId        = Convert.ToInt32(theDT.Rows[0][1]);
                    RepName           = theDT.Rows[0][2].ToString();
                    QBControl.Enabled = true;
                    pnlSave.Visible   = false;
                }
            }
            catch (Exception err)
            {
                MsgBuilder Builder = new MsgBuilder();
                Builder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", Builder, this);
                return;
            }
        }
コード例 #12
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (GblIQCare.blnOtherICD10)
            {
                foreach (TreeNode child in TVICD10.Nodes)
                {
                    if (child.Checked)
                    {
                        int    Id   = Convert.ToInt32(child.Tag);
                        string Name = Convert.ToString(child.Text).Replace("'", "''");
                        Name = Name.Replace("''", "'");
                        if (theDTICD10.Rows.Count > 0)
                        {
                            DataRow[] row = theDTICD10.Select("ICD10Name='" + Name + "' and Deleteflag=0");
                            if (row.Length > 0)
                            {
                                IQCareWindowMsgBox.ShowWindow("DuplicateICD10", this);
                                return;
                            }
                        }
                        theDTICD10.Rows.Add(0, 0, 0, Name, 0, Id);
                        theDTICD10.AcceptChanges();
                        DataView dv = new DataView(theDTICD10);
                        dv.RowFilter          = "Deleteflag=0";
                        lbICD10.DataSource    = dv;
                        lbICD10.DisplayMember = "ICD10Name";
                    }
                }
            }
            if (GblIQCare.blnICD10multiselect)
            {
                if (TVICD10.SelectedNode != null)
                {
                    int    Id   = Convert.ToInt32(TVICD10.SelectedNode.Tag);
                    string Name = Convert.ToString(TVICD10.SelectedNode.Text).Replace("'", "''");

                    if (theDTICD10.Rows.Count > 0)
                    {
                        DataRow[] row = theDTICD10.Select("ICD10Name='" + Name + "' and Deleteflag=0");
                        if (row.Length > 0)
                        {
                            IQCareWindowMsgBox.ShowWindow("DuplicateICD10", this);
                            return;
                        }
                    }

                    int number = TVICD10.SelectedNode.Level;
                    Name = Name.Replace("''", "'");
                    switch (number)
                    {
                    case 1:
                        theDTICD10.Rows.Add(Id, 0, 0, Name, 0, 0);
                        theDTICD10.AcceptChanges();
                        break;

                    case 2:
                        theDTICD10.Rows.Add(0, Id, 0, Name, 0, 0);
                        theDTICD10.AcceptChanges();
                        break;

                    case 3:
                        theDTICD10.Rows.Add(0, 0, Id, Name, 0, 0);
                        theDTICD10.AcceptChanges();
                        break;

                    case 0:
                        if (GblIQCare.blnOtherICD10)
                        {
                            theDTICD10.Rows.Add(0, 0, 0, Name, 0, Id);
                            theDTICD10.AcceptChanges();
                        }
                        break;
                    }

                    DataView dv = new DataView(theDTICD10);
                    dv.RowFilter          = "Deleteflag=0";
                    lbICD10.DataSource    = dv;
                    lbICD10.DisplayMember = "ICD10Name";
                }
            }
        }
コード例 #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Validation() == false)
                {
                    return;
                }
                DataTable dtFeature;
                dtFeature = clsCommon.CreateTableMstFeature();
                DataRow theDRFeature;
                int     iFormId;
                theDRFeature = dtFeature.NewRow();

                string FName = cmbHomePageType.Text.Trim() + "-" + cmbTechnicalArea.Text.Trim();

                if (GblIQCare.iHomePageId != 0)
                {
                    iFormId = GblIQCare.iHomePageId;
                    Flag    = PMTCTConstants.strUpdate;
                }
                else
                {
                    iFormId = 0;
                    Flag    = PMTCTConstants.strInsert;
                }
                if (dgwQueryDetails.Rows.Count <= 1)
                {
                    IQCareWindowMsgBox.ShowWindow("IndicatorMandatory", this);
                    return;
                }
                theDRFeature["FeatureId"]   = iFormId;
                theDRFeature["FeatureName"] = cmbHomePageType.Text + "-" + cmbTechnicalArea.Text;
                theDRFeature["UserId"]      = GblIQCare.AppUserId;
                theDRFeature["ModuleId"]    = cmbTechnicalArea.SelectedValue;
                dtFeature.Rows.Add(theDRFeature);

                DataTable  dtMstHomePage = new DataTable();
                DataColumn theDT;

                theDT            = new DataColumn();
                theDT.DataType   = Type.GetType("System.Int32");
                theDT.ColumnName = "Id";
                dtMstHomePage.Columns.Add(theDT);

                theDT            = new DataColumn();
                theDT.DataType   = Type.GetType("System.String");
                theDT.ColumnName = "Name";
                dtMstHomePage.Columns.Add(theDT);

                theDT            = new DataColumn();
                theDT.DataType   = Type.GetType("System.Int32");
                theDT.ColumnName = "FeatureId";
                dtMstHomePage.Columns.Add(theDT);

                theDT            = new DataColumn();
                theDT.DataType   = Type.GetType("System.Int32");
                theDT.ColumnName = "UserId";
                dtMstHomePage.Columns.Add(theDT);

                DataRow theDRHomePage;

                theDRHomePage = dtMstHomePage.NewRow();
                if (GblIQCare.iHomePageId != 0)
                {
                    theDRHomePage["Id"] = ID;
                }

                theDRHomePage["Name"]      = txtSectionTitle.Text;
                theDRHomePage["FeatureId"] = iFormId;
                theDRHomePage["UserId"]    = GblIQCare.AppUserId;

                dtMstHomePage.Rows.Add(theDRHomePage);
                DataTable dtlHomePage;

                dtlHomePage = (DataTable)dgwQueryDetails.DataSource;

                DataTable dtDtHomePage;

                dtDtHomePage = dtlHomePage.Copy();
                DataSet dsSaveIndicatorQuery = new DataSet();
                dsSaveIndicatorQuery.Tables.Add(dtDtHomePage);
                dsSaveIndicatorQuery.Tables.Add(dtFeature);
                dsSaveIndicatorQuery.Tables.Add(dtMstHomePage);
                foreach (DataRow theDR in dtDtHomePage.Rows)
                {
                    if (theDR["Indicator"].ToString() == "")
                    {
                        IQCareWindowMsgBox.ShowWindow("BlankIndicator", this);
                        return;
                    }
                }

                IHomePageConfiguration objTechArea = (IHomePageConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BHomePageConfiguration,BusinessProcess.FormBuilder");
                int iSave = (int)objTechArea.SaveHomePageIndicator(dsSaveIndicatorQuery, Flag);
                btnCancel_Click(sender, e);
            }

            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #14
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (txtfile.Text != "")
            {
                lblmessage.Text = "";
                string strExportList = "C:\\SCMExportFile\\ExportMaster.xml";


                string myXMLfile = txtfile.Text;

                string strext = Path.GetExtension(myXMLfile);
                if (strext != ".xml")
                {
                    IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
                    return;
                }
                if (myXMLfile.ToUpper() != "C:\\SCMEXPORT\\SCMMASTER.XML")
                {
                    IQCareWindowMsgBox.ShowWindow("Browswrongfile", this);
                    return;
                }

                DataSet dsExportList            = new DataSet();
                System.IO.FileStream fsReadXml1 = new System.IO.FileStream(strExportList, System.IO.FileMode.Open);
                dsExportList.ReadXml(fsReadXml1);
                fsReadXml1.Close();

                DataSet ds = new DataSet();
                System.IO.FileStream fsReadXml = new System.IO.FileStream
                                                     (myXMLfile, System.IO.FileMode.Open);


                try
                {
                    ds.ReadXml(fsReadXml);

                    //if (ds.Tables[0].Rows[0]["AppVer"].ToString() != GblIQCare.AppVersion || ((DateTime)ds.Tables[0].Rows[0]["RelDate"]).ToString("dd-MMM-yyyy") != GblIQCare.ReleaseDate)
                    //{
                    //    IQCareWindowMsgBox.ShowWindow("ImportScmMasterCheckVersion", this);
                    //    return;

                    //}
                    IImportExport theExportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder");
                    if (ds.Tables.Count == 21)
                    {
                        theExportManager.DBBackUpImportData();
                        foreach (DataRow r in dsExportList.Tables[0].Rows)
                        {
                            if (r["Name"].ToString() == "PharmacyMaster")
                            {
                                theExportManager.BulkInsert(ds.Tables[1], "Mst_Drug");
                                theExportManager.BulkInsert(ds.Tables[2], "Mst_Generic");
                                theExportManager.BulkInsert(ds.Tables[3], "Lnk_DrugGeneric");
                                theExportManager.BulkInsert(ds.Tables[4], "Mst_DrugType");
                                theExportManager.BulkInsert(ds.Tables[5], "Lnk_DrugTypeGeneric");
                                theExportManager.BulkInsert(ds.Tables[21], "mst_strength");
                                theExportManager.BulkInsert(ds.Tables[22], "lnk_DrugStrength");
                            }
                            if (r["Name"].ToString() == "ItemConfiguration")
                            {
                                theExportManager.ImportSCM(ds.Tables[6], "ItemConfiguration");
                            }
                            if (r["Name"].ToString() == "Manufacturerdetail")
                            {
                                theExportManager.BulkInsert(ds.Tables[7], "mst_manufacturer");
                            }
                            if (r["Name"].ToString() == "Programitemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[8], "Programitemlinking");
                            }
                            if (r["Name"].ToString() == "Storeitemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[9], "Storeitemlinking");
                            }
                            if (r["Name"].ToString() == "Supplieritemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[10], "Supplieritemlinking");
                            }
                            if (r["Name"].ToString() == "Program")
                            {
                                theExportManager.BulkInsert(ds.Tables[11], "mst_program");
                            }
                            if (r["Name"].ToString() == "Donor")
                            {
                                theExportManager.BulkInsert(ds.Tables[12], "mst_donor");
                            }
                            if (r["Name"].ToString() == "Programdonorlinking")
                            {
                                theExportManager.BulkInsert(ds.Tables[13], "Lnk_DonorProgram");
                            }
                            if (r["Name"].ToString() == "Costallocationcategory")
                            {
                                theExportManager.ImportSCM(ds.Tables[14], "Costallocationcategory");
                            }
                            if (r["Name"].ToString() == "Storedetail")
                            {
                                theExportManager.BulkInsert(ds.Tables[15], "mst_store");
                            }
                            if (r["Name"].ToString() == "Storesourcedestinationlinking")
                            {
                                theExportManager.BulkInsert(ds.Tables[16], "lnk_StoreSourceDestination");
                            }
                            if (r["Name"].ToString() == "Supplier")
                            {
                                theExportManager.BulkInsert(ds.Tables[17], "mst_supplier");
                            }

                            if (r["Name"].ToString() == "Adjustmentreason")
                            {
                                theExportManager.ImportSCM(ds.Tables[18], "Adjustmentreason");
                            }
                            if (r["Name"].ToString() == "Returnreason")
                            {
                                theExportManager.ImportSCM(ds.Tables[19], "Returnreason");
                            }
                            if (r["Name"].ToString() == "Labtestlocation")
                            {
                                theExportManager.ImportSCM(ds.Tables[20], "Labtestlocation");
                            }

                            if (r["Name"].ToString() == "AddConstraint")
                            {
                                theExportManager.ImportSCM(ds.Tables[10], "AddConstraint");
                            }
                        }


                        IQCareWindowMsgBox.ShowWindow("ImportSuccess", this);
                    }
                    else
                    {
                        IQCareWindowMsgBox.ShowWindow("Browswrongfile", this);
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    fsReadXml.Close();
                }
            }
            else
            {
                IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
                return;
            }
        }
コード例 #15
0
        private void dgwItemSubitemDetails_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex > -1 && e.RowIndex > -1)
                {
                    DataGridView dgwDataGrid = sender as DataGridView;

                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "OrderQuantity" && dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value != null && dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value != null)
                    {
                        if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value) != "" && Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value) != "")
                        {
                            dgwDataGrid.Rows[e.RowIndex].Cells["TotPrice"].Value = Convert.ToDecimal(Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value.ToString()) * Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value.ToString()));
                        }
                    }
                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "Price" && dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value != null && dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value != null)
                    {
                        if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value) != "" && Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value) != "")
                        {
                            dgwDataGrid.Rows[e.RowIndex].Cells["TotPrice"].Value = Convert.ToDecimal(Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value.ToString()) * Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["Price"].Value.ToString()));
                        }
                    }
                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "TotPrice" && dgwDataGrid.Rows[e.RowIndex].Cells["TotPrice"].Value != null)
                    {
                        decimal sumPrice = 0;
                        foreach (DataGridViewRow theDR in dgwDataGrid.Rows)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(theDR.Cells["TotPrice"].Value)))
                            {
                                sumPrice = sumPrice + Convert.ToDecimal(theDR.Cells["TotPrice"].Value);
                            }
                        }
                        lblTotalAmount.Text = Convert.ToString(sumPrice);
                    }

                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "IssuedQuantity" && dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value != null)
                    {
                        if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value) != "" && Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value) != "")
                        {
                            if (Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["OrderQuantity"].Value.ToString()) < Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value.ToString()))
                            {
                                MessageBox.Show("Quantity issued is greater than Quantity Ordered.");
                                //dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value = 0;
                            }
                        }
                    }

                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "IssuedQuantity" && dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value != null)
                    {
                        if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["UnitQuantity"].Value) != "" && Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value) != "")
                        {
                            if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["UnitQuantity"].Value) == "" && Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["UnitQuantity"].Value) == "0")
                            {
                                MessageBox.Show("Kindly Configure this item. Unit quantity for purchase unit is missing");
                                dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantityDU"].Value = 0;
                            }
                            else
                            {
                                dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantityDU"].Value = Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["UnitQuantity"].Value.ToString()) * Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value.ToString());
                            }


                            //if (Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["UnitQuantity"].Value.ToString()) < Convert.ToDecimal(dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value.ToString()))
                            //{
                            //    MessageBox.Show("Quantity issued cannot be greater than Quantity Ordered");
                            //    dgwDataGrid.Rows[e.RowIndex].Cells["IssuedQuantity"].Value = 0;

                            //}
                        }
                    }

                    if (dgwDataGrid.Columns[e.ColumnIndex].Name == "ExpiryDate" && dgwDataGrid.Rows[e.RowIndex].Cells["ExpiryDate"].Value != null)
                    {
                        if (Convert.ToString(dgwDataGrid.Rows[e.RowIndex].Cells["ExpiryDate"].Value) != "")
                        {
                            if (Convert.ToDateTime(dgwDataGrid.Rows[e.RowIndex].Cells["ExpiryDate"].Value.ToString()) < DateTime.Now)
                            {
                                IQCareWindowMsgBox.ShowWindow("ExpiryDate", this);
                                //dgwDataGrid.Rows[e.RowIndex].Cells["ExpiryDate"].Value = "";
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #16
0
        private Boolean Validation_Form()
        {
            try
            {
                String AdjustmentDate = string.Format("{0:dd-MMM-yyyy}", dtpEffectiveDate.Text);
                if (Convert.ToInt32(ddlStoreName.SelectedValue) == 0)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "Store Name";
                    IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                    return(false);
                }

                else if (Convert.ToInt32(ddlPreparedBy.SelectedValue) == 0)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "Prepared By";
                    IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                    return(false);
                }
                else if (Convert.ToInt32(ddlAuthoriseBy.SelectedValue) == 0)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["Control"] = "Authorised By";
                    IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                    return(false);
                }
                else if (Convert.ToDateTime(AdjustmentDate) > Convert.ToDateTime(GblIQCare.CurrentDate))
                {
                    IQCareWindowMsgBox.ShowWindow("AdjustmentStockDate", this);
                    return(false);
                }
                DataTable thestockLevel     = (DataTable)dgwStockLevelDetails.DataSource;
                bool      IsAdjustreasonset = false;
                int       AdjQtyCount       = 0;

                for (int i = 0; i < thestockLevel.Rows.Count; i++)
                {
                    if (!String.IsNullOrEmpty(Convert.ToString(thestockLevel.Rows[i]["AdjQty"])))
                    {
                        if (Convert.ToInt32(thestockLevel.Rows[i]["AdjQty"]) == 0)
                        {
                            AdjQtyCount++;
                        }
                    }
                }

                if (thestockLevel.Rows.Count > 0)
                {
                    if (thestockLevel.Rows.Count == AdjQtyCount)
                    {
                        IQCareWindowMsgBox.ShowWindow("AdjustStockLevel", this);
                        return(false);
                    }
                }

                for (int i = 0; i < thestockLevel.Rows.Count; i++)
                {
                    if (thestockLevel.Rows[i]["AdjQty"].ToString() == "")
                    {
                        IQCareWindowMsgBox.ShowWindow("AdjustStockLevel", this);
                        return(false);
                    }
                }

                //AdjustReason

                for (int i = 0; i < thestockLevel.Rows.Count; i++)
                {
                    if (!String.IsNullOrEmpty(Convert.ToString(thestockLevel.Rows[i]["AdjustReasonId"])))
                    {
                        if (Convert.ToInt32(thestockLevel.Rows[i]["AdjustReasonId"]) > 0)
                        {
                            IsAdjustreasonset = true;
                            break;
                        }
                    }
                }
                if (thestockLevel.Rows.Count > 0)
                {
                    if (!IsAdjustreasonset)
                    {
                        IQCareWindowMsgBox.ShowWindow("AdjustmentReason", this);
                        return(false);
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
            return(true);
        }
コード例 #17
0
        public void formInit()
        {
            try
            {
                //IMasterList objPOItem = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                IPurchase objPOItem = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
                dsPOItemsDetail = objPOItem.GetPurchaseOrderDetailsByPoid(GblIQCare.PurchaseOrderID);
                if (dsPOItemsDetail.Tables.Count > 0)
                {
                    if (dsPOItemsDetail.Tables[0].Rows.Count > 0)
                    {
                        dtpOrderDate.Text         = dsPOItemsDetail.Tables[0].Rows[0]["OrderDate"].ToString();
                        dtpOrderDate.CustomFormat = "dd-MMM-yyyy";
                        dtpOrderDate.Enabled      = false;
                        txtOrderNumber.Text       = dsPOItemsDetail.Tables[0].Rows[0]["PONumber"].ToString();
                        txtOrderNumber.Enabled    = true;
                        // ddlSourceStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["SourceStoreID"].ToString());


                        if (GblIQCare.ModePurchaseOrder == 1)
                        {
                            ddlSupplier.DataSource = null;
                            BindFunctions theBind = new BindFunctions();
                            ddlSupplier.DataSource = null;
                            DataSet XMLDS = new DataSet();
                            XMLDS.ReadXml(GblIQCare.GetXMLPath() + "\\AllMasters.con");
                            BindFunctions theBindManager = new BindFunctions();
                            DataView      theDV          = new DataView(XMLDS.Tables["Mst_Supplier"]);
                            theDV.RowFilter = "(DeleteFlag = 0 or  DeleteFlag is null) or  (Id = " + Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["SupplierID"].ToString()) + ")";
                            DataTable theStoreDT = theDV.ToTable();
                            theBind.Win_BindCombo(ddlSupplier, theStoreDT, "SupplierName", "Id");

                            ddlSupplier.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["SupplierID"].ToString());
                            ddlSupplier.Enabled       = false;
                        }

                        ddlDestinationStore.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["DestinStoreID"].ToString());
                        ddlDestinationStore.Enabled       = false;
                        ddlPreparedBy.SelectedValue       = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["PreparedBy"].ToString());
                        if (dsPOItemsDetail.Tables[0].Rows[0]["Status"].ToString() == "1")
                        {
                            chkRejectedStatus.Visible = true;
                            Btndelete.Enabled         = true;
                            btnSave.Enabled           = true;
                            IsPOUpdated      = true;
                            btnPrint.Enabled = false;
                        }
                        else if (dsPOItemsDetail.Tables[0].Rows[0]["Status"].ToString() == "5")
                        {
                            btnSave.Enabled           = false;
                            Btndelete.Enabled         = false;
                            IsPOUpdated               = false;
                            chkRejectedStatus.Visible = true;
                            chkRejectedStatus.Checked = true;
                            chkRejectedStatus.Enabled = false;
                            btnPrint.Enabled          = true;
                        }
                        else
                        {
                            ddlAuthorisedBy.SelectedValue = Convert.ToInt32(dsPOItemsDetail.Tables[0].Rows[0]["AuthorizedBy"].ToString());
                            btnSave.Enabled           = false;
                            Btndelete.Enabled         = false;
                            chkRejectedStatus.Visible = false;
                            btnPrint.Enabled          = true;
                        }
                        lblTotalAmount.Text = dsPOItemsDetail.Tables[1].Rows[0]["TotalAmount"].ToString();
                        BindGrid(dsPOItems);
                        dgwItemSubitemDetails.AllowUserToAddRows = true;
                        dgwItemSubitemDetails.DataSource         = dsPOItemsDetail.Tables[1];
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlSourceStore.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Source Store";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlSourceStore.Focus();
                return;
            }

            if (ddlDestinationStore.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Destination Store";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlDestinationStore.Focus();
                return;
            }

            if (ddlPreparedBy.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Prepared By";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlPreparedBy.Focus();
                return;
            }
            dtOrdermaster = CreateOrderMasterTable();
            DataRow theDRow = dtOrdermaster.NewRow();

            theDRow["OrderDate"] = dtpOrderDate.Text;

            theDRow["DestStore"] = Convert.ToInt32(ddlDestinationStore.SelectedValue);

            theDRow["SrcStore"] = Convert.ToInt32(ddlSourceStore.SelectedValue);
            //  theDRow["DestStore"] = Convert.ToInt32(ddlDestinationStore.SelectedValue);

            theDRow["PreparedBy"]  = Convert.ToInt32(ddlPreparedBy.SelectedValue);
            theDRow["AthorizedBy"] = Convert.ToInt32(ddlAuthorisedBy.SelectedValue);

            theDRow["UserID"]     = Convert.ToInt32(GblIQCare.AppUserId);
            theDRow["LocationID"] = Convert.ToInt32(GblIQCare.AppLocationId);
            if (IsPOUpdated)
            {
                theDRow["IsRejectedStatus"] = chkRejectedStatus.Checked ? 1 : 0;
                theDRow["POID"]             = GblIQCare.PurchaseOrderID;
            }
            dtOrdermaster.Rows.Add(theDRow);

            //DataTable theGrdTable = (DataTable)dgwItemSubitemDetails.DataSource;
            dtOrderItem = CreateOrderItemTable();

            for (int i = 0; i < dgwItemSubitemDetails.Rows.Count; i++)
            {
                // if (Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells[0].Value) > 0)
                if (!String.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells[0].Value)))
                {
                    if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["Units"].Value) == "")
                    {
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderUnitempty", this);
                        return;
                    }

                    if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value) == "0")
                    {
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderQuantityZero", this);
                        return;
                    }
                    if (String.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value)))
                    {
                        dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value = 0;
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderQuantityZero", this);
                        return;
                    }
                    //if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["Price"].Value) == "0")
                    //{
                    //    IQCareWindowMsgBox.ShowWindow("PurchaseOrderPriceZero", this);
                    //    return;
                    //}
                    //if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["Price"].Value) == "0")
                    //{
                    //    IQCareWindowMsgBox.ShowWindow("PurchaseOrderPriceZero", this);
                    //    return;
                    //}

                    DataRow theDRowItem = dtOrderItem.NewRow();
                    if (GblIQCare.ModePurchaseOrder == 2)
                    {
                        String   strItemId = Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells[0].Value);
                        string[] strarry   = strItemId.Split('-');
                        theDRowItem["ItemID"]  = Convert.ToInt32(strarry[0]);
                        theDRowItem["BatchID"] = Convert.ToInt32(strarry[1]);
                        // theDRowItem["ExpiryDate"] = Convert.ToDateTime(String.Format(MM-strarry[1]);//String.Format("{0:dd-MMM-yyyy}",
                        string dateString = strarry[2];
                        // DateTime expDate = new DateTime(Convert.ToInt32(dateString[2]), Convert.ToInt32(dateString[0]), Convert.ToInt32(dateString[1]));
                        theDRowItem["ExpiryDate"]   = Utility.GetDateFromMMDDYYYY(dateString, '/');// expDate;
                        theDRowItem["AvaliableQty"] = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["AvailableQTY"].Value);;
                    }

                    theDRowItem["ItemName"]     = dgwItemSubitemDetails.Rows[i].Cells[0].FormattedValue.ToString();
                    theDRowItem["Quantity"]     = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value);
                    theDRowItem["priceperunit"] = Convert.ToDecimal(dgwItemSubitemDetails.Rows[i].Cells["Price"].Value);
                    theDRowItem["UnitQuantity"] = Convert.ToDecimal(dgwItemSubitemDetails.Rows[i].Cells["UnitQuantity"].Value);

                    dtOrderItem.Rows.Add(theDRowItem);
                }
            }

            if (dtOrderItem.Rows.Count <= 0)
            {
                IQCareWindowMsgBox.ShowWindow("PurchaseOrderItem", this);
                return;
            }
            //bool isDuplicate = false;
            for (int iDupitem = 0; iDupitem < dtOrderItem.Rows.Count; iDupitem++)
            {
                for (int x = iDupitem + 1; x < dtOrderItem.Rows.Count; x++)
                {
                    if (dtOrderItem.Rows[iDupitem]["ItemName"].ToString() == dtOrderItem.Rows[x]["ItemName"].ToString())
                    {
                        //pass message builder message
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Control"] = dtOrderItem.Rows[iDupitem]["ItemName"].ToString();
                        IQCareWindowMsgBox.ShowWindow("DuplicatePOItems", theBuilder, this);

                        //isDuplicate = true;
                        //break;
                        return;
                    }
                }
            }

            //IMasterList objMasterlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            //int ret = objMasterlist.SavePurchaseOrder(dtOrdermaster, dtOrderItem, IsPOUpdated);

            IPurchase objMasterlist = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
            int       ret           = objMasterlist.SavePurchaseOrder(dtOrdermaster, dtOrderItem, IsPOUpdated);

            if (ret > 0)
            {
                IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
                if (GblIQCare.PurchaseOrderID == 0)
                {
                    GblIQCare.PurchaseOrderID = ret;
                }
                formInit();
                return;
            }
        }
コード例 #19
0
        /// <summary>
        /// Handles the Click event of the btnExport control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (chkLstBoxForms.CheckedItems.Count > 0)
            {
                DataSet dsCollectDataToSave = new DataSet();

                IImportExportForms objExportFormDetails;
                objExportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder");
                for (int i = 0; i < chkLstBoxForms.CheckedItems.Count; i++)
                {
                    if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms")
                    {
                        objDsFormDetails = objExportFormDetails.GetImportExportFormDetail(chkLstBoxForms.CheckedItems[i].ToString());
                        if (dsCollectDataToSave.Tables.Count == 0)
                        {
                            ////mst_feature
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[0].Copy());
                            ////mst_section
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[1].Copy());
                            ////lnk_forms
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[2].Copy());
                            ////Select List Val only for custom fields
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[3].Copy());
                            ////Business Rule only for custom fields
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[4].Copy());
                            ////mst_module-tech area
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[5].Copy());
                            ////module identifier
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[6].Copy());
                            ////Conditional Fields
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[7].Copy());
                            ////Select List Val only for Conditional custom fields
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[8].Copy());
                            ////Business Rule only for Conditional custom fields
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[9].Copy());
                            ////APPAdmin for Version Check
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[10].Copy());
                            ////Field ICD Code Linking Table
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[11].Copy());
                            ////Master Table for Tabs
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[12].Copy());
                            ////Linking Table for Tabs and Section Id
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[13].Copy());
                            ////Special form linking
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[14].Copy());
                        }
                        else
                        {
                            foreach (DataRow dr in objDsFormDetails.Tables[0].Rows)
                            {
                                dsCollectDataToSave.Tables[0].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[1].Rows)
                            {
                                dsCollectDataToSave.Tables[1].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[2].Rows)
                            {
                                dsCollectDataToSave.Tables[2].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[3].Rows)
                            {
                                dsCollectDataToSave.Tables[3].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[4].Rows)
                            {
                                dsCollectDataToSave.Tables[4].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[5].Rows)
                            {
                                dsCollectDataToSave.Tables[5].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[6].Rows)
                            {
                                dsCollectDataToSave.Tables[6].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[7].Rows)
                            {
                                dsCollectDataToSave.Tables[7].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[8].Rows)
                            {
                                dsCollectDataToSave.Tables[8].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[9].Rows)
                            {
                                dsCollectDataToSave.Tables[9].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[10].Rows)
                            {
                                dsCollectDataToSave.Tables[10].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[11].Rows)
                            {
                                dsCollectDataToSave.Tables[11].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[12].Rows)
                            {
                                dsCollectDataToSave.Tables[12].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[13].Rows)
                            {
                                dsCollectDataToSave.Tables[13].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[14].Rows)
                            {
                                dsCollectDataToSave.Tables[14].ImportRow(dr);
                            }
                        }
                    }
                    else //export only home pages
                    {
                        objDsFormDetails = objExportFormDetails.GetImportExportHomeFormDetail(chkLstBoxForms.CheckedItems[i].ToString());

                        if (dsCollectDataToSave.Tables.Count == 0)
                        {
                            ////mst_feature
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[0].Copy());
                            ////mst_section
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[1].Copy());
                            ////lnk_forms
                            dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[2].Copy());
                            //////Select List Val only for custom fields
                            //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[3].Copy());
                            //////Business Rule only for custom fields
                            //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[4].Copy());
                            //////mst_module-tech area
                            //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[5].Copy());
                            //////module identifier
                            //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[6].Copy());
                        }
                        else
                        {
                            foreach (DataRow dr in objDsFormDetails.Tables[0].Rows)
                            {
                                dsCollectDataToSave.Tables[0].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[1].Rows)
                            {
                                dsCollectDataToSave.Tables[1].ImportRow(dr);
                            }
                            foreach (DataRow dr in objDsFormDetails.Tables[2].Rows)
                            {
                                dsCollectDataToSave.Tables[2].ImportRow(dr);
                            }
                        }
                    }
                }
                FileDialog oDialog = new SaveFileDialog();
                oDialog.DefaultExt = "xml";
                oDialog.FileName   = "Export Form-" + DateTime.Today.ToString("ddMMMyyyy") + ".xml";
                oDialog.Filter     = "Form (*.xml)|*.xml";
                if (oDialog.ShowDialog() == DialogResult.OK)
                {
                    string strFilename = oDialog.FileName;
                    dsCollectDataToSave.WriteXml(strFilename);
                }
            }
            else
            {
                IQCareWindowMsgBox.ShowWindow("SelectForm", this);
                txtFileName.Focus();
            }
        }
コード例 #20
0
        private void BindGrid(DataSet theDS)
        {
            try
            {
                //dgwItemSubitemDetails.Columns.Clear();
                dgwItemSubitemDetails.AutoGenerateColumns = false;
                dgwItemSubitemDetails.AllowUserToAddRows  = false;
                // dgwItemSubitemDetails.Columns["ItemName"]
                DataGridViewComboBoxColumn theColumnItemName = dgwItemSubitemDetails.Columns["ItemName"] as DataGridViewComboBoxColumn; //new DataGridViewComboBoxColumn();
                                                                                                                                        // ComboBox theColumnItemName = new ComboBox();
                try
                {
                    theColumnItemName.HeaderText       = "Item Name";
                    theColumnItemName.Name             = "ItemName";
                    theColumnItemName.DataPropertyName = "ItemId";

                    DataRow drItemSelect;
                    drItemSelect             = theDS.Tables[0].NewRow();
                    drItemSelect["ItemId"]   = 0;
                    drItemSelect["ItemName"] = "Select";
                    theDS.Tables[0].Rows.InsertAt(drItemSelect, 0);

                    DataView theDV = new DataView(theDS.Tables[0]);
                    theDV.RowFilter = "AvailableQTY > 0";
                    DataTable theDT = theDV.ToTable();

                    theColumnItemName.DataSource = theDT;//theDS.Tables[0];

                    theColumnItemName.DisplayMember = "ItemName";
                    theColumnItemName.ValueMember   = "ItemId";
                    // theColumnItemName.Width = 350;
                    theColumnItemName.ReadOnly = false;
                    //theColumnItemName.AutoComplete = true;
                    theColumnItemName.DefaultCellStyle.NullValue = "Select";
                }
                catch { }

                DataGridViewTextBoxColumn theColumnItemCode = new DataGridViewTextBoxColumn();
                theColumnItemCode.HeaderText       = "Item Code";
                theColumnItemCode.Name             = "ItemCode";
                theColumnItemCode.DataPropertyName = "ItemCode";
                theColumnItemCode.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnUnit = new DataGridViewTextBoxColumn();
                theColumnUnit.HeaderText       = "Purchase Units";
                theColumnUnit.Name             = "Units";
                theColumnUnit.DataPropertyName = "Units";
                theColumnUnit.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnUnitQuantity = new DataGridViewTextBoxColumn();
                theColumnUnitQuantity.HeaderText       = "Unit Qty";
                theColumnUnitQuantity.DataPropertyName = "UnitQuantity";
                theColumnUnitQuantity.Name             = "UnitQuantity";
                theColumnUnitQuantity.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnQuantity = new DataGridViewTextBoxColumn();
                theColumnQuantity.HeaderText       = "Ordered Qty";
                theColumnQuantity.DataPropertyName = "OrderQuantity";
                theColumnQuantity.Name             = "OrderQuantity";
                theColumnQuantity.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnPrice = new DataGridViewTextBoxColumn();
                theColumnPrice.HeaderText       = "Price /Unit";
                theColumnPrice.DataPropertyName = "Price";
                theColumnPrice.Name             = "Price";
                theColumnPrice.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnTotPrice = new DataGridViewTextBoxColumn();
                theColumnTotPrice.HeaderText       = "Total Price";
                theColumnTotPrice.DataPropertyName = "TotPrice";
                theColumnTotPrice.Name             = "TotPrice";
                theColumnTotPrice.ReadOnly         = true;

                ////DataGridViewButtonColumn theColumnDelete = new DataGridViewButtonColumn();
                ////theColumnDelete.DataPropertyName = "Delete";
                ////theColumnDelete.Name = "Delete";
                ////theColumnDelete.Text = "Delete";
                ////theColumnDelete.Width = 150;
                // theColumnDelete.ReadOnly = true;

                ////DataGridViewTextBoxColumn theColumnIsFunded = new DataGridViewTextBoxColumn();
                ////theColumnIsFunded.DataPropertyName = "IsFunded";
                ////theColumnIsFunded.Name = "IsFunded";
                ////theColumnIsFunded.Width = 10;
                ////theColumnIsFunded.Visible = false;


                dgwItemSubitemDetails.DataSource = dsPOItems.Tables[2];
                // dgwItemSubitemDetails.Columns.Add(theColumnItemName);
                //  dgwItemSubitemDetails.Columns.Add(theColumnItemCode);
                //  dgwItemSubitemDetails.Columns.Add(theColumnUnit);
                //  dgwItemSubitemDetails.Columns.Add(theColumnUnitQuantity);
                //  dgwItemSubitemDetails.Columns.Add(theColumnQuantity);
                //  dgwItemSubitemDetails.Columns.Add(theColumnPrice);
                if (GblIQCare.ModePurchaseOrder == 1)
                {
                    // theColumnItemCode.Width = 100;
                    //  theColumnUnit.Width = 90;
                    // theColumnQuantity.Width = 90;
                    // theColumnPrice.Width = 90;
                    //theColumnTotPrice.Width = 85;
                }
                else if (GblIQCare.ModePurchaseOrder == 2)
                {
                    //  theColumnItemCode.Width = 60;
                    //  theColumnUnit.Width = 60;
                    //  theColumnQuantity.Width = 60;
                    //  theColumnPrice.Width = 60;
                    //  theColumnTotPrice.Width = 60;
                    //  theColumnUnitQuantity.Width = 60;

                    DataGridViewTextBoxColumn theColumnExpiryDate = new DataGridViewTextBoxColumn();
                    theColumnExpiryDate.HeaderText       = "Expiry Date";
                    theColumnExpiryDate.Name             = "ExpiryDate";
                    theColumnExpiryDate.DataPropertyName = "ExpiryDate";
                    // theColumnExpiryDate.Width = 80;
                    theColumnExpiryDate.ReadOnly = true;

                    DataGridViewTextBoxColumn theColumnBatchName = new DataGridViewTextBoxColumn();
                    theColumnBatchName.HeaderText       = "Batch No.";
                    theColumnBatchName.Name             = "BatchName";
                    theColumnBatchName.DataPropertyName = "BatchName";
                    //   theColumnBatchName.Width = 100;
                    theColumnBatchName.ReadOnly = true;

                    DataGridViewTextBoxColumn theColumnBatchID = new DataGridViewTextBoxColumn();
                    theColumnBatchID.HeaderText       = "BatchID";
                    theColumnBatchID.Name             = "BatchID";
                    theColumnBatchID.DataPropertyName = "BatchID";
                    // theColumnBatchID.Width = 150;
                    theColumnBatchID.ReadOnly = true;
                    theColumnBatchID.Visible  = false;

                    DataGridViewTextBoxColumn theColumnAvailableQTY = new DataGridViewTextBoxColumn();
                    theColumnAvailableQTY.HeaderText       = "Available Qty";
                    theColumnAvailableQTY.Name             = "AvailableQTY";
                    theColumnAvailableQTY.DataPropertyName = "AvailableQTY";
                    // theColumnAvailableQTY.Width = 60;
                    theColumnAvailableQTY.ReadOnly = true;

                    // dgwItemSubitemDetails.Columns.Add(theColumnExpiryDate);
                    //dgwItemSubitemDetails.Columns.Add(theColumnBatchName);
                    // //dgwItemSubitemDetails.Columns.Add(theColumnBatchID);
                    //  dgwItemSubitemDetails.Columns.Add(theColumnAvailableQTY);
                }
                // dgwItemSubitemDetails.Columns.Add(theColumnTotPrice);
                // dgwItemSubitemDetails.Columns.Add(theColumnDelete);
                // dgwItemSubitemDetails.Columns.Add(theColumnIsFunded);
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #21
0
        private bool ValidateForm()
        {
            DataView theDV = new DataView(theDTAllItems);

            if (ItemCode != txtItemCode.Text)
            {
                theDV.RowFilter = "DrugId = '" + txtItemCode.Text + "'";
                if (theDV.ToTable().Rows.Count > 0)
                {
                    IQCareWindowMsgBox.ShowWindow("CheckDuplicateValue", this);
                    return(false);
                }
            }

            if (Convert.ToInt32(cmbDispensingUnit.SelectedValue) < 1)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Dispensing Unit";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this);
                return(false);
            }
            if (Convert.ToInt32(cmbPurchaseUnit.SelectedValue) < 1)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Purchase Unit";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this);
                return(false);
            }
            if (txtUnitQty.Text == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Purchase Unit Quantity";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
                return(false);
            }
            if (txtPurchaseUnitPrice.Text == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Purchase Unit Price";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
                return(false);
            }
            if (Convert.ToInt32(cmbManufacturer.SelectedValue) < 1)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Manufacturer";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this);
                return(false);
            }
            if (txtDispenseUnitPrice.Text == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Dispensing Unit Price";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
                return(false);
            }
            if (txtdespensingMargin.Text == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Dispensing Margin";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
                return(false);
            }
            if (txteditsellingprice.Text == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Selling price";
                IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
                return(false);
            }
            return(true);
        }
コード例 #22
0
        void theCombo_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (theGrdCombo.Focused == true && theGrdCombo.SelectedValue != null)
                {
                    if (theGrdCombo.DataSource != null && theGrdCombo.SelectedValue.GetType().ToString() != "System.Data.DataRowView")
                    {
                        string strdrug = theGrdCombo.SelectedValue.ToString();
                        ////DataSet dsSetItemdetail = dsPOItems.Copy();
                        ////DataView dvFilteredRow = new DataView();
                        ////dvFilteredRow = dsSetItemdetail.Tables[1].DefaultView;
                        string[]  strArry = strdrug.Split('-');
                        DataTable theDT   = new DataTable();
                        theDT = dsPOItems.Tables[1].Copy();
                        DataView  dvFilteredRow = theDT.DefaultView;
                        DataTable dtRow         = new DataTable();
                        dvFilteredRow.RowFilter = "Drug_Pk=" + strArry[0];

                        dtRow = dvFilteredRow.ToTable();
                        if (dtRow.Rows.Count > 0)
                        {
                            if (!deletedGridByKey)
                            {
                                dgwItemSubitemDetails.CurrentRow.Cells["ItemCode"].Value    = dtRow.Rows[0]["DrugId"].ToString();
                                dgwItemSubitemDetails.CurrentRow.Cells["ItemCode"].ReadOnly = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["Units"].Value       = dtRow.Rows[0]["PurchaseUnitName"].ToString();
                                dgwItemSubitemDetails.CurrentRow.Cells["Units"].ReadOnly    = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["Price"].Value       = Convert.ToDecimal(dtRow.Rows[0]["PurchaseUnitPrice"].ToString());
                                dgwItemSubitemDetails.CurrentRow.Cells["Price"].ReadOnly    = true;
                                if (Convert.ToString(dtRow.Rows[0]["QtyPerPurchaseunit"]) != "")
                                {
                                    dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].Value = Convert.ToDecimal(dtRow.Rows[0]["QtyPerPurchaseunit"].ToString());
                                }
                                else
                                {
                                    dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].Value = "";
                                }
                                dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].ReadOnly = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["OrderQuantity"].Value   = 0;
                                dgwItemSubitemDetails.CurrentRow.Cells["TotPrice"].ReadOnly     = true;

                                //For Inter store Transfer
                                if (GblIQCare.ModePurchaseOrder == 2)
                                {
                                    DataRowView theGrdCombodrow = (DataRowView)theGrdCombo.SelectedItem;
                                    string      strdrugName     = theGrdCombodrow.Row.ItemArray[1].ToString();

                                    DataTable theISTDT         = dsPOItems.Tables[0].Copy();
                                    DataView  dvISTFilteredRow = theISTDT.DefaultView;
                                    DataTable dtISTRow         = new DataTable();
                                    dvISTFilteredRow.RowFilter = "ItemName ='" + strdrugName + "'";


                                    dtISTRow = dvISTFilteredRow.ToTable();
                                    dgwItemSubitemDetails.CurrentRow.Cells["AvailableQTY"].Value    = dtISTRow.Rows[0]["AvailableQTY"].ToString();
                                    dgwItemSubitemDetails.CurrentRow.Cells["AvailableQTY"].ReadOnly = true;
                                    dgwItemSubitemDetails.CurrentRow.Cells["ExpiryDate"].Value      = dtISTRow.Rows[0]["ExpiryDate"].ToString();
                                    dgwItemSubitemDetails.CurrentRow.Cells["ExpiryDate"].ReadOnly   = true;
                                    dgwItemSubitemDetails.CurrentRow.Cells["BatchID"].Value         = dtISTRow.Rows[0]["BatchId"].ToString();
                                    dgwItemSubitemDetails.CurrentRow.Cells["BatchID"].ReadOnly      = true;
                                    dgwItemSubitemDetails.CurrentRow.Cells["BatchName"].Value       = dtISTRow.Rows[0]["Batch"].ToString();
                                    dgwItemSubitemDetails.CurrentRow.Cells["BatchName"].ReadOnly    = true;

                                    //dgwItemSubitemDetails.CurrentRow.Cells["OrderQuantity"].Value = 0;
                                    //dgwItemSubitemDetails.CurrentRow.Cells["TotPrice"].ReadOnly = true;
                                }


                                //dgwItemSubitemDetails.CurrentRow.Cells["Delete"].Value = "Delete";
                                //if (dtRow.Rows[0]["delete"].ToString() == "1")
                                //{

                                //    dgwItemSubitemDetails.CurrentRow.Cells["Delete"].ReadOnly = false;
                                //}
                                //else
                                //{
                                //    dgwItemSubitemDetails.CurrentRow.Cells["Delete"].ReadOnly = true;
                                //}

                                dgwItemSubitemDetails.AllowUserToAddRows = true;

                                ////DataView dvFundedRow = new DataView();
                                ////DataTable dtFundedRow = new DataTable();
                                ////dvFundedRow = dsSetItemdetail.Tables[4].DefaultView;
                                ////dvFundedRow.RowFilter = "Drug_Pk=" + theGrdCombo.SelectedValue.ToString();
                                ////dtFundedRow = dvFundedRow.ToTable();
                                ////if (dtFundedRow.Rows.Count > 0)
                                ////{
                                ////    dgwItemSubitemDetails.CurrentRow.Cells["IsFunded"].Value = dtFundedRow.Rows[0]["Isfunded"].ToString();
                                ////}
                                ////else
                                ////{
                                ////  dgwItemSubitemDetails.CurrentRow.Cells["IsFunded"].Value = 0;
                                ////}

                                ////if (dsSetItemdetail != null)
                                ////{
                                ////    dsSetItemdetail.Dispose();
                                ////    dsSetItemdetail = null;
                                ////}
                                dvFilteredRow = null;
                                dtRow         = null;
                                theDT         = null;
                                ////dvFundedRow = null;
                                ////dtFundedRow = null;
                            }
                        }
                        else
                        {
                            if (dgwItemSubitemDetails.SelectedRows.Count > 0)
                            {
                                foreach (DataGridViewRow row in dgwItemSubitemDetails.SelectedRows)
                                {
                                    dgwItemSubitemDetails.Rows.Remove(row);
                                    //theGrdCombo.SelectedValueChanged += null;
                                    deletedGridByKey = true;
                                }
                            }
                        }
                    }
                }
            }
            //catch (System.StackOverflowException er)
            //{
            //    throw;
            //}
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }

            finally
            {
            }
        }
コード例 #23
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            if (Validation_Form() != false)
            {
                theDT = (DataTable)dgwDonorProgramLinking.DataSource;
                DataView  theDV    = new DataView(theDT);
                DataTable theRemDT = theDT.Copy();

                ////////////////////////
                DonorId   = Convert.ToInt32(ddlDonorName.SelectedValue);
                ProgramId = Convert.ToInt32(ddlProgramName.SelectedValue);
                if (UpdateFlag == 1)
                {
                    DataRow[] Removerows = theRemDT.Select("DonorId='" + DonorId + "' and ProgramId='" + ProgramId + "'");
                    theRemDT.Rows.Remove(Removerows[0]);
                    //theDV.RowFilter = "DonorId <>'" + DonorId + "' and ProgramId <>'" + ProgramId + "' and FundingStartdate<>'" + FundStDate + "' and FundingEnddate<>'" + FundEndDate + "'";
                    //theDV.RowFilter = "DonorId <>'" + DonorId + "' and  ProgramId <>'" + ProgramId + "'";
                }
                else
                {
                    theDV.RowFilter = "DonorId='" + DonorId + "' and ProgramId='" + ProgramId + "'";
                }

                IQCareUtils util      = new IQCareUtils();
                DataTable   theProgDT = new DataTable();
                if (UpdateFlag == 1)
                {
                    theProgDT = theRemDT;
                }
                else
                {
                    theProgDT = util.CreateTableFromDataView(theDV);
                }
                DataView theProgDV = new DataView(theProgDT);
                theProgDV.RowFilter = "ProgramId='" + ProgramId + "'";
                DataTable theFiltDT = util.CreateTableFromDataView(theProgDV);
                if (theProgDV.Count > 0)
                {
                    DataRow[] rows = theFiltDT.Select(String.Format("(#{0}# >= FundingStartdate AND #{0}# <= FundingEnddate) OR (#{1}# >= FundingStartdate AND #{1}# <= FundingEnddate)", String.Format("{0:dd-MMM-yyyy}", dtpStartDate.Text), String.Format("{0:dd-MMM-yyyy}", dtpEndDate.Text)));
                    if (rows.Length > 0)
                    {
                        IQCareWindowMsgBox.ShowWindow("ExistFunding", this);
                        return;
                    }
                }


                ///////////////////////////
                if (rowindex > -1)
                {
                    DataRow[] rows = theDT.Select("DonorId='" + DonorId + "' and ProgramId='" + ProgramId + "' and FundingStartdate='" + FundStDate + "' and FundingEnddate='" + FundEndDate + "'");
                    //theDV.RowFilter = "Name='" + UpdateName + "' and SRNO='" + UpdateSRNO + "'";
                    if (rows.Length > 0)
                    {
                        rows[0]["FundingStartDate"] = String.Format("{0:dd-MMM-yyyy}", dtpStartDate.Text);
                        rows[0]["FundingEndDate"]   = String.Format("{0:dd-MMM-yyyy}", dtpEndDate.Text);
                    }
                }
                else
                {
                    DataRow theDRow = theDT.NewRow();

                    theDRow["DonorId"]          = ddlDonorName.SelectedValue;
                    theDRow["DonorName"]        = ddlDonorName.Text;
                    theDRow["ProgramId"]        = ddlProgramName.SelectedValue;
                    theDRow["ProgramName"]      = ddlProgramName.Text;
                    theDRow["FundingStartDate"] = String.Format("{0:dd-MMM-yyyy}", dtpStartDate.Text);
                    theDRow["FundingEndDate"]   = String.Format("{0:dd-MMM-yyyy}", dtpEndDate.Text);
                    theDT.Rows.Add(theDRow);
                }
                ShowGrid(theDT);
                Clear_Form();
            }
        }
コード例 #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlSupplier.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Supplier Name";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlSupplier.Focus();
                return;
            }
            if (ddlDestinationStore.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Destination Store";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlSupplier.Focus();
                return;
            }
            if (ddlPreparedBy.SelectedValue.ToString() == "0")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Prepared By";
                IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this);
                ddlSupplier.Focus();
                return;
            }
            dtOrdermaster = CreateOrderMasterTable();
            DataRow theDRow = dtOrdermaster.NewRow();

            theDRow["OrderDate"] = dtpOrderDate.Text;
            if (txtOrderNumber.Text != "")
            {
                theDRow["PONumber"] = txtOrderNumber.Text.Trim();
            }

            theDRow["DestStore"]   = Convert.ToInt32(ddlDestinationStore.SelectedValue);
            theDRow["SupplierID"]  = Convert.ToInt32(ddlSupplier.SelectedValue);
            theDRow["PreparedBy"]  = Convert.ToInt32(ddlPreparedBy.SelectedValue);
            theDRow["AthorizedBy"] = Convert.ToInt32(ddlAuthorisedBy.SelectedValue);

            theDRow["UserID"]     = Convert.ToInt32(GblIQCare.AppUserId);
            theDRow["LocationID"] = Convert.ToInt32(GblIQCare.AppLocationId);
            if (IsPOUpdated)
            {
                theDRow["IsRejectedStatus"] = chkRejectedStatus.Checked ? 1 : 0;
                theDRow["POID"]             = GblIQCare.PurchaseOrderID;
            }
            dtOrdermaster.Rows.Add(theDRow);

            //DataTable theGrdTable = (DataTable)dgwItemSubitemDetails.DataSource;
            dtOrderItem = CreateOrderItemTable();

            for (int i = 0; i < dgwItemSubitemDetails.Rows.Count; i++)
            {
                // if (Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells[0].Value) > 0)
                if (!string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells[0].Value)))
                {
                    if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["Units"].Value) == "")
                    {
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderUnitempty", this);
                        return;
                    }

                    if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value) == "0")
                    {
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderQuantityZero", this);
                        return;
                    }
                    if (string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value)))
                    {
                        dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value = 0;
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderQuantityZero", this);
                        return;
                    }

                    if (string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["BatchName"].Value)))
                    {
                        IQCareWindowMsgBox.ShowWindow("MissingBatchNumber", this);
                        return;
                    }
                    if (string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["ExpiryDate"].Value)))
                    {
                        IQCareWindowMsgBox.ShowWindow("MissingExpiryDate", this);
                        return;
                    }

                    if (Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantity"].Value) == "0")
                    {
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderIssuedQuantityZero", this);
                        return;
                    }
                    if (string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantity"].Value)))
                    {
                        dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantity"].Value = 0;
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderIssuedQuantityZero", this);
                        return;
                    }

                    if (string.IsNullOrEmpty(Convert.ToString(dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantityDU"].Value)))
                    {
                        dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantityDU"].Value = 0;
                        IQCareWindowMsgBox.ShowWindow("PurchaseOrderIssuedQuantityDUZero", this);
                        return;
                    }

                    DataRow theDRowItem = dtOrderItem.NewRow();
                    if (GblIQCare.ModePurchaseOrder == 1)
                    {
                        theDRowItem["ItemID"]     = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells[0].Value);
                        theDRowItem["SupplierId"] = Convert.ToInt32(ddlSupplier.SelectedValue);
                        //theDRowItem["BatchID"] = 0;
                        //theDRowItem["ExpiryDate"] = DBNull.Value;
                        theDRowItem["AvaliableQty"] = 0;
                    }
                    theDRowItem["ItemTypeId"]       = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["ItemTypeId"].Value);
                    theDRowItem["ItemName"]         = dgwItemSubitemDetails.Rows[i].Cells[0].FormattedValue.ToString();
                    theDRowItem["Quantity"]         = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["OrderQuantity"].Value);
                    theDRowItem["IssuedQuantity"]   = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantity"].Value);
                    theDRowItem["IssuedQuantityDU"] = Convert.ToInt32(dgwItemSubitemDetails.Rows[i].Cells["IssuedQuantityDU"].Value);
                    theDRowItem["BatchName"]        = dgwItemSubitemDetails.Rows[i].Cells["BatchName"].Value.ToString();
                    theDRowItem["ExpiryDate"]       = Convert.ToDateTime(dgwItemSubitemDetails.Rows[i].Cells["ExpiryDate"].Value);
                    theDRowItem["priceperunit"]     = Convert.ToDecimal(dgwItemSubitemDetails.Rows[i].Cells["Price"].Value);
                    theDRowItem["UnitQuantity"]     = Convert.ToDecimal(dgwItemSubitemDetails.Rows[i].Cells["UnitQuantity"].Value);
                    theDRowItem["IsPOorIST"]        = 1;
                    dtOrderItem.Rows.Add(theDRowItem);
                }
            }

            if (dtOrderItem.Rows.Count <= 0)
            {
                IQCareWindowMsgBox.ShowWindow("PurchaseOrderItem", this);
                return;
            }
            //bool isDuplicate = false;
            for (int iDupitem = 0; iDupitem < dtOrderItem.Rows.Count; iDupitem++)
            {
                for (int x = iDupitem + 1; x < dtOrderItem.Rows.Count; x++)
                {
                    if (dtOrderItem.Rows[iDupitem]["ItemName"].ToString() == dtOrderItem.Rows[x]["ItemName"].ToString())
                    {
                        //pass message builder message
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["Control"] = dtOrderItem.Rows[iDupitem]["ItemName"].ToString();
                        IQCareWindowMsgBox.ShowWindow("DuplicatePOItems", theBuilder, this);

                        //isDuplicate = true;
                        //break;
                        return;
                    }
                }
            }



            IPurchase objMasterlist = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM");
            int       ret           = objMasterlist.SavePOWithGRN(dtOrdermaster, dtOrderItem, IsPOUpdated);

            if (ret > 0)
            {
                IQCareWindowMsgBox.ShowWindow("ProgramSave", this);
                if (GblIQCare.PurchaseOrderID == 0)
                {
                    GblIQCare.PurchaseOrderID = ret;
                }
                formInit();
                return;
            }
        }
コード例 #25
0
ファイル: frmLogin.cs プロジェクト: uon-crissp/IQCare
        /// <summary>
        /// writes the code for user login  and enter in to main form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (ValidateLogin() == false)
            {
                return;
            }

            try
            {
                IUser objLoginManager;
                objLoginManager = (IUser)ObjectFactory.CreateInstance("BusinessProcess.Security.BUser, BusinessProcess.Security");
                DataSet theDs = objLoginManager.GetUserCredentials(txtLoginName.Text.Trim(), Convert.ToInt32(ddLocation.SelectedValue), Convert.ToInt32(GblIQCare.SystemId));
                if (theDs.Tables.Count > 0)
                {
                    Utility theUtil = new Utility();
                    if (theDs.Tables[0].Rows.Count > 0)
                    {
                        if (theUtil.Decrypt(Convert.ToString(theDs.Tables[0].Rows[0]["Password"])) != txtPassword.Text.Trim())
                        {
                            IQCareWindowMsgBox.ShowWindow("PasswordNotMatch", this);
                            txtPassword.Focus();
                            return;
                        }
                    }
                    else
                    {
                        IQCareWindowMsgBox.ShowWindow("InvalidLogin", this);
                        txtLoginName.Focus();
                        return;
                    }
                    GblIQCare.AppUserId      = Convert.ToInt32(theDs.Tables[0].Rows[0]["UserId"]);
                    GblIQCare.AppUserName    = (theDs.Tables[0].Rows[0]["UserFirstName"] + "" + theDs.Tables[0].Rows[0]["UserLastName"]).ToString();
                    GblIQCare.AppUName       = theDs.Tables[0].Rows[0]["UserName"].ToString();
                    GblIQCare.EnrollFlag     = Convert.ToInt32(theDs.Tables[1].Rows[0]["EnrollmentFlag"]);
                    GblIQCare.IdentifierFlag = Convert.ToInt32(theDs.Tables[1].Rows[0]["IdentifierFlag"]);
                    GblIQCare.dtUserRight    = theDs.Tables[1].Copy();
                    DataTable theDT = theDs.Tables[2];
                    GblIQCare.dtFacility     = theDs.Tables[2];
                    GblIQCare.SystemId       = Convert.ToInt32(theDT.Rows[0]["SystemId"].ToString());
                    GblIQCare.AppCountryId   = theDT.Rows[0]["Currency"].ToString();
                    GblIQCare.AppDateFormat  = theDT.Rows[0]["DateFormat"].ToString();
                    GblIQCare.AppGracePeriod = theDT.Rows[0]["AppGracePeriod"].ToString();
                    GblIQCare.AppLocationId  = Convert.ToInt32(theDT.Rows[0]["FacilityID"].ToString());
                    GblIQCare.AppLocation    = theDT.Rows[0]["FacilityName"].ToString();
                    GblIQCare.AppLocTelNo    = theDT.Rows[0]["FacilityTel"].ToString();
                    GblIQCare.AppPosID       = theDT.Rows[0]["PosID"].ToString();
                    GblIQCare.AppSatelliteId = theDT.Rows[0]["SatelliteID"].ToString();
                    GblIQCare.BackupDrive    = theDT.Rows[0]["BackupDrive"].ToString();
                    GblIQCare.CurrentDate    = String.Format("{0:dd-MMM-yyyy}", theDs.Tables[4].Rows[0]["CurrentDate"]);
                    GblIQCare.dtModules      = theDs.Tables[3];
                    objLoginManager          = null;

                    frmMain objForm = new frmMain();
                    objForm.Show();

                    this.Hide();
                }
                else
                {
                    IQCareWindowMsgBox.ShowWindow("InvalidLogin", this);
                    txtLoginName.Focus();
                    return;
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }
コード例 #26
0
        private void BindGrid(DataSet theDS)
        {
            try
            {
                dgwItemSubitemDetails.Columns.Clear();
                dgwItemSubitemDetails.AutoGenerateColumns = false;
                dgwItemSubitemDetails.AllowUserToAddRows  = false;
                DataGridViewComboBoxColumn theColumnItemName = new DataGridViewComboBoxColumn();
                // ComboBox theColumnItemName = new ComboBox();
                theColumnItemName.HeaderText       = "Item Name";
                theColumnItemName.Name             = "ItemName";
                theColumnItemName.DataPropertyName = "ItemId";
                if (GblIQCare.ModePurchaseOrder == 1)
                {
                    DataView theItemDV;
                    theItemDV = new DataView(theDS.Tables[0]);

                    theItemDV.RowFilter = "SupplierId =" + ddlSupplier.SelectedValue.ToString();

                    DataTable theComDT = theItemDV.ToTable();

                    DataRow drItemSelect;
                    drItemSelect               = theComDT.NewRow();
                    drItemSelect["ItemId"]     = 0;
                    drItemSelect["ItemName"]   = "Select";
                    drItemSelect["SupplierId"] = ddlSupplier.SelectedValue.ToString();
                    theComDT.Rows.InsertAt(drItemSelect, 0);

                    theColumnItemName.DataSource = theComDT;
                }
                else if (GblIQCare.ModePurchaseOrder == 2)
                {
                    DataRow drItemSelect;
                    drItemSelect               = theDS.Tables[0].NewRow();
                    drItemSelect["ItemId"]     = 0;
                    drItemSelect["ItemTypeId"] = 0;
                    drItemSelect["ItemName"]   = "Select";
                    theDS.Tables[0].Rows.InsertAt(drItemSelect, 0);

                    theColumnItemName.DataSource = theDS.Tables[0];
                }
                theColumnItemName.DisplayMember = "ItemName";
                theColumnItemName.ValueMember   = "ItemId";
                theColumnItemName.Width         = 250;
                theColumnItemName.ReadOnly      = false;
                //theColumnItemName.AutoComplete = true;
                theColumnItemName.DefaultCellStyle.NullValue = "Select";


                DataGridViewTextBoxColumn theColumnItemCode = new DataGridViewTextBoxColumn();
                theColumnItemCode.HeaderText       = "Item Code";
                theColumnItemCode.Name             = "ItemCode";
                theColumnItemCode.DataPropertyName = "ItemCode";
                theColumnItemCode.ReadOnly         = true;
                theColumnItemCode.Visible          = false;

                DataGridViewTextBoxColumn theColumnItemTypeId = new DataGridViewTextBoxColumn();
                theColumnItemTypeId.HeaderText       = "Item Type";
                theColumnItemTypeId.Name             = "ItemTypeId";
                theColumnItemTypeId.DataPropertyName = "ItemTypeId";
                theColumnItemTypeId.ReadOnly         = true;
                theColumnItemTypeId.Visible          = false;

                DataGridViewTextBoxColumn theColumnUnit = new DataGridViewTextBoxColumn();
                theColumnUnit.HeaderText       = "Purchase Units";
                theColumnUnit.Name             = "Units";
                theColumnUnit.DataPropertyName = "Units";
                theColumnUnit.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnUnitQuantity = new DataGridViewTextBoxColumn();
                theColumnUnitQuantity.HeaderText       = "Unit Quantity";
                theColumnUnitQuantity.DataPropertyName = "UnitQuantity";
                theColumnUnitQuantity.Name             = "UnitQuantity";
                theColumnUnitQuantity.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnQuantity = new DataGridViewTextBoxColumn();
                theColumnQuantity.HeaderText       = "Order Quantity";
                theColumnQuantity.DataPropertyName = "OrderQuantity";
                theColumnQuantity.Name             = "OrderQuantity";
                theColumnQuantity.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnPrice = new DataGridViewTextBoxColumn();
                theColumnPrice.HeaderText       = "Price /Unit";
                theColumnPrice.DataPropertyName = "Price";
                theColumnPrice.Name             = "Price";
                theColumnPrice.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnTotPrice = new DataGridViewTextBoxColumn();
                theColumnTotPrice.HeaderText       = "Total Price";
                theColumnTotPrice.DataPropertyName = "TotPrice";
                theColumnTotPrice.Name             = "TotPrice";
                theColumnTotPrice.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnIssuedQuantity = new DataGridViewTextBoxColumn();
                theColumnIssuedQuantity.HeaderText       = "Issued Quantity - Purchase Unit";
                theColumnIssuedQuantity.DataPropertyName = "IssuedQuantity";
                theColumnIssuedQuantity.Name             = "IssuedQuantity";
                theColumnIssuedQuantity.ReadOnly         = false;

                DataGridViewTextBoxColumn theColumnIssuedQuantityDU = new DataGridViewTextBoxColumn();
                theColumnIssuedQuantityDU.HeaderText       = "Issued Quantity - Disp Unit";
                theColumnIssuedQuantityDU.DataPropertyName = "IssuedQuantityDU";
                theColumnIssuedQuantityDU.Name             = "IssuedQuantityDU";
                theColumnIssuedQuantityDU.ReadOnly         = true;

                DataGridViewTextBoxColumn theColumnBatchNo = new DataGridViewTextBoxColumn();
                theColumnBatchNo.HeaderText       = "Batch No";
                theColumnBatchNo.DataPropertyName = "BatchName";
                theColumnBatchNo.Name             = "BatchName";
                theColumnBatchNo.ReadOnly         = false;

                CalendarColumn theColumnExpiryDate = new CalendarColumn();
                theColumnExpiryDate.HeaderText       = "Expiry Date";
                theColumnExpiryDate.DataPropertyName = "ExpiryDate";
                theColumnExpiryDate.Name             = "ExpiryDate";
                theColumnExpiryDate.ReadOnly         = false;

                dgwItemSubitemDetails.DataSource = dsPOItems.Tables[2];
                dgwItemSubitemDetails.Columns.Add(theColumnItemName);
                dgwItemSubitemDetails.Columns.Add(theColumnItemCode);
                dgwItemSubitemDetails.Columns.Add(theColumnBatchNo);
                dgwItemSubitemDetails.Columns.Add(theColumnExpiryDate);
                dgwItemSubitemDetails.Columns.Add(theColumnUnit);
                dgwItemSubitemDetails.Columns.Add(theColumnUnitQuantity);
                dgwItemSubitemDetails.Columns.Add(theColumnQuantity);
                dgwItemSubitemDetails.Columns.Add(theColumnIssuedQuantity);
                dgwItemSubitemDetails.Columns.Add(theColumnIssuedQuantityDU);
                dgwItemSubitemDetails.Columns.Add(theColumnPrice);
                //if (GblIQCare.ModePurchaseOrder == 1)
                //{
                //    theColumnItemCode.Width = 100;
                //    theColumnUnit.Width = 90;
                //    theColumnQuantity.Width = 90;
                //    theColumnPrice.Width = 90;
                //    theColumnTotPrice.Width = 85;
                //}

                dgwItemSubitemDetails.Columns.Add(theColumnTotPrice);
                dgwItemSubitemDetails.Columns.Add(theColumnItemTypeId);
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }
        }
コード例 #27
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Validation_Form() != false)
            {
                DTItemlist = (DataTable)dgwStoreName.DataSource;
                //DataView theDV = new DataView(DTItemlist);
                //theDV.RowFilter = "SRNo='" + PId + "'";
                DataView theDV = new DataView(DTItemlist);
                theDV.RowFilter = "Srno='" + PId + "'";
                DataTable TmpDT = (DataTable)dgwStoreName.DataSource;
                DataView  TmpDV = new DataView(TmpDT);
                theDV.RowFilter = "Srno='" + PId + "'";

                //if (theDV.Count > 0)
                //{

                //        theDV[0]["StoreId"] = txtStoreID.Text;
                //        theDV[0]["Name"] = txtStoreName.Text;
                //        theDV[0]["CentralStore"] = ddlPurchasingStore.SelectedItem;
                //        theDV[0]["DispensingStore"] = cmbDispensing.SelectedItem;
                //        theDV[0]["Status"] = ddlStatus.SelectedItem;

                //}
                if (theDV.Count > 0)
                {
                    if (StoreId != txtStoreID.Text)
                    {
                        if (StoreName != txtStoreName.Text)
                        {
                            TmpDV.RowFilter = "Name='" + txtStoreName.Text + "'";
                            if (TmpDV.Count > 0)
                            {
                                IQCareWindowMsgBox.ShowWindow("StoreNameduplicate", this);
                                txtStoreID.Focus();
                                return;
                            }
                        }

                        TmpDV.RowFilter = "StoreId='" + txtStoreID.Text + "'";
                        if (TmpDV.Count > 0)
                        {
                            IQCareWindowMsgBox.ShowWindow("StoreIdduplicate", this);
                            txtStoreID.Focus();
                            return;
                        }
                        theDV[0]["StoreId"]         = txtStoreID.Text;
                        theDV[0]["Name"]            = txtStoreName.Text;
                        theDV[0]["CentralStore"]    = ddlPurchasingStore.SelectedItem;
                        theDV[0]["DispensingStore"] = cmbDispensing.SelectedItem;
                        theDV[0]["Status"]          = ddlStatus.SelectedItem;
                    }
                    else
                    {
                        if (StoreName != txtStoreName.Text)
                        {
                            TmpDV.RowFilter = "Name='" + txtStoreName.Text + "'";
                            if (TmpDV.Count > 0)
                            {
                                IQCareWindowMsgBox.ShowWindow("StoreNameduplicate", this);
                                txtStoreID.Focus();
                                return;
                            }
                        }
                        theDV[0]["StoreId"]         = txtStoreID.Text;
                        theDV[0]["Name"]            = txtStoreName.Text;
                        theDV[0]["CentralStore"]    = ddlPurchasingStore.SelectedItem;
                        theDV[0]["DispensingStore"] = cmbDispensing.SelectedItem;
                        theDV[0]["Status"]          = ddlStatus.SelectedItem;
                    }
                }
                else
                {
                    MaxPId = MaxPId + 1;
                    DataRow theDRow = DTItemlist.NewRow();
                    theDRow["StoreId"]         = txtStoreID.Text;
                    theDRow["Name"]            = txtStoreName.Text;
                    theDRow["CentralStore"]    = ddlPurchasingStore.SelectedItem;
                    theDRow["DispensingStore"] = cmbDispensing.SelectedItem;
                    theDRow["Status"]          = ddlStatus.SelectedItem;
                    theDRow["SRNo"]            = MaxPId;
                    DTItemlist.Rows.Add(theDRow);
                }
                DTItemlist.AcceptChanges();
                ShowGrid(DTItemlist);
                Clear_Form();
                PId = 0;
            }
        }
コード例 #28
0
        void theCombo_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (theGrdCombo.Focused == true && theGrdCombo.SelectedValue != null)
                {
                    if (theGrdCombo.DataSource != null && theGrdCombo.SelectedValue.GetType().ToString() != "System.Data.DataRowView")
                    {
                        string    strdrug = theGrdCombo.SelectedValue.ToString();
                        string[]  strArry = strdrug.Split('-');
                        DataTable theDT   = new DataTable();
                        theDT = dsPOItems.Tables[1].Copy();
                        DataView  dvFilteredRow = theDT.DefaultView;
                        DataTable dtRow         = new DataTable();
                        dvFilteredRow.RowFilter = "Drug_Pk=" + strArry[0];

                        dtRow = dvFilteredRow.ToTable();
                        if (dtRow.Rows.Count > 0)
                        {
                            if (!deletedGridByKey)
                            {
                                dgwItemSubitemDetails.CurrentRow.Cells["ItemCode"].Value    = dtRow.Rows[0]["DrugId"].ToString();
                                dgwItemSubitemDetails.CurrentRow.Cells["ItemTypeId"].Value  = dtRow.Rows[0]["ItemTypeId"].ToString();
                                dgwItemSubitemDetails.CurrentRow.Cells["ItemCode"].ReadOnly = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["Units"].Value       = dtRow.Rows[0]["PurchaseUnitName"].ToString();
                                dgwItemSubitemDetails.CurrentRow.Cells["Units"].ReadOnly    = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["Price"].Value       = Convert.ToDecimal(dtRow.Rows[0]["PurchaseUnitPrice"].ToString());
                                dgwItemSubitemDetails.CurrentRow.Cells["Price"].ReadOnly    = false;
                                if (Convert.ToString(dtRow.Rows[0]["QtyPerPurchaseunit"]) != "")
                                {
                                    dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].Value = Convert.ToDecimal(dtRow.Rows[0]["QtyPerPurchaseunit"].ToString());
                                }
                                else
                                {
                                    dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].Value = "";
                                }
                                dgwItemSubitemDetails.CurrentRow.Cells["UnitQuantity"].ReadOnly = true;
                                dgwItemSubitemDetails.CurrentRow.Cells["OrderQuantity"].Value   = 0;
                                dgwItemSubitemDetails.CurrentRow.Cells["TotPrice"].ReadOnly     = true;

                                dgwItemSubitemDetails.AllowUserToAddRows = true;
                                dvFilteredRow = null;
                                dtRow         = null;
                                theDT         = null;
                            }
                        }
                        else
                        {
                            if (dgwItemSubitemDetails.SelectedRows.Count > 0)
                            {
                                foreach (DataGridViewRow row in dgwItemSubitemDetails.SelectedRows)
                                {
                                    dgwItemSubitemDetails.Rows.Remove(row);
                                    //theGrdCombo.SelectedValueChanged += null;
                                    deletedGridByKey = true;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this);
                return;
            }

            finally
            {
            }
        }
コード例 #29
0
        private void mnuRefereshSystemCache_Click(object sender, EventArgs e)
        {
            #region Commented Old Code for GenerateCache
            //string strGetXMLPath = GblIQCare.GetXMLPath();
            //System.IO.FileInfo theFileInfo1 = new System.IO.FileInfo(strGetXMLPath + "\\AllMasters.con");
            //System.IO.FileInfo theFileInfo2 = new System.IO.FileInfo(strGetXMLPath + "\\DrugMasters.con");
            //System.IO.FileInfo theFileInfo3 = new System.IO.FileInfo(strGetXMLPath + "\\LabMasters.con");

            //theFileInfo1.Delete();
            //theFileInfo2.Delete();
            //theFileInfo3.Delete();

            //IIQCareSystem theCacheManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem,BusinessProcess.Security");
            //DataSet theMainDS = theCacheManager.GetSystemCache();
            //DataSet WriteXMLDS = new DataSet();

            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingType"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingTopic"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Provider"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Division"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Ward"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_District"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Reason"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Education"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Designation"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Employee"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Occupation"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Province"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Village"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Code"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVAIDSCareTypes"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARTSponsor"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisease"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Assessment"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Symptom"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Decode"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Feature"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Function"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisclosure"].Copy());
            ////WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Satellite"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LPTF"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_StoppedReason"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_facility"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVCareStatus"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_RelationshipType"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_TBStatus"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARVStatus"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LostFollowreason"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Regimen"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Store"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Supplier"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Donor"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Program"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Batch"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["VWDiseaseSymptom"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_RegimenLine"].Copy());
            //WriteXMLDS.WriteXml(strGetXMLPath + "\\AllMasters.con", XmlWriteMode.WriteSchema);

            //WriteXMLDS.Tables.Clear();
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Strength"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_FrequencyUnits"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Drug"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Generic"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_DrugType"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Frequency"].Copy());
            //WriteXMLDS.WriteXml(strGetXMLPath + "\\DrugMasters.con", XmlWriteMode.WriteSchema);

            //WriteXMLDS.Tables.Clear();
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LabTest"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_TestParameter"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_LabValue"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_ParameterResult"].Copy());
            //WriteXMLDS.Tables.Add(theMainDS.Tables["LabTestOrder"].Copy());

            //WriteXMLDS.WriteXml(strGetXMLPath + "\\LabMasters.con", XmlWriteMode.WriteSchema);
            #endregion

            /*
             * Calling generate cache from common location
             * Update By: Gaurav
             * Update Date: 8 July 2014
             */
            IQCareUtils.GenerateCache(true);
            IQCareWindowMsgBox.ShowWindow("SysCacheRefresh", this);
        }
コード例 #30
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         int iRes;
         if (txtFileName.Text.ToString() != "")
         {
             DataSet dsCollectDataToSave = new DataSet();
             dsCollectDataToSave.ReadXml(txtFileName.Text.ToString());
             IImportExportForms objImportFormDetails;
             objImportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder");
             if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms")
             {
                 string strVerName = "";
                 if (dsCollectDataToSave.Tables.Count < 11)
                 {
                     IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
                     return;
                 }
                 else if (dsCollectDataToSave.Tables.Count > 10)
                 {
                     strVerName = dsCollectDataToSave.Tables[10].Rows[0]["AppVer"].ToString();
                     if (GblIQCare.AppVersion.ToString() != strVerName)
                     {
                         IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this);
                         return;
                     }
                 }
                 for (int i = 0; i <= dsCollectDataToSave.Tables[0].Rows.Count; i++)
                 {
                     DataSet DSExitingForm = objImportFormDetails.GetImportExportFormDetail(dsCollectDataToSave.Tables[0].Rows[i]["FeatureName"].ToString());
                     if (DSExitingForm.Tables[0].Rows.Count > 0)
                     {
                         if (!CheckFormVersion(dsCollectDataToSave, DSExitingForm))
                         {
                             int result = DateTime.Compare(Convert.ToDateTime(DSExitingForm.Tables[15].Rows[0]["VersionDate"]), Convert.ToDateTime(dsCollectDataToSave.Tables[15].Rows[0]["VersionDate"]));
                             if ((Convert.ToDecimal(dsCollectDataToSave.Tables[15].Rows[0]["VersionName"]) <= Convert.ToDecimal(DSExitingForm.Tables[15].Rows[0]["VersionName"])) && (result < 0))
                             {
                                 DialogResult msgconfirm = IQCareWindowMsgBox.ShowWindow(string.Format("There are some change(s) on the Form.{0} Do you want change the Form Version?", Environment.NewLine), "?", "", this);
                                 if (msgconfirm == DialogResult.Yes)
                                 {
                                     decimal vernumber = Convert.ToDecimal(dsCollectDataToSave.Tables[15].Rows[0]["VersionName"]);
                                     vernumber = vernumber + Convert.ToDecimal(0.1);
                                     DateTime dtchng = DateTime.Parse(dsCollectDataToSave.Tables[15].Rows[0]["VersionDate"].ToString());
                                     //DateTime dt1 = DateTime.ParseExact((dtchng.Add(TimeSpan.Parse(dtdatetime.Rows[0]["Time"].ToString()))).ToString(), "dd/MM/yy hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);
                                     DSFormVerTables  = new DataSet();
                                     dtmstformversion = clsCommon.CreateMstVersionTable();
                                     DataRow drfrmver = dtmstformversion.NewRow();
                                     drfrmver["VerId"]       = 0;
                                     drfrmver["VersionName"] = vernumber.ToString();
                                     drfrmver["VersionDate"] = dtchng.ToString();
                                     drfrmver["UserId"]      = GblIQCare.AppUserId;
                                     dtmstformversion.Rows.Add(drfrmver);
                                     DSFormVerTables.Tables.Add(dtmstformversion);
                                     DSFormVerTables.Tables.Add(dtTabchanges);
                                     DSFormVerTables.Tables.Add(dtSectionchanges);
                                     DSFormVerTables.Tables.Add(dtFieldChanges);
                                     DSFormVerTables.Tables.Add(dtConFieldchanges);
                                     //return;
                                 }
                                 else
                                 {
                                     return;
                                 }
                             }
                         }
                     }
                 }
                 iRes = objImportFormDetails.ImportForms(dsCollectDataToSave, GblIQCare.AppUserId, System.Convert.ToInt32(GblIQCare.AppCountryId), DSFormVerTables);
             }
             else
             {
                 iRes = objImportFormDetails.ImportHomeForms(dsCollectDataToSave, GblIQCare.AppUserId, System.Convert.ToInt32(GblIQCare.AppCountryId));
             }
             if (iRes == 1)
             {
                 IQCareWindowMsgBox.ShowWindow("ImportSuccess", this);
                 txtFileName.Text = "";
             }
         }
         else
         {
             IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
             txtFileName.Focus();
         }
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
     }
 }