コード例 #1
0
        public int Save_Update_ARVTherapy(int patientID, int VisitID, int LocationID, Hashtable ht, int userID, int DataQualityFlag, DataTable theCustomFieldData)
        {
            int       retval          = 0;
            ClsObject FollowupManager = new ClsObject();

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                FollowupManager.Connection  = this.Connection;
                FollowupManager.Transaction = this.Transaction;

                oUtility.Init_Hashtable();
                oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                oUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString());
                oUtility.AddParameters("@ARVDateEligible", SqlDbType.DateTime, ht["DateEligible"].ToString());
                oUtility.AddParameters("@ARVEligibleThrough", SqlDbType.Int, ht["EligibleThru"].ToString());
                oUtility.AddParameters("@EligibleWHOStage", SqlDbType.Int, ht["WHOStage"].ToString());
                oUtility.AddParameters("@EligibleCD4", SqlDbType.VarChar, ht["CD4"].ToString());
                oUtility.AddParameters("@EligibleCD4percent", SqlDbType.VarChar, ht["CD4Percent"].ToString());
                oUtility.AddParameters("@ARVCohortMonth", SqlDbType.VarChar, ht["CohortMonth"].ToString());
                oUtility.AddParameters("@ARVCohortYear", SqlDbType.Int, ht["CohortYear"].ToString());
                oUtility.AddParameters("@AnotherRegimenStartDate", SqlDbType.DateTime, ht["AnotherRegimenStartDate"].ToString());
                oUtility.AddParameters("@AnotherRegimen", SqlDbType.VarChar, ht["AnotherRegimen"].ToString());
                oUtility.AddParameters("@AnotherWeight", SqlDbType.VarChar, ht["AnotherWeight"].ToString());
                oUtility.AddParameters("@AnotherHeight", SqlDbType.VarChar, ht["AnotherHeight"].ToString());
                oUtility.AddParameters("@AnotherWHOStage", SqlDbType.Int, ht["AnotherClinicalStage"].ToString());
                oUtility.AddParameters("@dataquality", SqlDbType.Int, DataQualityFlag.ToString());
                oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString());


                DataTable retvalother = (DataTable)FollowupManager.ReturnObject(oUtility.theParams, "pr_Clinical_SaveUpdateARVTherapy_Futures", ClsUtility.ObjectEnum.DataTable);

                for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    string theQuery = theCustomFieldData.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", patientID.ToString());
                    theQuery = theQuery.Replace("#88#", LocationID.ToString());
                    theQuery = theQuery.Replace("#77#", retvalother.Rows[0]["Visit_ID"].ToString());
                    //   theQuery = theQuery.Replace("#66#", "02/06/2013");
                    theQuery = theQuery.Replace("#66#", "'" + ht["visitdate"].ToString() + "'");
                    oUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)FollowupManager.ReturnObject(oUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                ////////////////////////////////
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }

            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(retval);
        }
コード例 #2
0
        public int SaveFormDetail(DataSet dsSaveFormData, DataTable dtFieldDetails, DataTable dtbusinessRules, DataSet DSFormVer)
        {
            //try
            //{
            this.Connection  = DataMgr.GetConnection();
            this.Transaction = DataMgr.BeginTransaction(this.Connection);

            ClsObject FormDetail = new ClsObject();

            FormDetail.Connection  = this.Connection;
            FormDetail.Transaction = this.Transaction;
            int     theRowAffected = 0;
            DataRow theDR;
            int     iFeatureId;
            int     iRegFlag;
            string  Pharmacy    = "";
            string  FeatureName = "";
            int     iSectionId;
            string  strTableName = string.Empty;

            //save mst_feature data
            oUtility.Init_Hashtable();
            if (dsSaveFormData.Tables[0].Rows[0]["InsertUpdateStatus"].ToString() == "I")
            {
                oUtility.AddParameters("@FeatureId", SqlDbType.Int, "0");
            }
            else
            {
                oUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["FeatureId"].ToString());
            }

            oUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Replace("'", ""));
            oUtility.AddParameters("@ReportFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ReportFlag"].ToString());
            oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["DeleteFlag"].ToString());
            oUtility.AddParameters("@AdminFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["AdminFlag"].ToString());
            //oUtility.AddParameters("@OptionalFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["OptionalFlag"].ToString());
            oUtility.AddParameters("@SystemId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["SystemId"].ToString());
            oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString());
            oUtility.AddParameters("@Published", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["Published"].ToString());
            oUtility.AddParameters("@CountryId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["CountryId"].ToString());
            oUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ModuleId"].ToString());
            oUtility.AddParameters("@MultiVisit", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["MultiVisit"].ToString());
            //theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_SaveMstFeature_Futures", ClsUtility.ObjectEnum.DataRow);
            theDR      = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveMstFeature_Futures", ClsUtility.ObjectEnum.DataRow);
            iFeatureId = System.Convert.ToInt32(theDR[0].ToString());
            iRegFlag   = System.Convert.ToInt32(theDR[2].ToString());
            Pharmacy   = theDR[1].ToString();
            if (iFeatureId != 0)
            {
                if (dtbusinessRules.Rows.Count == 0)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    oUtility.AddParameters("@BusRuleid", SqlDbType.Int, "1");
                    oUtility.AddParameters("@value", SqlDbType.Int, "1");
                    oUtility.AddParameters("@value1", SqlDbType.Int, "1");
                    oUtility.AddParameters("@UserID", SqlDbType.Int, "1");
                    oUtility.AddParameters("@setType", SqlDbType.Int, "1");
                    oUtility.AddParameters("@counter", SqlDbType.Int, "0");
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "pr_FormBuilder_DeleteFormBusinessRules", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
                for (int i = 0; i < dtbusinessRules.Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    oUtility.AddParameters("@BusRuleid", SqlDbType.Int, dtbusinessRules.Rows[i]["BusRuleId"].ToString());
                    oUtility.AddParameters("@value", SqlDbType.Int, dtbusinessRules.Rows[i]["Value"].ToString());
                    oUtility.AddParameters("@value1", SqlDbType.Int, dtbusinessRules.Rows[i]["Value1"].ToString());
                    oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString());
                    oUtility.AddParameters("@setType", SqlDbType.Int, dtbusinessRules.Rows[i]["SetType"].ToString());
                    oUtility.AddParameters("@counter", SqlDbType.Int, i.ToString());
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "pr_FormBuilder_SaveUpdateFormBusinessRules", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
            }


            string[] strFeatureName = new string[10];
            strFeatureName = dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Split(' ');
            for (int j = 0; j < strFeatureName.Length; j++)
            {
                if (j > 0)
                {
                    strTableName += "_" + strFeatureName[j];
                }
                else
                {
                    strTableName += strFeatureName[j];
                }
            }
            FeatureName  = strTableName;
            strTableName = "DTL_FBCUSTOMFIELD_" + strTableName;
            //save mst_section data

            //foreach (DataRow drFormData in dsSaveFormData.Tables[1])
            for (int i = 0; i < dsSaveFormData.Tables[1].Rows.Count; i++)
            {
                if (dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString() == "0")
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["SectionId"].ToString());
                    oUtility.AddParameters("@SectionName", SqlDbType.VarChar, dsSaveFormData.Tables[1].Rows[i]["SectionName"].ToString());
                    oUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["Sequence"].ToString());
                    oUtility.AddParameters("@CustomFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["CustomFlag"].ToString());
                    oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString());
                    oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["UserId"].ToString());
                    //oUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["FeatureId"].ToString());
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    oUtility.AddParameters("@IsGridView", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["IsGridView"].ToString());
                    //theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_SaveMstSection_Futures", ClsUtility.ObjectEnum.DataRow);
                    theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveMstSection_Futures", ClsUtility.ObjectEnum.DataRow);
                }
            }

            //save lnk_form data
            //foreach (DataRow drFormData in dsSaveFormData.Tables[2])
            for (int i = 0; i < dsSaveFormData.Tables[2].Rows.Count; i++)
            {
                oUtility.Init_Hashtable();
                oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Id"].ToString());
                oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                //oUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FeatureId"].ToString());
                if (Pharmacy.Contains("Pharmacy_") && iRegFlag == 2 && Convert.ToInt32(dsSaveFormData.Tables[2].Rows[i]["SectionId"]) == 0)
                {
                    oUtility.AddParameters("@SectionId", SqlDbType.Int, theDR[0].ToString());
                }
                else
                {
                    oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString());
                }
                oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                oUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["FieldLabel"].ToString());
                oUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Sequence"].ToString());
                oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["UserId"].ToString());
                oUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString());
                //theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_SaveLnkForm_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveLnkForm_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);

                DataView dvFilteredRow = new DataView();
                dvFilteredRow = dtFieldDetails.DefaultView;
                DataTable dtRow = new DataTable();

                if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() == "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() == "1")
                {
                    dvFilteredRow.RowFilter = "ID='71' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString();
                }
                else
                {
                    dvFilteredRow.RowFilter = "ID='" + dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() + "' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString();
                }

                dtRow = dvFilteredRow.ToTable();

                /* ----------Added by Paritosh -Implementing Grid View------------*/
                DataView dvFilteredRowGridView = new DataView();
                dvFilteredRowGridView           = dsSaveFormData.Tables[1].DefaultView;
                dvFilteredRowGridView.RowFilter = "SectionId = " + dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString();
                if (dvFilteredRowGridView[0]["IsGridView"].ToString() == "1")
                {
                    string strTableNameSection = "DTL_CUSTOMFORM_" + dvFilteredRowGridView[0]["SectionName"].ToString() + "_" + FeatureName;
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableNameSection);
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString());
                    oUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString());
                    oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_CustomTableCreationGridView_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
                /* ----------  end             ------------*/

                if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() != "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() != "1")
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString());
                    oUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString());
                    oUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString());
                    oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                    //theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_CustomTableCreation_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_CustomTableCreation_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                /*  if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() != "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() != "0")
                 * {
                 *    oUtility.Init_Hashtable();
                 *    oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                 *    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString());
                 *    oUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString());
                 *    oUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString());
                 *    oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                 *    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_CustomTableCreation_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                 * }*/
            }

            //Delete fields selected from remove field in formbuilder while in update mode
            for (int i = 0; i < dsSaveFormData.Tables[3].Rows.Count; i++)
            {
                string Tblname;

                if (iFeatureId == 126)
                {
                    Tblname = strTableName;
                }
                else if (iFeatureId == System.Convert.ToInt32(dsSaveFormData.Tables[0].Rows[0]["FeatureId"]) && iRegFlag == 2)
                {
                    Tblname = strTableName;
                }
                else
                {
                    if (dsSaveFormData.Tables[3].Rows[i]["IsGridView"].ToString() == "1")
                    {
                        Tblname = "DTL_CUSTOMFORM_" + dsSaveFormData.Tables[3].Rows[i]["SectionName"].ToString() + "_" + FeatureName;
                    }
                    else
                    {
                        Tblname = strTableName;
                    }
                }



                oUtility.Init_Hashtable();
                oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[3].Rows[i]["Id"].ToString());
                oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dsSaveFormData.Tables[3].Rows[i]["FieldName"].ToString());
                oUtility.AddParameters("@TableName", SqlDbType.VarChar, Tblname);
                //theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_RemoveFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_RemoveFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
            }

            //Delete sections selected from remove section in formbuilder while in update mode
            if (dsSaveFormData.Tables.Count > 4)
            {
                if (dsSaveFormData.Tables.Contains("MstTab"))     // || dsSaveFormData.Tables[5].TableName == "MstTab")
                {
                    for (int i = 0; i < dsSaveFormData.Tables["MstTab"].Rows.Count; i++)
                    {
                        oUtility.Init_Hashtable();
                        oUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["TabID"].ToString());
                        oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                        oUtility.AddParameters("@TabName", SqlDbType.VarChar, dsSaveFormData.Tables["MstTab"].Rows[i]["TabName"].ToString());
                        oUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["seq"].ToString());
                        oUtility.AddParameters("@Signature", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["Signature"].ToString());
                        oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["UserId"].ToString());
                        theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveMstTab_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                if (dsSaveFormData.Tables.Contains("LnkSectionTab"))     // || dsSaveFormData.Tables[6].TableName == "LnkSectionTab")
                {
                    for (int i = 0; i < dsSaveFormData.Tables["LnkSectionTab"].Rows.Count; i++)
                    {
                        oUtility.Init_Hashtable();
                        oUtility.AddParameters("@ID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["ID"].ToString());
                        oUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["TabID"].ToString());
                        oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["SectionId"].ToString());
                        oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["UserId"].ToString());
                        oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                        theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveLnkTabSection_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                if (dsSaveFormData.Tables.Contains("DeleteSection"))
                {
                    for (int i = 0; i < dsSaveFormData.Tables["DeleteSection"].Rows.Count; i++)
                    {
                        oUtility.Init_Hashtable();
                        oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables["DeleteSection"].Rows[i]["SectionId"].ToString());
                        oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                        oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                        //theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_PMTCT_RemoveSectionAndFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_RemoveSectionAndFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                if (dsSaveFormData.Tables.Contains("DeleteTab"))
                {
                    for (int i = 0; i < dsSaveFormData.Tables["DeleteTab"].Rows.Count; i++)
                    {
                        oUtility.Init_Hashtable();
                        oUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["DeleteTab"].Rows[i]["TabId"].ToString());
                        oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                        theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_RemoveTabInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
            }
            if (DSFormVer.Tables.Count > 0)
            {
                ///Save Update Form Version Masters
                if (DSFormVer.Tables[0].Rows.Count > 0)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@VerId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["VerId"].ToString());
                    oUtility.AddParameters("@VersionName", SqlDbType.Decimal, DSFormVer.Tables[0].Rows[0]["VersionName"].ToString());
                    oUtility.AddParameters("@VersionDate", SqlDbType.DateTime, DSFormVer.Tables[0].Rows[0]["VersionDate"].ToString());
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    oUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString());
                    DataRow theDRVer = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveFormVersion_Futures", ClsUtility.ObjectEnum.DataRow);
                    if (DSFormVer.Tables[1].Rows.Count > 0 && theDRVer.ItemArray.Any())
                    {
                        foreach (DataRow theDRdetails in DSFormVer.Tables[1].Rows)
                        {
                            oUtility.Init_Hashtable();
                            oUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString());
                            oUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString());
                            oUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString());
                            oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                            oUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString());
                            theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                    if (DSFormVer.Tables[2].Rows.Count > 0 && theDRVer.ItemArray.Any())
                    {
                        foreach (DataRow theDRdetails in DSFormVer.Tables[2].Rows)
                        {
                            oUtility.Init_Hashtable();
                            oUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString());
                            oUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString());
                            oUtility.AddParameters("@SectionId", SqlDbType.Decimal, theDRdetails["SectionId"].ToString());
                            oUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString());
                            oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                            oUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString());
                            theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                    if (DSFormVer.Tables[3].Rows.Count > 0 && theDRVer.ItemArray.Any())
                    {
                        foreach (DataRow theDRdetails in DSFormVer.Tables[3].Rows)
                        {
                            oUtility.Init_Hashtable();
                            oUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString());
                            oUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString());
                            oUtility.AddParameters("@SectionId", SqlDbType.Decimal, theDRdetails["SectionId"].ToString());
                            oUtility.AddParameters("@FieldId", SqlDbType.Decimal, theDRdetails["FieldId"].ToString());
                            oUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString());
                            oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                            oUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString());
                            theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                }
            }


            DataMgr.CommitTransaction(this.Transaction);
            DataMgr.ReleaseConnection(this.Connection);
            return(iFeatureId);
            // }
            //catch
            //{
            //    DataMgr.RollBackTransation(this.Transaction);
            //     throw;
            //}
            //finally
            //{
            //    if (this.Connection != null)
            //        DataMgr.ReleaseConnection(this.Connection);

            //}
        }
コード例 #3
0
ファイル: BModule.cs プロジェクト: wamathaga/IQCare
        public int SaveUpdateModuleDetail(Hashtable ht, DataTable dt, DataTable dtbusinessrules)
        {
            int ModuleID;

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                ClsObject ModuleMgr = new ClsObject();
                ModuleMgr.Connection  = this.Connection;
                ModuleMgr.Transaction = this.Transaction;


                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, ht["ModuleId"].ToString());
                ClsUtility.AddParameters("@ModuleName", SqlDbType.VarChar, ht["ModuleName"].ToString());
                ClsUtility.AddParameters("@Status", SqlDbType.Int, ht["Status"].ToString());
                ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, ht["DeleteFlag"].ToString());
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());

                ClsUtility.AddParameters("@PharmacyFlag", SqlDbType.Int, ht["PharmacyFlag"].ToString());

                DataTable theDT = (DataTable)ModuleMgr.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_SaveUpdateModule_Constella", ClsUtility.ObjectEnum.DataTable);

                ModuleID = Convert.ToInt32(theDT.Rows[0][0]);
                if (ModuleID != 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //if (dt.Rows[i]["Selected"].ToString() == "True")
                        //{
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, ModuleID.ToString());
                        ClsUtility.AddParameters("@FieldID", SqlDbType.Int, dt.Rows[i]["Id"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dt.Rows[i]["IdentifierName"].ToString());
                        ClsUtility.AddParameters("@FieldType", SqlDbType.Int, dt.Rows[i]["FieldType"].ToString());
                        ClsUtility.AddParameters("@Identifierchecked", SqlDbType.VarChar, dt.Rows[i]["Selected"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                        ClsUtility.AddParameters("@Label", SqlDbType.VarChar, dt.Rows[i]["Label"].ToString());
                        ClsUtility.AddParameters("@autopopulatenumber", SqlDbType.Int, dt.Rows[i]["autopopulatenumber"].ToString());

                        Int32 NoRowsEffected = (Int32)ModuleMgr.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_SaveUpdateModuleIdentification_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        //}
                    }
                }
                if (ModuleID != 0)
                {
                    if (dtbusinessrules.Rows.Count == 0)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, ModuleID.ToString());
                        ClsUtility.AddParameters("@BusRuleid", SqlDbType.Int, "1");
                        ClsUtility.AddParameters("@value", SqlDbType.Int, "1");
                        ClsUtility.AddParameters("@value1", SqlDbType.Int, "1");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, "1");
                        ClsUtility.AddParameters("@setType", SqlDbType.Int, "1");
                        ClsUtility.AddParameters("@counter", SqlDbType.Int, "0");

                        Int32 NoRowsEffected = (Int32)ModuleMgr.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_DeleteModuleBusinessRules", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    for (int i = 0; i < dtbusinessrules.Rows.Count; i++)
                    {
                        //if (dt.Rows[i]["Selected"].ToString() == "True")
                        //{
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, ModuleID.ToString());
                        ClsUtility.AddParameters("@BusRuleid", SqlDbType.Int, dtbusinessrules.Rows[i]["BusRuleId"].ToString());
                        ClsUtility.AddParameters("@value", SqlDbType.Int, dtbusinessrules.Rows[i]["Value"].ToString());
                        ClsUtility.AddParameters("@value1", SqlDbType.Int, dtbusinessrules.Rows[i]["Value1"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                        ClsUtility.AddParameters("@setType", SqlDbType.Int, dtbusinessrules.Rows[i]["SetType"].ToString());
                        ClsUtility.AddParameters("@counter", SqlDbType.Int, i.ToString());

                        Int32 NoRowsEffected = (Int32)ModuleMgr.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_SaveUpdateModuleBusinessRules", ClsUtility.ObjectEnum.ExecuteNonQuery);
                        //}
                    }
                }
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(ModuleID);
        }
コード例 #4
0
        //Saving and Updating

        public int Save_Update_FollowUP(int patientID, int VisitID, int LocationID, Hashtable ht, DataSet theDS_ARTFU, int VisitIE, int rdoARVSideEffectsNone, int rdoARVSideEffectsNotDocumented, int rdoOIsAIDsIllnessNone, int rdoOIsAIDsIllnessNotDocumented, int userID, Boolean Save, Boolean Update, DateTime createDate, int DataQualityFlag, DataTable theCustomFieldData)
        {
            int       retval          = 0;
            ClsObject FollowupManager = new ClsObject();

            if (createDate.Year.ToString() == "1")
            {
                createDate = Convert.ToDateTime("01-01-1900");
            }
            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                FollowupManager.Connection  = this.Connection;
                FollowupManager.Transaction = this.Transaction;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                ClsUtility.AddParameters("@HIVvisitdate", SqlDbType.DateTime, ht["Visitdate"].ToString());
                ClsUtility.AddParameters("@PrevARVsCD4", SqlDbType.Int, ht["txtpriorARVsFU"].ToString());
                ClsUtility.AddParameters("@PrevARVsCD4Date", SqlDbType.DateTime, ht["txtpriorARVsCD4DateFU"].ToString());
                ClsUtility.AddParameters("@VisitID_IE", SqlDbType.VarChar, VisitIE.ToString());
                ClsUtility.AddParameters("@Visit_typeID", SqlDbType.Int, ht["VisittypeIDFU"].ToString());
                ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, ht["Pregnant"].ToString());
                ClsUtility.AddParameters("@Delivered", SqlDbType.VarChar, ht["Delivered"].ToString());
                ClsUtility.AddParameters("@DelDate", SqlDbType.DateTime, ht["DelDate"].ToString());
                ClsUtility.AddParameters("@EDDDate", SqlDbType.DateTime, ht["EDDDate"].ToString());
                ClsUtility.AddParameters("@lmp", SqlDbType.DateTime, ht["LMPdate"].ToString());
                ClsUtility.AddParameters("@MissedLastWeek", SqlDbType.Int, ht["DosesMissedLastWeek"].ToString());
                ClsUtility.AddParameters("@MissedLastMonth", SqlDbType.Int, ht["DosesMissedLastMonth"].ToString());
                ClsUtility.AddParameters("@NumDOTPerWeek", SqlDbType.Int, ht["NumDOTPerWeek"].ToString());
                ClsUtility.AddParameters("@NumHomeVisitsPerWeek", SqlDbType.Int, ht["NumHomeVisitsPerWeek"].ToString());
                ClsUtility.AddParameters("@SupportGroup", SqlDbType.Bit, ht["SupportGroup"].ToString());
                ClsUtility.AddParameters("@InterruptedDate", SqlDbType.DateTime, ht["InterruptedDate"].ToString());
                ClsUtility.AddParameters("@InterruptedNumDays", SqlDbType.Int, ht["InterruptedNumDays"].ToString());
                ClsUtility.AddParameters("@StoppedDate", SqlDbType.DateTime, ht["stoppedDate"].ToString());
                ClsUtility.AddParameters("@StoppedNumDays", SqlDbType.Int, ht["stoppedNumDays"].ToString());
                ClsUtility.AddParameters("@HerbalMeds", SqlDbType.Bit, ht["HerbalMeds"].ToString());
                ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, ht["physTemp"].ToString());
                ClsUtility.AddParameters("@RR", SqlDbType.Decimal, ht["physRR"].ToString());
                ClsUtility.AddParameters("@HR", SqlDbType.Decimal, ht["physHR"].ToString());
                ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, ht["physBPDiastolic"].ToString());
                ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, ht["physBPSystolic"].ToString());
                ClsUtility.AddParameters("@Height", SqlDbType.Int, ht["physHeight"].ToString());
                ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, ht["physWeight"].ToString());
                ClsUtility.AddParameters("@Pain", SqlDbType.Int, ht["physExamPain"].ToString());
                ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, ht["phyWHOstage"].ToString());
                ClsUtility.AddParameters("@WABStage", SqlDbType.Int, ht["physWABStage"].ToString());
                ClsUtility.AddParameters("@ARVtherapyPlan", SqlDbType.Int, ht["ARVtherapyplan"].ToString());
                ClsUtility.AddParameters("@ARTEnddate", SqlDbType.DateTime, ht["ARTEndDate"].ToString());
                ClsUtility.AddParameters("@ARVTHerapyReasonCode", SqlDbType.Int, ht["ArvTherapyReasonCode"].ToString());
                ClsUtility.AddParameters("@TherapyOther", SqlDbType.Int, ht["ARVTherapyReasonOther"].ToString());
                ClsUtility.AddParameters("@AppExist", SqlDbType.VarChar, ht["AppExist"].ToString());
                ClsUtility.AddParameters("@VisitIDApp", SqlDbType.VarChar, Convert.ToString(ht["VisitIDApp"]));
                ClsUtility.AddParameters("@appdate", SqlDbType.DateTime, Convert.ToString(ht["appdate"]));
                ClsUtility.AddParameters("@appreason", SqlDbType.VarChar, Convert.ToString(ht["appreason"]));
                ClsUtility.AddParameters("@employeeID", SqlDbType.BigInt, ht["Signatureid"].ToString());
                ClsUtility.AddParameters("@signatureid", SqlDbType.BigInt, ht["Signatureid"].ToString());
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                ClsUtility.AddParameters("@dataquality", SqlDbType.Int, DataQualityFlag.ToString());
                ClsUtility.AddParameters("@plannotes", SqlDbType.VarChar, ht["PlanNote"].ToString());
                ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                //Ajay Kumar-05-Jan-2010 Begin
                //Clinical note added
                ClsUtility.AddParameters("@ClinicalNotes", SqlDbType.VarChar, ht["ClinicalNotes"].ToString());
                //Ajay Kumar-05-Jan-2010 End
                ClsUtility.AddParameters("@Flag", SqlDbType.Int, ht["Flag"].ToString());
                int retvalother = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_SaveUpdateFollowUp_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //if (Save == true)
                //{
                //    int retvalother = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveFollowUp_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //}
                //else if (Update == true)
                //{

                //    int retvalother = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateFollowUP_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //}

                /*Appointment Status*/

                //Updating Most Recent EmployeeID for appointment
                if (Convert.ToInt32(ht["AppExist"].ToString()) == 1)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ClsUtility.AddParameters("@Visit_pkAppID", SqlDbType.Int, VisitID.ToString());
                    ClsUtility.AddParameters("@signatureid", SqlDbType.BigInt, ht["Signatureid"].ToString());
                    int RowsAffected = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateIEAppointmentSignature_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }

                /* Reason Missed */
                if (Update == true)
                {
                    ////////Delete Statement
                    //////ClsUtility.Init_Hashtable();
                    //////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                    //////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                    //////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    //////int retvalmissed1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteMissedReason_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    //Update Statement
                    for (int i = 0; i < theDS_ARTFU.Tables[0].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        ClsUtility.AddParameters("@MissedReasonID", SqlDbType.Int, theDS_ARTFU.Tables[0].Rows[i]["MissedReasonID"].ToString());
                        ClsUtility.AddParameters("@OtherReason_Desc", SqlDbType.VarChar, theDS_ARTFU.Tables[0].Rows[i][1].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalmissed = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateMissedReason_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Save == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[0].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@MissedReasonID", SqlDbType.Int, theDS_ARTFU.Tables[0].Rows[i]["MissedReasonID"].ToString());
                        ClsUtility.AddParameters("@OtherReason_Desc", SqlDbType.VarChar, theDS_ARTFU.Tables[0].Rows[i][1].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalmissed = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveMissedReason_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                //Save and Update Complaints
                if (Save == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[1].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[1].Rows[i]["PresentComplaintsID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalcomplaint = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Update == true)
                {//pr_Clinical_DeleteFollowUP_PatientSymptoms_Constella
                    //Delete Statement
                    ////ClsUtility.Init_Hashtable();
                    ////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                    ////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                    ////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ////int retvalcomplaint1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    //Update Statement
                    for (int i = 0; i < theDS_ARTFU.Tables[1].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[1].Rows[i]["PresentComplaintsID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString());
                        int retvalcomplaint = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                //ARV Side Effects - Left
                if (Save == true)
                {
                    if (rdoARVSideEffectsNone == 31)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNone.ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoARVSideEffectsNotDocumented == 32)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNotDocumented.ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoARVSideEffectsNone == 0 && rdoARVSideEffectsNotDocumented == 0)
                    {
                        for (int i = 0; i < theDS_ARTFU.Tables[2].Rows.Count; i++)
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                            ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                            ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[2].Rows[i]["ARVSideEffectsID1"].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                            int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                }
                else if (Update == true)
                {
                    if (rdoARVSideEffectsNone == 31)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNone.ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoARVSideEffectsNotDocumented == 32)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNotDocumented.ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoARVSideEffectsNone == 0 && rdoARVSideEffectsNotDocumented == 0)
                    {
                        for (int i = 0; i < theDS_ARTFU.Tables[2].Rows.Count; i++)
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                            ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                            ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[2].Rows[i]["ARVSideEffectsID1"].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                            ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                            //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                            int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                }
                //ARV Side Effects Right
                if (Save == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[3].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[3].Rows[i]["ARVSideEffectsID2"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalarvright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Update == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[3].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[3].Rows[i]["ARVSideEffectsID2"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalarvright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                //TBScreen
                if (Save == true)
                {//pr_Clinical_SaveComplaintsIEFU_Constella
                    for (int i = 0; i < theDS_ARTFU.Tables[4].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[4].Rows[i]["TBScreenID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalTBScreen = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Update == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[4].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[4].Rows[i]["TBScreenID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalTBScreen = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                //Save OI & AIDS Defining Illness - left
                if (Save == true)
                {
                    if (rdoOIsAIDsIllnessNone == 99)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNone.ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoOIsAIDsIllnessNotDocumented == 98)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNotDocumented.ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoOIsAIDsIllnessNone == 0 && rdoOIsAIDsIllnessNotDocumented == 0)
                    {
                        for (int i = 0; i < theDS_ARTFU.Tables[5].Rows.Count; i++)
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                            ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                            ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[5].Rows[i]["OI_AIDS_ID1"].ToString());
                            ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                            ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[5].Rows[i][1].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                            int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                }

                else if (Update == true)
                {
                    ////////Delete Statement
                    ////ClsUtility.Init_Hashtable();
                    ////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                    ////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                    ////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ////int retvalAssocCondLeft1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientDisease_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                    if (rdoOIsAIDsIllnessNone == 99)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNone.ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString());
                        int retvalAssocCondLeft = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoOIsAIDsIllnessNotDocumented == 98)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNotDocumented.ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString());
                        int retvalAssocCondLeft = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    else if (rdoOIsAIDsIllnessNone == 0 && rdoOIsAIDsIllnessNotDocumented == 0)
                    {
                        for (int i = 0; i < theDS_ARTFU.Tables[5].Rows.Count; i++)
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                            ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                            ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[5].Rows[i]["OI_AIDS_ID1"].ToString());
                            ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                            ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[5].Rows[i][1].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                            ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                            ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString());
                            int retvalAssocCondLeft = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }
                    }
                }

                //Save OI & AIDS Defining Illness - right
                if (Save == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[6].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[6].Rows[i]["OI_AIDS_ID2"].ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[6].Rows[i][1].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalAssocCondright = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Update == true)
                {
                    for (int i = 0; i < theDS_ARTFU.Tables[6].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[6].Rows[i]["OI_AIDS_ID2"].ToString());
                        ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[6].Rows[i][1].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString());
                        int retvalAssocCondright = (int)FollowupManager.ReturnObjectNewImpl(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                //Saving Assessment
                if (Save == true)
                {//Save statement
                    for (int i = 0; i < theDS_ARTFU.Tables[7].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, theDS_ARTFU.Tables[7].Rows[i]["AssessmentID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        int retvalAssessment = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveAssessmentFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else if (Update == true)
                {
                    //Delete Statement
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ClsUtility.AddParameters("@plannotes", SqlDbType.VarChar, ht["PlanNote"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());

                    int retvalAssessment1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientAssessment_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                    //Update
                    for (int i = 0; i < theDS_ARTFU.Tables[7].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, theDS_ARTFU.Tables[7].Rows[i]["AssessmentID"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString());
                        int retvalAssessment = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateAssessmentFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                //// Custom Fields //////////////
                ////////////PreSet Values Used/////////////////
                /// #99# --- Ptn_Pk
                /// #88# --- LocationId
                /// #77# --- Visit_Pk
                /// #66# --- Visit_Date
                /// #55# --- Ptn_Pharmacy_Pk
                /// #44# --- OrderedByDate
                /// #33# --- LabId
                /// #22# --- TrackingId
                /// #11# --- CareEndedId
                /// #00# --- HomeVisitId
                ///////////////////////////////////////////////

                //ClsObject theCustomManager = new ClsObject();
                //Generating VisitID from ART Followup Form
                String VisitIDART = "";
                if (Save == true)
                {
                    string theSQL = string.Format("Select IDENT_CURRENT('ord_Visit')");
                    ClsUtility.Init_Hashtable();
                    DataTable DTVisitID = (DataTable)FollowupManager.ReturnObject(ClsUtility.theParams, theSQL, ClsDBUtility.ObjectEnum.DataTable);
                    VisitIDART = DTVisitID.Rows[0][0].ToString();
                }
                if (Update == true)
                {
                    VisitIDART = VisitID.ToString();
                }
                for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    string theQuery = theCustomFieldData.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", patientID.ToString());
                    theQuery = theQuery.Replace("#88#", LocationID.ToString());
                    theQuery = theQuery.Replace("#77#", VisitIDART);
                    theQuery = theQuery.Replace("#66#", "'" + ht["Visitdate"].ToString() + "'");
                    ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                ////////////////////////////////
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }

            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(retval);
        }
コード例 #5
0
ファイル: BDrug.cs プロジェクト: kiambupharmacy/IQCare
        public DataTable SavePharmacyDispense_Web(Int32 PatientId, Int32 LocationId, Int32 StoreId, Int32 UserId, int dispensedBy, string DispDate,
                                                  Int32 OrderType, Int32 ProgramId, string theRegimen, Int32 OrderId, DataTable theDT, string PharmacyRefillDate, Int32 DataStatus,
                                                  int orderedBy, string orderDate, string deleteScript, int regimenLine = 0, int regimenCode = 0, int therapyPlan = 0
                                                  , int patientClassification = 0, int isEnrolDifferenciatedCare = 0)
        {
            string    Morning, Midday, Evening, Night;
            DataTable thePharmacyDT = new DataTable();

            //Added by VY for regimen
            #region "Regimen"

            //string theRegimen = "";
            string thetmpRegimen = "";
            for (int i = 0; i < theDT.Rows.Count; i++)
            {
                if (theDT.Rows[i]["GenericAbbrevation"].ToString() != "")
                {
                    if (thetmpRegimen == "")
                    {
                        thetmpRegimen = theDT.Rows[i]["GenericAbbrevation"].ToString();
                    }
                    else
                    {
                        thetmpRegimen = String.Format("{0}/{1}", thetmpRegimen, theDT.Rows[i]["GenericAbbrevation"]);
                    }
                }
                thetmpRegimen = thetmpRegimen.Trim();
            }

            foreach (string s in thetmpRegimen.Split('/'))
            {
                if (theRegimen == "" && s != "")
                {
                    theRegimen = theRegimen + s;
                }
                else if (theRegimen != "" && s != "")
                {
                    if (!theRegimen.Contains(s))
                    {
                        theRegimen = theRegimen + "/" + s;
                    }
                }
            }
            #endregion
            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsObject theManager = new ClsObject();
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString());
                ClsUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString());
                ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, dispensedBy.ToString());
                if (DispDate.ToString() != "")
                {
                    ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString());
                }
                ClsUtility.AddParameters("@OrderType", SqlDbType.Int, OrderType.ToString());
                ClsUtility.AddParameters("@ProgramId", SqlDbType.Int, ProgramId.ToString());
                ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString());
                ClsUtility.AddParameters("@Regimen", SqlDbType.VarChar, theRegimen);
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@OrderId", SqlDbType.Int, OrderId.ToString());
                ClsUtility.AddParameters("@AppointmentDate", SqlDbType.VarChar, PharmacyRefillDate.ToString());
                ClsUtility.AddParameters("@OrderedBy", SqlDbType.Int, orderedBy.ToString());
                if (orderDate.ToString() != "")
                {
                    ClsUtility.AddParameters("@OrderDate", SqlDbType.VarChar, orderDate.ToString());
                }
                if (deleteScript != "")
                {
                    ClsUtility.AddParameters("@deleteScript", SqlDbType.VarChar, deleteScript);
                }
                ClsUtility.AddParameters("@RegimenLine", SqlDbType.Int, regimenLine.ToString());
                ClsUtility.AddParameters("@RegimenCode", SqlDbType.Int, regimenCode.ToString());
                ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, therapyPlan.ToString());

                ClsUtility.AddParameters("@PatientClassification", SqlDbType.Int, patientClassification.ToString());
                ClsUtility.AddParameters("@IsEnrolDifferenciatedCare", SqlDbType.Int, isEnrolDifferenciatedCare.ToString());

                thePharmacyDT = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrder_Web", ClsDBUtility.ObjectEnum.DataTable);


                foreach (DataRow theDR in theDT.Rows)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString());
                    ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString());
                    ClsUtility.AddParameters("@VisitId", SqlDbType.Int, thePharmacyDT.Rows[0]["VisitId"].ToString());
                    ClsUtility.AddParameters("@Ptn_Pharmacy_Pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString());
                    ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDR["DrugId"].ToString());

                    ClsUtility.AddParameters("@MorningDose", SqlDbType.Decimal, Morning = (theDR["Morning"].ToString() == "") ? "0" : theDR["Morning"].ToString());
                    ClsUtility.AddParameters("@MiddayDose", SqlDbType.Decimal, Midday   = (theDR["Midday"].ToString() == "") ? "0" : theDR["Midday"].ToString());
                    ClsUtility.AddParameters("@EveningDose", SqlDbType.Decimal, Evening = (theDR["Evening"].ToString() == "") ? "0" : theDR["Evening"].ToString());
                    ClsUtility.AddParameters("@NightDose", SqlDbType.Decimal, Night     = (theDR["Night"].ToString() == "") ? "0" : theDR["Night"].ToString());

                    ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, "0");

                    ClsUtility.AddParameters("@Prophylaxis", SqlDbType.Int, theDR["Prophylaxis"].ToString() == "True" ? "1" : "0");

                    ClsUtility.AddParameters("@BatchId", SqlDbType.Int, theDR["BatchId"].ToString());

                    if (theDR["BatchNo"].ToString().Contains("("))
                    {
                        ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString().Substring(0, theDR["BatchNo"].ToString().IndexOf('(')));
                    }
                    else
                    {
                        ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString());
                    }

                    ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString());
                    ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theDR["DispensingUnitId"].ToString());
                    if (DispDate.ToString() != "")
                    {
                        ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString());
                    }
                    ClsUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString());
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                    ClsUtility.AddParameters("@DataStatus", SqlDbType.Int, DataStatus.ToString());

                    ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, theDR["Duration"].ToString() != "" ? theDR["Duration"].ToString() : "0");
                    ClsUtility.AddParameters("@PrescribeOrderedQuantity", SqlDbType.Decimal, theDR["QtyPrescribed"].ToString() != "" ? theDR["QtyPrescribed"].ToString() : "0");
                    ClsUtility.AddParameters("@PillCount", SqlDbType.VarChar, theDR["PillCount"].ToString() == "" ? "0" : theDR["PillCount"].ToString());
                    ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString() == "True" ? "1" : "0");
                    ClsUtility.AddParameters("@PatientInstructions", SqlDbType.VarChar, theDR["Instructions"].ToString());
                    ClsUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString());

                    Int32 theRowCount = (Int32)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrderDetail_Web", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                    //Save details to dtl_PatientPharmacyOrderpartialDispense table
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString());
                    ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString());
                    ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString());
                    ClsUtility.AddParameters("@drug_pk", SqlDbType.Int, theDR["DrugId"].ToString());
                    ClsUtility.AddParameters("@batchid", SqlDbType.Int, theDR["BatchId"].ToString());
                    ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString());
                    ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, theDR["QtyDispensed"].ToString() == "" ? "0" : theDR["QtyDispensed"].ToString());
                    //ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Decimal, theDR["RefillQty"].ToString() == "" ? "0" : theDR["RefillQty"].ToString());
                    ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, dispensedBy.ToString());
                    if (DispDate.ToString() != "")
                    {
                        ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString());
                    }
                    ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString() == "True" ? "1" : "0");
                    ClsUtility.AddParameters("@comments", SqlDbType.Int, theDR["comments"].ToString());
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                    DataTable dt = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyPartialDispense_Web", ClsDBUtility.ObjectEnum.DataTable);
                }

                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(thePharmacyDT);
        }
コード例 #6
0
        public DataSet SaveUpdateKNHPeadraticFollowupData_CATab(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["visitDate"].ToString()));
                ClsUtility.AddParameters("@MedicalHistory", SqlDbType.Int, hashTable["MedicalHistory"].ToString());
                ClsUtility.AddParameters("@OtherChronicCondition", SqlDbType.VarChar, hashTable["OtherChronicCondition"].ToString());
                ClsUtility.AddParameters("@OtherMedicalHistorySpecify", SqlDbType.VarChar, hashTable["OtherMedicalHistorySpecify"].ToString());
                ClsUtility.AddParameters("@PresentingComplaintsAdditionalNotes", SqlDbType.VarChar, hashTable["PresentingComplaintsAdditionalNotes"].ToString());
                ClsUtility.AddParameters("@SchoolPerfomance", SqlDbType.Int, hashTable["SchoolPerfomance"].ToString());
                ClsUtility.AddParameters("@ImmunisationStatus", SqlDbType.Int, hashTable["ImmunisationStatus"].ToString());
                ClsUtility.AddParameters("@TBHistory", SqlDbType.Int, hashTable["TBHistory"].ToString());
                ClsUtility.AddParameters("@TBrxCompleteDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["TBrxCompleteDate"].ToString()));
                ClsUtility.AddParameters("@TBRetreatmentDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["TBRetreatmentDate"].ToString()));
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString());
                ClsUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsUtility.AddParameters("@StartTime", SqlDbType.VarChar, hashTable["starttime"].ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_KNH_PaediatricFollowup_FORM_CATab", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "")
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                        ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_Notes"].ToString());
                        ClsUtility.AddParameters("@DateField1", SqlDbType.DateTime, dtMultiSelectValues.Rows[i]["DateField1"].ToString());


                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #7
0
        public DataSet SaveUpdateKNHPeadraticFollowupData_MgtTab(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["visitDate"].ToString()));
                ClsUtility.AddParameters("@MissedDosesFUP", SqlDbType.Int, hashTable["MissedDosesFUP"].ToString());
                ClsUtility.AddParameters("@MissedDosesFUPspecify", SqlDbType.VarChar, hashTable["MissedDosesFUPspecify"].ToString());
                ClsUtility.AddParameters("@DelaysInTakingMedication", SqlDbType.Int, hashTable["DelaysInTakingMedication"].ToString());
                ClsUtility.AddParameters("@OtherShortTermEffects", SqlDbType.VarChar, hashTable["Specifyothershorttermeffects"].ToString());
                ClsUtility.AddParameters("@OtherLongtermEffects", SqlDbType.VarChar, hashTable["OtherLongtermEffects"].ToString());
                ClsUtility.AddParameters("@SpecifyLabEvaluation", SqlDbType.VarChar, hashTable["SpecifyLabEvaluation"].ToString());
                ClsUtility.AddParameters("@ARTTreatmentPlan", SqlDbType.Int, hashTable["ARTTreatmentPlan"].ToString());
                ClsUtility.AddParameters("@OtherARTStopCode", SqlDbType.VarChar, hashTable["OtherARTStopCode"].ToString());
                ClsUtility.AddParameters("@OtherEligiblethorugh", SqlDbType.VarChar, hashTable["OtherEligiblethorugh"].ToString());
                ClsUtility.AddParameters("@NumberDrugsSubstituted", SqlDbType.Int, hashTable["NumberDrugsSubstituted"].ToString());
                ClsUtility.AddParameters("@SpecifyotherARTchangereason", SqlDbType.VarChar, hashTable["SpecifyotherARTchangereason"].ToString());
                ClsUtility.AddParameters("@2ndLineRegimenSwitch", SqlDbType.Int, hashTable["2ndLineRegimenSwitch"].ToString());
                ClsUtility.AddParameters("@OIProphylaxis", SqlDbType.Int, hashTable["OIProphylaxis"].ToString());
                ClsUtility.AddParameters("@ReasonCTXpresribed", SqlDbType.Int, hashTable["ReasonCTXpresribed"].ToString());
                ClsUtility.AddParameters("@OtherOIProphylaxis", SqlDbType.VarChar, hashTable["OtherOIProphylaxis"].ToString());
                ClsUtility.AddParameters("@OtherTreatment", SqlDbType.VarChar, hashTable["OtherTreatment"].ToString());
                ClsUtility.AddParameters("@Fluconazole", SqlDbType.Int, hashTable["Fluconazole"].ToString());
                ClsUtility.AddParameters("@StartTime", SqlDbType.VarChar, hashTable["starttime"].ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString());
                ClsUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_KNH_PaediatricFollowup_FORM_MgtTab", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, hashTable["ARTTreatmentPlan"].ToString());
                ClsUtility.AddParameters("@Noofdrugssubstituted", SqlDbType.Int, hashTable["NumberDrugsSubstituted"].ToString());
                ClsUtility.AddParameters("@reasonforswitchto2ndlineregimen", SqlDbType.Int, hashTable["2ndLineRegimenSwitch"].ToString());
                ClsUtility.AddParameters("@specifyOtherEligibility", SqlDbType.Int, hashTable["OtherEligiblethorugh"].ToString());
                ClsUtility.AddParameters("@specifyotherARTchangereason", SqlDbType.Int, hashTable["SpecifyotherARTchangereason"].ToString());
                ClsUtility.AddParameters("@specifyOtherStopCode", SqlDbType.Int, hashTable["OtherARTStopCode"].ToString());

                DataSet theARTDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_ARVTherapy", ClsUtility.ObjectEnum.DataSet);

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "")
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                        ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_Notes"].ToString());
                        ClsUtility.AddParameters("@DateField1", SqlDbType.DateTime, dtMultiSelectValues.Rows[i]["DateField1"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Save_s the update_ arv therapy.
        /// </summary>
        /// <param name="patientId">The patient identifier.</param>
        /// <param name="visitId">The visit identifier.</param>
        /// <param name="locationId">The location identifier.</param>
        /// <param name="ht">The ht.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="dqFlag">The data quality flag.</param>
        /// <param name="theCustomFieldData">The custom field data.</param>
        /// <returns></returns>
        public int Save_Update_ARVTherapy(int patientId, int visitId, int locationId, Hashtable ht, int userId, int dqFlag, DataTable theCustomFieldData)
        {
            int       retval = 0;
            ClsObject obj    = new ClsObject();

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                obj.Connection  = this.Connection;
                obj.Transaction = this.Transaction;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientId.ToString());
                ClsUtility.AddParameters("@locationid", SqlDbType.Int, locationId.ToString());
                ClsUtility.AddParameters("@Visit_ID", SqlDbType.Int, visitId.ToString());
                ClsUtility.AddParameters("@ARVDateEligible", SqlDbType.DateTime, ht["DateEligible"].ToString());
                ClsUtility.AddParameters("@ARVEligibleThrough", SqlDbType.Int, ht["EligibleThru"].ToString());
                ClsUtility.AddParameters("@EligibleWHOStage", SqlDbType.Int, ht["WHOStage"].ToString());
                ClsUtility.AddParameters("@EligibleCD4", SqlDbType.VarChar, ht["CD4"].ToString());
                ClsUtility.AddParameters("@EligibleCD4percent", SqlDbType.VarChar, ht["CD4Percent"].ToString());
                ClsUtility.AddParameters("@ARVCohortMonth", SqlDbType.VarChar, ht["CohortMonth"].ToString());
                ClsUtility.AddParameters("@ARVCohortYear", SqlDbType.Int, ht["CohortYear"].ToString());
                ClsUtility.AddParameters("@AnotherRegimenStartDate", SqlDbType.DateTime, ht["AnotherRegimenStartDate"].ToString());
                ClsUtility.AddParameters("@AnotherRegimen", SqlDbType.VarChar, ht["AnotherRegimen"].ToString());
                ClsUtility.AddParameters("@AnotherWeight", SqlDbType.VarChar, ht["AnotherWeight"].ToString());
                ClsUtility.AddParameters("@AnotherHeight", SqlDbType.VarChar, ht["AnotherHeight"].ToString());
                ClsUtility.AddParameters("@AnotherWHOStage", SqlDbType.Int, ht["AnotherClinicalStage"].ToString());
                ClsUtility.AddParameters("@dataquality", SqlDbType.Int, dqFlag.ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, userId.ToString());
                if (ht.ContainsKey("MUAC") && ht["MUAC"].ToString() != "")
                {
                    ClsUtility.AddParameters("@MUAC", SqlDbType.Decimal, ht["MUAC"].ToString());
                }
                if (ht.ContainsKey("OtherCriteria") && ht["OtherCriteria"].ToString() != "")
                {
                    ClsUtility.AddParameters("@OtherEligibleCriteria", SqlDbType.VarChar, ht["OtherCriteria"].ToString());
                }
                if (ht.ContainsKey("ModuleId"))
                {
                    ClsUtility.AddExtendedParameters("@ModuleId", SqlDbType.Int, Convert.ToInt32(ht["ModuleId"]));
                }
                DataTable retvalother = (DataTable)obj.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdateARVTherapy_Futures", ClsUtility.ObjectEnum.DataTable);

                for (int i = 0; i < theCustomFieldData.Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    string theQuery = theCustomFieldData.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", patientId.ToString());
                    theQuery = theQuery.Replace("#88#", locationId.ToString());
                    theQuery = theQuery.Replace("#77#", retvalother.Rows[0]["Visit_ID"].ToString());
                    //   theQuery = theQuery.Replace("#66#", "02/06/2013");
                    theQuery = theQuery.Replace("#66#", "'" + ht["visitdate"].ToString() + "'");
                    ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)obj.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                ////////////////////////////////
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }

            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(retval);
        }
コード例 #9
0
        //Saving and Updating

        /// <summary>
        /// Save_s the update_ art care.
        /// </summary>
        /// <param name="patientId">The patient identifier.</param>
        /// <param name="visitId">The visit identifier.</param>
        /// <param name="locationId">The location identifier.</param>
        /// <param name="ht">The ht.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="dqFlag">The data quality flag.</param>
        /// <param name="theCustomDataDT">The custom data dt.</param>
        /// <returns></returns>
        public int Save_Update_ARTCare(int patientId, int visitId, int locationId, Hashtable ht, int userId, int dqFlag, DataTable theCustomDataDT)
        {
            int       retval = 0;
            DataSet   theDS;
            ClsObject FollowupManager = new ClsObject();

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                FollowupManager.Connection  = this.Connection;
                FollowupManager.Transaction = this.Transaction;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientId.ToString());
                ClsUtility.AddParameters("@locationid", SqlDbType.Int, locationId.ToString());
                ClsUtility.AddParameters("@Visit_ID", SqlDbType.Int, visitId.ToString());
                ClsUtility.AddParameters("@ARTTransferindate", SqlDbType.DateTime, ht["ARTTransferindate"].ToString());
                ClsUtility.AddParameters("@ARTTransferinfrom", SqlDbType.VarChar, ht["ARTTransferinfrom"].ToString());
                ClsUtility.AddParameters("@transferARVs", SqlDbType.VarChar, ht["transferARVs"].ToString());
                ClsUtility.AddParameters("@AnotherRegimennStartdt", SqlDbType.DateTime, ht["AnotherRegimennStartdt"].ToString());
                ClsUtility.AddParameters("@AotherRegimen", SqlDbType.VarChar, ht["AotherRegimen"].ToString());
                ClsUtility.AddParameters("@AnotherWeight", SqlDbType.VarChar, ht["AnotherWeight"].ToString());
                ClsUtility.AddParameters("@AnotherClinicalStage", SqlDbType.Int, ht["AnotherClinicalStage"].ToString());
                ClsUtility.AddParameters("@AotherCD4", SqlDbType.VarChar, ht["AotherCD4"].ToString());
                ClsUtility.AddParameters("@AnotherCD4Percent", SqlDbType.VarChar, ht["AnotherCD4Percent"].ToString());
                ClsUtility.AddParameters("@pregnant", SqlDbType.Int, ht["pregnant"].ToString());
                ClsUtility.AddParameters("@dataquality", SqlDbType.Int, dqFlag.ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, userId.ToString());


                theDS = (DataSet)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdateARTCare_Futures", ClsUtility.ObjectEnum.DataSet);

                for (int i = 0; i < theCustomDataDT.Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    string theQuery = theCustomDataDT.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", patientId.ToString());
                    theQuery = theQuery.Replace("#88#", locationId.ToString());
                    theQuery = theQuery.Replace("#77#", theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    theQuery = theQuery.Replace("#66#", "'" + System.DateTime.Now.ToString("dd-MMM-yyyy") + "'");
                    ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                ////////////////////////////////
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }

            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(retval);
        }
コード例 #10
0
ファイル: ClsObject.cs プロジェクト: wamathaga/IQCare
        public object ReturnObject(Hashtable Params, string CommandText, ClsDBUtility.ObjectEnum Obj, bool IQTools)
        {
            int            i;
            string         cmdpara, cmddbtype;
            object         cmdvalue;
            SqlCommand     theCmd  = new SqlCommand();
            SqlTransaction theTran = (SqlTransaction)this.Transaction;
            SqlConnection  cnn;

            if (null == this.Connection)
            {
                cnn = (SqlConnection)DataMgr.GetConnection();
            }
            else
            {
                cnn = (SqlConnection)this.Connection;
            }

            if (null == this.Transaction)
            {
                theCmd = new SqlCommand(CommandText, cnn);
            }
            else
            {
                theCmd = new SqlCommand(CommandText, cnn, theTran);
            }

            for (i = 1; i < Params.Count;)
            {
                cmdpara   = Params[i].ToString();
                cmddbtype = Params[i + 1].ToString();
                //if (cmddbtype.Contains("binary"))
                cmdvalue = Params[i + 2];
                //else
                //    cmdvalue = Params[i + 2].ToString();
                // theCmd.Parameters.Add(cmdpara, cmddbtype).Value = cmdvalue;
                theCmd.Parameters.AddWithValue(cmdpara, cmdvalue);//.Value = cmdvalue;
                i = i + 3;
            }

            theCmd.CommandType    = CommandType.StoredProcedure;
            theCmd.CommandTimeout = DataMgr.CommandTimeOut();
            string theSubstring = CommandText.Substring(0, 6).ToUpper();

            switch (theSubstring)
            {
            case "SELECT":
                theCmd.CommandType = CommandType.Text;
                break;

            case "UPDATE":
                theCmd.CommandType = CommandType.Text;
                break;

            case "INSERT":
                theCmd.CommandType = CommandType.Text;
                break;

            case "DELETE":
                theCmd.CommandType = CommandType.Text;
                break;

            case "TRUNCA":
                theCmd.CommandType = CommandType.Text;
                break;
            }

            theCmd.Connection = cnn;
            try
            {
                if (Obj == ClsDBUtility.ObjectEnum.DataSet)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataSet        theDS   = new DataSet();
                    theAdpt.Fill(theDS);
                    theAdpt.Dispose();
                    return(theDS);
                }

                if (Obj == ClsDBUtility.ObjectEnum.DataTable)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT);
                }

                if (Obj == ClsDBUtility.ObjectEnum.DataRow)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT.Rows[0]);
                }


                if (Obj == ClsDBUtility.ObjectEnum.ExecuteNonQuery)
                {
                    int NoRowsAffected = theCmd.ExecuteNonQuery();
                    return(NoRowsAffected);
                }
                return(0);
            }
            catch (Exception err)
            {
                throw err;
            }
            finally
            {
                if (null != cnn)
                {
                    if (null == this.Connection)
                    {
                        DataMgr.ReleaseConnection(cnn);
                    }
                }
            }
        }
コード例 #11
0
        public DataSet SaveUpdateInitialFollowupVisitData(Hashtable hashTable, DataSet dataSet, bool isUpdate, DataTable theCustomDataDT)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@dataQuality", SqlDbType.Int, hashTable["dataQuality"].ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString());

                //Appointment Scheduling
                ClsUtility.AddParameters("@visitDate", SqlDbType.DateTime, hashTable["visitDate"].ToString());
                ClsUtility.AddParameters("@TypeofVisit", SqlDbType.Int, hashTable["TypeofVisit"].ToString());
                ClsUtility.AddParameters("@Scheduled", SqlDbType.Int, hashTable["Scheduled"].ToString());
                ClsUtility.AddParameters("@treatmentSupporterName", SqlDbType.VarChar, hashTable["treatmentSupporterName"].ToString());
                ClsUtility.AddParameters("@treatmentSupporterContact", SqlDbType.VarChar, hashTable["treatmentSupporterContact"].ToString());


                //Clinical Status
                ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["physTemp"].ToString());
                ClsUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString());
                ClsUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString());
                ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString());
                ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString());


                //Pegnancy
                ClsUtility.AddParameters("@pregnant", SqlDbType.Int, hashTable["pregnant"].ToString());
                if (hashTable["pregnant"].ToString() == "89")
                {
                    ClsUtility.AddParameters("@EDD", SqlDbType.DateTime, hashTable["EDD"].ToString());
                    ClsUtility.AddParameters("@ANCNo", SqlDbType.Int, hashTable["ANCNo"].ToString());
                    ClsUtility.AddParameters("@ReferredtoPMTCT", SqlDbType.Int, hashTable["ReferredtoPMTCT"].ToString());
                }
                if (hashTable["pregnant"].ToString() == "91")
                {
                    ClsUtility.AddParameters("@DateofInducedAbortion", SqlDbType.DateTime, hashTable["DateofInducedAbortion"].ToString());
                }
                if (hashTable["pregnant"].ToString() == "92")
                {
                    ClsUtility.AddParameters("@DateofMiscarriage", SqlDbType.DateTime, hashTable["DateofMiscarriage"].ToString());
                }

                //Family planning
                ClsUtility.AddParameters("@familyPlanningStatus", SqlDbType.Int, hashTable["familyPlanningStatus"].ToString());
                if (hashTable.ContainsKey("NoFamilyPlanning"))
                {
                    ClsUtility.AddParameters("@NoFamilyPlanning", SqlDbType.Int, hashTable["NoFamilyPlanning"].ToString());
                }


                //TB
                ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString());
                if (hashTable.ContainsKey("TBStartDate"))
                {
                    ClsUtility.AddParameters("@TBRxStart", SqlDbType.DateTime, hashTable["TBStartDate"].ToString());
                }
                if (hashTable.ContainsKey("TBTreatmentNo"))
                {
                    ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString());
                }

                //Nutritional Problems
                ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString());

                //WHO Stage
                ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, hashTable["WHOStage"].ToString());

                //pharmacy
                ClsUtility.AddParameters("@CotrimoxazoleAdhere", SqlDbType.Int, hashTable["CotrimoxazoleAdhere"].ToString());
                ClsUtility.AddParameters("@ARVDrugsAdhere", SqlDbType.Int, hashTable["ARVDrugsAdhere"].ToString());
                ClsUtility.AddParameters("@WhyPooFair", SqlDbType.Int, hashTable["WhyPooFair"].ToString());
                if (hashTable.ContainsKey("reasonARVDrugsPoorFairOther"))
                {
                    ClsUtility.AddParameters("@reasonARVDrugsPoorFairOther", SqlDbType.VarChar, hashTable["reasonARVDrugsPoorFairOther"].ToString());
                }

                //Subsitutions/Interruption
                ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, hashTable["TherapyPlan"].ToString());
                ClsUtility.AddParameters("@TherapyReasonCode", SqlDbType.Int, hashTable["TherapyReasonCode"].ToString());
                ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, hashTable["TherapyOther"].ToString());
                ClsUtility.AddParameters("@PrescribedARVStartDate", SqlDbType.DateTime, hashTable["PrescribedARVStartDate"].ToString());


                ClsUtility.AddParameters("@numOfDaysHospitalized", SqlDbType.VarChar, hashTable["numOfDaysHospitalized"].ToString());
                ClsUtility.AddParameters("@nutritionalSupport", SqlDbType.Int, hashTable["nutritionalSupport"].ToString());
                ClsUtility.AddParameters("@infantFeedingOption", SqlDbType.Int, hashTable["infantFeedingOption"].ToString());

                ClsUtility.AddParameters("@attendingClinician", SqlDbType.Int, hashTable["attendingClinician"].ToString());
                ClsUtility.AddParameters("@Datenextappointment", SqlDbType.DateTime, hashTable["Datenextappointment"].ToString());



                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection  = this.Connection;
                VisitManager.Transaction = this.Transaction;
                if (!isUpdate)
                {
                    // DataSet tempDataSet;
                    theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveInitialFollowupVisit", ClsDBUtility.ObjectEnum.DataSet);
                    // visitID = (int)tempDataSet.Tables[0].Rows[0]["visitID"];
                    visitID = (int)theDS.Tables[0].Rows[0]["visitID"];

                    //Family Planning Methods
                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString());
                        ClsUtility.AddParameters("@familyPlanningMethodID", SqlDbType.Int, dataSet.Tables[0].Rows[i]["familyPlanningMethodID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareFamilyPlanning", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Potential Side Effects
                    for (int i = 0; i < dataSet.Tables[1].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@potentialSideEffectID", SqlDbType.Int, dataSet.Tables[1].Rows[i]["potentialSideEffectID"].ToString());
                        ClsUtility.AddParameters("@potentialSideEffectOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"]))) ? "" : dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePotentialSideEffect", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //New OIs Problems
                    for (int i = 0; i < dataSet.Tables[2].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@newOIsProblemID", SqlDbType.Int, dataSet.Tables[2].Rows[i]["newOIsProblemID"].ToString());
                        ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString());
                        if (hashTable.ContainsKey("TBTreatmentNo"))
                        {
                            ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString());
                        }
                        ClsUtility.AddParameters("@newOIsProblemIDOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"]))) ? "" : dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"].ToString());
                        ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareNewOIsProblem", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    //Referred To
                    for (int i = 0; i < dataSet.Tables[3].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@referredTo", SqlDbType.Int, dataSet.Tables[3].Rows[i]["referredToID"].ToString());
                        ClsUtility.AddParameters("@referredToOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[3].Rows[i]["referredToOtherID_Other"]))) ? "" : dataSet.Tables[3].Rows[i]["referredToOtherID_Other"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareARTReferredTo", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }

                    //Positive Prevention At Risk Population
                    for (int i = 0; i < dataSet.Tables[4].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@RiskPopulationID", SqlDbType.Int, dataSet.Tables[4].Rows[i]["RiskPopulationID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulation", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Positive Prevention At Risk Population Services
                    for (int i = 0; i < dataSet.Tables[5].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@PopulationServiceID", SqlDbType.Int, dataSet.Tables[5].Rows[i]["PopulationServiceID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulationServices", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Prevention with positives (PwP)
                    for (int i = 0; i < dataSet.Tables[6].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@pwpID", SqlDbType.Int, dataSet.Tables[6].Rows[i]["pwpID"].ToString());
                        ClsUtility.AddParameters("@pwpID_Other", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[6].Rows[i]["pwpID_Other"]))) ? "" : dataSet.Tables[6].Rows[i]["pwpID_Other"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePreventionwithpositives", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }


                    for (Int32 i = 0; i < theCustomDataDT.Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        string theQuery = theCustomDataDT.Rows[i]["Query"].ToString();
                        theQuery = theQuery.Replace("#99#", hashTable["patientID"].ToString());
                        theQuery = theQuery.Replace("#88#", hashTable["locationID"].ToString());
                        theQuery = theQuery.Replace("#77#", visitID.ToString());
                        theQuery = theQuery.Replace("#66#", "'" + hashTable["visitDate"].ToString() + "'");
                        ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                        int RowsAffected = (Int32)VisitManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                else
                {
                    visitID = Convert.ToInt32(hashTable["visitID"].ToString());
                    ClsUtility.AddParameters("@visitID", SqlDbType.Int, hashTable["visitID"].ToString());
                    //ClsUtility.AddParameters("@createDate", SqlDbType.DateTime, hashTable["createDate"].ToString());
                    theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateInitialFollowupVisit", ClsDBUtility.ObjectEnum.DataSet);


                    for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString());
                        ClsUtility.AddParameters("@familyPlanningMethodID", SqlDbType.Int, dataSet.Tables[0].Rows[i]["familyPlanningMethodID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareFamilyPlanning", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }


                    //Potential Side Effects


                    for (int i = 0; i < dataSet.Tables[1].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@potentialSideEffectID", SqlDbType.Int, dataSet.Tables[1].Rows[i]["potentialSideEffectID"].ToString());
                        ClsUtility.AddParameters("@potentialSideEffectOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"]))) ? "" : dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"].ToString());
                        //ClsUtility.AddParameters("@createDate", SqlDbType.DateTime, hashTable["createDate"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePotentialSideEffect", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //New OIs Problems
                    for (int i = 0; i < dataSet.Tables[2].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@newOIsProblemID", SqlDbType.Int, dataSet.Tables[2].Rows[i]["newOIsProblemID"].ToString());
                        ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString());
                        if (hashTable.ContainsKey("TBTreatmentNo"))
                        {
                            ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString());
                        }
                        ClsUtility.AddParameters("@newOIsProblemIDOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"]))) ? "" : dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"].ToString());
                        ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareNewOIsProblem", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Referred To
                    for (int i = 0; i < dataSet.Tables[3].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@referredTo", SqlDbType.Int, dataSet.Tables[3].Rows[i]["referredToID"].ToString());
                        ClsUtility.AddParameters("@referredToOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[3].Rows[i]["referredToOtherID_Other"]))) ? "" : dataSet.Tables[3].Rows[i]["referredToOtherID_Other"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareARTReferredTo", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Positive Prevention At Risk Population
                    for (int i = 0; i < dataSet.Tables[4].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@RiskPopulationID", SqlDbType.Int, dataSet.Tables[4].Rows[i]["RiskPopulationID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulation", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Positive Prevention At Risk Population Services
                    for (int i = 0; i < dataSet.Tables[5].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@PopulationServiceID", SqlDbType.Int, dataSet.Tables[5].Rows[i]["PopulationServiceID"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulationServices", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Prevention with positives (PwP)
                    for (int i = 0; i < dataSet.Tables[6].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                        ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@pwpID", SqlDbType.Int, dataSet.Tables[6].Rows[i]["pwpID"].ToString());
                        ClsUtility.AddParameters("@pwpID_Other", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[6].Rows[i]["pwpID_Other"]))) ? "" : dataSet.Tables[6].Rows[i]["pwpID_Other"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePreventionwithpositives", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    for (Int32 i = 0; i < theCustomDataDT.Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        string theQuery = theCustomDataDT.Rows[i]["Query"].ToString();
                        theQuery = theQuery.Replace("#99#", hashTable["patientID"].ToString());
                        theQuery = theQuery.Replace("#88#", hashTable["locationID"].ToString());
                        theQuery = theQuery.Replace("#77#", visitID.ToString());
                        theQuery = theQuery.Replace("#66#", "'" + hashTable["visitDate"].ToString() + "'");
                        ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                        int RowsAffected = (Int32)VisitManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #12
0
ファイル: BCustomFields.cs プロジェクト: uon-coehm/IQCare
        public int SaveCustomFields(string Lblfield, string lbldesc, int FeatureID, int SectionID, int ControlID, int UserID, int UnitFlag, int MinValue, int MaxValue, string UnitsNum, int CodeID, string DataType, string OldLabel, int multiSelect, int iSize, string decodeValues, string deleteValues, int SystemId, int rowcount)
        {
            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                ClsObject CustomFields = new ClsObject();
                CustomFields.Connection  = this.Connection;
                CustomFields.Transaction = this.Transaction;


                oUtility.Init_Hashtable();
                oUtility.AddParameters("@Label", SqlDbType.VarChar, Lblfield);
                oUtility.AddParameters("@flddesc", SqlDbType.VarChar, lbldesc);
                oUtility.AddParameters("@FeatureID", SqlDbType.Int, FeatureID.ToString() == "3" ? "4" : FeatureID.ToString());
                oUtility.AddParameters("@SectionID", SqlDbType.Int, SectionID.ToString());
                oUtility.AddParameters("@ControlID", SqlDbType.Int, ControlID.ToString());
                oUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                oUtility.AddParameters("@UnitFlag", SqlDbType.Int, UnitFlag.ToString());
                oUtility.AddParameters("@Min", SqlDbType.Int, MinValue.ToString());
                oUtility.AddParameters("@Max", SqlDbType.Int, MaxValue.ToString());
                oUtility.AddParameters("@Units", SqlDbType.VarChar, UnitsNum);
                oUtility.AddParameters("@DataType", SqlDbType.VarChar, DataType.ToString());
                oUtility.AddParameters("@OldLabel", SqlDbType.VarChar, OldLabel.ToString());
                oUtility.AddParameters("@Size", SqlDbType.Int, iSize.ToString());
                oUtility.AddParameters("@decodeValues", SqlDbType.VarChar, decodeValues.ToString());
                oUtility.AddParameters("@deleteValues", SqlDbType.VarChar, deleteValues.ToString());
                oUtility.AddParameters("@SystemId", SqlDbType.Int, SystemId.ToString());
                oUtility.AddParameters("@rowcount", SqlDbType.Int, rowcount.ToString());


                int RowsAffected = (Int32)CustomFields.ReturnObject(oUtility.theParams, "pr_Admin_CreateCustomField_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);
                //oUtility.Init_Hashtable();
                //RowsAffected = (Int32)CustomFields.ReturnObject(oUtility.theParams, "pr_CustomFieldResults_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);

                /*
                 * if (RowsAffected == 0)
                 * {
                 *  MsgBuilder theBL = new MsgBuilder();
                 *  theBL.DataElements["MessageText"] = "Error in Saving Custom Fields record. Try Again..";
                 *  AppException.Create("#C1", theBL);
                 * }
                 * else
                 * {
                 *  MsgBuilder theBL = new MsgBuilder();
                 *  theBL.DataElements["MessageText"] = "Saved Custom Fields record...";
                 *  AppException.Create("#C1", theBL);
                 * }
                 */

                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(RowsAffected);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #13
0
        public int SaveUpdateCusomtField(int ID, string FieldName, int ControlID, int DeleteFlag, int UserID, int CareEnd, int flag, string SelectList,
                                         DataTable business, int Predefined, int SystemID, DataTable dtconditionalFields, DataTable dtICD10Fields, DataSet dsFormVersionFields, int FacilityId)
        {
            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                ClsObject CustomField = new ClsObject();
                CustomField.Connection  = this.Connection;
                CustomField.Transaction = this.Transaction;
                int     theRowAffected = 0;
                DataRow theDR;



                /************   Delete Previous Business Rule **********/
                if (ID != 0 && flag != 4)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString());
                    ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString());
                    if (ControlID == 19)
                    {
                        theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_Delete_FormBuilderFieldDruglist_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    else
                    {
                        theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_Delete_FieldBusinessRule_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    if (theRowAffected == 0)
                    {
                        MsgBuilder theMsg = new MsgBuilder();
                        theMsg.DataElements["MessageText"] = "Error in Updating Custom Field. Try Again..";
                        AppException.Create("#C1", theMsg);
                    }
                }
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString());
                ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, FieldName);
                ClsUtility.AddParameters("@ControlID", SqlDbType.Int, ControlID.ToString());
                ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString());
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                ClsUtility.AddParameters("@CareEnd", SqlDbType.Int, CareEnd.ToString());
                ClsUtility.AddParameters("@flag", SqlDbType.Int, flag.ToString());
                ClsUtility.AddParameters("@SelectList", SqlDbType.VarChar, SelectList);
                ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString());
                ClsUtility.AddParameters("@SystemID", SqlDbType.Int, SystemID.ToString());
                ClsUtility.AddParameters("@FacilityID", SqlDbType.Int, FacilityId.ToString());

                theDR = (DataRow)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveUpdateCustomFields_Futures", ClsUtility.ObjectEnum.DataRow);
                int FieldID = Convert.ToInt32(theDR[0].ToString());
                if (FieldID == 0)
                {
                    MsgBuilder theBL = new MsgBuilder();
                    theBL.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again..";
                    AppException.Create("#C1", theBL);
                }

                /************************Add Business Rule*************************/
                if (ControlID == 19)
                {
                    for (int i = 0; i < business.Rows.Count; i++)
                    {
                        if (FieldName == business.Rows[i]["FieldName"].ToString())
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@FieldID", SqlDbType.Int, FieldID.ToString());
                            ClsUtility.AddParameters("@DrugId", SqlDbType.Int, business.Rows[i]["DrugId"].ToString());
                            ClsUtility.AddParameters("@DrugTypeId", SqlDbType.Int, business.Rows[i]["DrugTypeId"].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                            ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString());
                            theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SavePharmacyDrugList_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);

                            if (theRowAffected == 0)
                            {
                                MsgBuilder theMsg = new MsgBuilder();
                                theMsg.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again..";
                                AppException.Create("#C1", theMsg);
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < business.Rows.Count; i++)
                    {
                        if (FieldName == business.Rows[i]["FieldName"].ToString())
                        {
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@FieldID", SqlDbType.Int, FieldID.ToString());
                            ClsUtility.AddParameters("@BusRuleID", SqlDbType.Int, business.Rows[i]["BusRuleId"].ToString());
                            ClsUtility.AddParameters("@Value", SqlDbType.VarChar, business.Rows[i]["Value"].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                            ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString());
                            //12may2011
                            ClsUtility.AddParameters("@Value1", SqlDbType.VarChar, business.Rows[i]["Value1"].ToString());
                            theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveBusinessRules_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);

                            if (theRowAffected == 0)
                            {
                                MsgBuilder theMsg = new MsgBuilder();
                                theMsg.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again..";
                                AppException.Create("#C1", theMsg);
                            }
                        }
                    }
                }

                /**************************Add Conditional Fields*************************************/
                int Rec = 0;

                if (dtconditionalFields != null && dtconditionalFields.Rows.Count == 0)
                {
                    if (CareEnd == 0)
                    {
                        ClsUtility.Init_Hashtable();
                        string theTSQL = "";
                        if (Predefined == 1)
                        {
                            theTSQL = "delete from dbo.lnk_conditionalfields where ConFieldId =" + ID.ToString().Replace("9999", "");
                        }
                        else if (Predefined == 0)
                        {
                            theTSQL = "delete from dbo.lnk_conditionalfields where ConFieldId =" + ID.ToString().Replace("8888", "");
                        }
                        Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    else if (CareEnd == 2)
                    {
                        ClsUtility.Init_Hashtable();
                        string theTSQL = "";
                        if (Predefined == 1)
                        {
                            theTSQL = "delete from dbo.lnk_PatientRegconditionalfields where ConFieldId =" + ID.ToString().Replace("9999", "");
                        }
                        else if (Predefined == 0)
                        {
                            theTSQL = "delete from dbo.lnk_PatientRegconditionalfields where ConFieldId =" + ID.ToString().Replace("8888", "");
                        }
                        Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    else
                    {
                        ClsUtility.Init_Hashtable();

                        string theTSQL = "";
                        if (Predefined == 1)
                        {
                            theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString().Replace("9999", "");
                        }
                        else if (Predefined == 0)
                        {
                            theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString().Replace("8888", "");
                        }
                        //string theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString();
                        Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                foreach (DataRow theDRCon in dtconditionalFields.Rows)
                {
                    ClsUtility.Init_Hashtable();
                    Rec = Rec + 1;
                    if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 0)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", ""));
                    }
                    else if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 1)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", ""));
                    }
                    else if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 2)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", ""));
                    }

                    if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 0)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", ""));
                    }
                    else if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 1)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", ""));
                    }
                    else if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 2)
                    {
                        ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", ""));
                    }
                    ClsUtility.AddParameters("@SectionId", SqlDbType.Int, theDRCon["SectionId"].ToString());
                    if (CareEnd == 1)
                    {
                        //ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString());
                        if (theDRCon["Predefined"].ToString() == "1")
                        {
                            ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("9999", ""));
                        }
                        else
                        {
                            ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("8888", ""));
                        }
                    }
                    else
                    {
                        if (theDRCon["Predefined"].ToString() == "1")
                        {
                            ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("9999", ""));
                        }
                        else
                        {
                            ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("8888", ""));
                        }
                    }

                    ClsUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, theDRCon["FieldLabel"].ToString());
                    ClsUtility.AddParameters("@Predefined", SqlDbType.Int, theDRCon["Predefined"].ToString());
                    ClsUtility.AddParameters("@Seq", SqlDbType.Int, Rec.ToString());
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString());
                    ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, theDRCon["SectionName"].ToString());
                    ClsUtility.AddParameters("@Conpredefine", SqlDbType.Int, theDRCon["Conpredefine"].ToString());
                    if (Rec == 1)
                    {
                        ClsUtility.AddParameters("@Delete", SqlDbType.Int, "1");
                    }
                    ClsUtility.AddParameters("@CareEnd", SqlDbType.Int, CareEnd.ToString());
                    theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SavelnkConditionalForm_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
                int Deleted = 0;
                foreach (DataRow theDRCon in dtICD10Fields.Rows)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@FieldId", SqlDbType.Int, FieldID.ToString());
                    ClsUtility.AddParameters("@BlockId", SqlDbType.Int, theDRCon["BlockId"].ToString().Replace("'", ""));
                    ClsUtility.AddParameters("@SubBlockId", SqlDbType.Int, theDRCon["SubBlockId"].ToString().Replace("'", ""));
                    ClsUtility.AddParameters("@CodeId", SqlDbType.Int, theDRCon["CodeId"].ToString().Replace("'", ""));
                    ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString());
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString());
                    ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, theDRCon["Deleteflag"].ToString());
                    ClsUtility.AddParameters("@Chapterid", SqlDbType.Int, theDRCon["ChapterId"].ToString().Replace("'", ""));
                    theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveICD10CodeItems_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    Deleted        = 1;
                }

                /**************************************************************************************/
                /**************************Add Form Version Conditional Fields *************************************/
                if (dsFormVersionFields != null && dsFormVersionFields.Tables.Count > 0 && CareEnd == 0)
                {
                    ///Save Update Form Version Masters
                    if (dsFormVersionFields.Tables[0].Rows.Count > 0 && dsFormVersionFields.Tables[1].Rows.Count > 0)
                    {
                        foreach (DataRow drfield in dsFormVersionFields.Tables[0].Rows)
                        {
                            decimal vername = Convert.ToDecimal(dsFormVersionFields.Tables[0].Rows[0]["VersionName"]) + Convert.ToDecimal(0.1);
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@VerId", SqlDbType.Int, "0");
                            ClsUtility.AddParameters("@VersionName", SqlDbType.Decimal, vername.ToString());
                            ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, drfield["FeatureId"].ToString());
                            ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString());
                            DataRow theDRVer = (DataRow)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormVersion_Futures", ClsUtility.ObjectEnum.DataRow);

                            foreach (DataRow theDRdetails in dsFormVersionFields.Tables[1].Rows)
                            {
                                ClsUtility.Init_Hashtable();
                                ClsUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString());
                                ClsUtility.AddParameters("@Predefined", SqlDbType.Decimal, theDRdetails["Predefined"].ToString());
                                ClsUtility.AddParameters("@ConPredefined", SqlDbType.Decimal, theDRdetails["ConPredefined"].ToString());
                                if (theDRdetails["ConPredefined"].ToString() == "1")
                                {
                                    ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRdetails["ConfieldId"].ToString().Replace("9999", ""));
                                }
                                else if (theDRdetails["ConPredefine"].ToString() == "0")
                                {
                                    ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRdetails["ConfieldId"].ToString().Replace("8888", ""));
                                }
                                if (theDRdetails["Predefined"].ToString() == "1")
                                {
                                    ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRdetails["FieldId"].ToString().Replace("9999", ""));
                                }
                                else if (theDRdetails["Predefined"].ToString() == "0")
                                {
                                    ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRdetails["FieldId"].ToString().Replace("8888", ""));
                                }
                                ClsUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString());
                                ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, drfield["FeatureId"].ToString());
                                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString());
                                theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormConditionalVersionDetails_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                            }
                        }
                    }
                }
                /**************************************************************************************/
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(FieldID);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #14
0
        public DataSet SaveNonARTFollowUp(int PatientID, int PharmacyID, int LocationID, int VisitID, DataSet theDS, DataTable theDT, Hashtable theHT, DateTime OrderedByDate, DateTime DispensedByDate, Boolean Signature, int EmployeeID, int UserID, Boolean flag, Boolean theHIVAssocDisease, int DataQualityFlag, DataTable theCustomFieldData)
        {
            ClsObject NonARTManager   = new ClsObject();
            int       theAffectedRows = 0;
            int       PharmacyId      = 0;

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                NonARTManager.Connection  = this.Connection;
                NonARTManager.Transaction = this.Transaction;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, PatientID.ToString());
                //Naveen-Added on 23-Aug-2010
                ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                //
                ClsUtility.AddParameters("@LocationId", SqlDbType.Int, LocationID.ToString());
                //Naveen-Added on 23-Aug-2010
                ClsUtility.AddParameters("@Visit_pk", SqlDbType.Int, VisitID.ToString());
                //
                ClsUtility.AddParameters("@OrderedBy", SqlDbType.Int, theHT["OrderBy"].ToString());
                ClsUtility.AddParameters("@OrderedByDate", SqlDbType.VarChar, OrderedByDate.ToString("dd-MMM-yyyy"));
                ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, theHT["DispensedBy"].ToString());
                ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispensedByDate.ToString("dd-MMM-yyyy"));
                ClsUtility.AddParameters("@Signature", SqlDbType.Bit, Signature.ToString());
                ClsUtility.AddParameters("@EmployeeID", SqlDbType.Int, EmployeeID.ToString());
                ClsUtility.AddParameters("@VisitType", SqlDbType.Int, theHT["VisitType"].ToString());
                ClsUtility.AddParameters("@VisitDate", SqlDbType.VarChar, Convert.ToDateTime(theHT["VisitDate"]).ToString("dd-MMM-yyyy"));
                ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, theHT["physTemp"].ToString());
                ClsUtility.AddParameters("@RR", SqlDbType.Decimal, theHT["physRR"].ToString());
                ClsUtility.AddParameters("@HR", SqlDbType.Decimal, theHT["physHR"].ToString());
                ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, theHT["physBPDiastolic"].ToString());
                ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, theHT["physBPSystolic"].ToString());
                ClsUtility.AddParameters("@Height", SqlDbType.Int, theHT["physHeight"].ToString());
                ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, theHT["physWeight"].ToString());
                ClsUtility.AddParameters("@Pain", SqlDbType.Int, theHT["phyPain"].ToString());
                ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, theHT["physWHOStage"].ToString());
                ClsUtility.AddParameters("@WABStage", SqlDbType.Int, theHT["physWABStage"].ToString());
                ClsUtility.AddParameters("@ClinicNotes", SqlDbType.VarChar, theHT["ClinicalNotes"].ToString());
                ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, theHT["Pregnant"].ToString());
                ClsUtility.AddParameters("@EDDDate", SqlDbType.VarChar, theHT["EDDDate"].ToString());
                ClsUtility.AddParameters("@Delivered", SqlDbType.Int, theHT["Delivered"].ToString());
                ClsUtility.AddParameters("@DelDate", SqlDbType.VarChar, theHT["DelDate"].ToString());

                ClsUtility.AddParameters("@LMP", SqlDbType.DateTime, theHT["LMP"].ToString());
                ClsUtility.AddParameters("@userId", SqlDbType.Int, UserID.ToString());
                ClsUtility.AddParameters("@OrderType", SqlDbType.Int, theHT["OrderType"].ToString());
                ClsUtility.AddParameters("@DataQuality", SqlDbType.Int, DataQualityFlag.ToString());
                ClsUtility.AddParameters("@AppExist", SqlDbType.VarChar, theHT["AppExist"].ToString());
                ClsUtility.AddParameters("@VisitIDApp", SqlDbType.VarChar, theHT["VisitIDApp"].ToString());
                ClsUtility.AddParameters("@appdate", SqlDbType.VarChar, theHT["AppDate"].ToString());
                ClsUtility.AddParameters("@appreason", SqlDbType.VarChar, theHT["AppReason"].ToString());
                ClsUtility.AddParameters("@signatureid", SqlDbType.VarChar, theHT["Signatureid"].ToString());
                ClsUtility.AddParameters("@Flag", SqlDbType.Int, theHT["Flag"].ToString());
                //ClsUtility.AddParameters("@UpdateMode", SqlDbType.Int, UpdateMode.ToString());
                ////if (flag == false)
                ////{
                ////    theDSResult = (DataSet)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveNonARTFollowUP_Constella", ClsDBUtility.ObjectEnum.DataSet);
                ////    PharmacyId = Convert.ToInt32(theDSResult.Tables[0].Rows[0][0].ToString());

                ////}
                ////else if (flag == true)
                ////{

                string strResult = string.Empty;

                int theResult = 0;
                ////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                ////ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                theDSResult = (DataSet)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdateNonARTFollowUP_Constella", ClsDBUtility.ObjectEnum.DataSet);
                strResult   = Convert.ToString(theDSResult.Tables[0].Rows[0][0]);
                VisitID     = Convert.ToInt32(theDSResult.Tables[1].Rows[0][1]);
                if (theDSResult.Tables[0].Rows.Count > 0)
                {
                    if (strResult == "")
                    {
                        theResult = 0;
                    }
                    else
                    {
                        if (PharmacyID == 0)
                        {
                            theResult  = Convert.ToInt32(theDSResult.Tables[0].Rows[0][0].ToString());
                            PharmacyID = Convert.ToInt32(theDSResult.Tables[0].Rows[0][0].ToString());
                        }
                    }
                }
                ////}
                if (theDSResult.Tables[0].Rows[0][0].ToString() == "")
                {
                    MsgBuilder theBL = new MsgBuilder();
                    theBL.DataElements["MessageText"] = "Error in Saving Patient's Non-ART Follow-Up Details. Try Again..";
                    Exception ex = AppException.Create("#C1", theBL);
                    throw ex;
                }
                //Updating Appointment Status
                #region "Updating Appointment Status"

                if (Convert.ToInt32(theHT["AppExist"].ToString()) == 1)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, PatientID.ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ClsUtility.AddParameters("@Visit_pkAppID", SqlDbType.Int, VisitID.ToString());
                    ClsUtility.AddParameters("@signatureid", SqlDbType.Int, theHT["OrderBy"].ToString());
                    int RowsAffected = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateIEAppointmentSignature_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }

                #endregion

                #region "Patient's Symptoms"

                //if (flag == true)
                //{
                //    /***************** Delete Previous Symptoms Records *******************/
                //    ClsUtility.Init_Hashtable();
                //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                //    ClsUtility.AddParameters("@patientid", SqlDbType.Int, PatientID.ToString());
                //    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientSymptoms_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //    if (theAffectedRows == 0)
                //    {
                //        MsgBuilder theMsg = new MsgBuilder();
                //        theMsg.DataElements["MessageText"] = "Error in Updating Patient's Symptoms Details for Non-ART FollowUp. Try Again..";
                //        Exception ex = AppException.Create("#C1", theMsg);
                //        throw ex;
                //    }

                //}

                if (theDS.Tables[0].Rows.Count != 0)
                {
                    for (int i = 0; i < theDS.Tables[0].Rows.Count; i++)
                    {
                        theAffectedRows = 0;
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@symptomID", SqlDbType.Int, theDS.Tables[0].Rows[i]["PresentComplaintsID"].ToString());
                        ClsUtility.AddParameters("@userID", SqlDbType.Int, UserID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        //if (flag == false)
                        //{
                        //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        //}
                        //else if (flag == true)
                        //{
                        //ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        //theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        //}
                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's Symptoms Details for Non-ART Follow-Up. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }
                #endregion
                #region "Patient TB Symptoms"
                //if (flag == true)
                //{
                //    /***************** Delete Previous Symptoms Records *******************/
                //    ClsUtility.Init_Hashtable();
                //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                //    ClsUtility.AddParameters("@patientid", SqlDbType.Int, PatientID.ToString());
                //    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientSymptoms_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //    if (theAffectedRows == 0)
                //    {
                //        MsgBuilder theMsg = new MsgBuilder();
                //        theMsg.DataElements["MessageText"] = "Error in Updating Patient's TBSymptoms Details for Non-ART FollowUp. Try Again..";
                //        Exception ex = AppException.Create("#C1", theMsg);
                //        throw ex;
                //    }

                //}

                if (theDS.Tables[5].Rows.Count != 0)
                {
                    for (int i = 0; i < theDS.Tables[5].Rows.Count; i++)
                    {
                        theAffectedRows = 0;
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@symptomID", SqlDbType.Int, theDS.Tables[5].Rows[i]["TBSymptomsID"].ToString());
                        ClsUtility.AddParameters("@userID", SqlDbType.Int, UserID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);


                        //if (flag == false)
                        //{
                        //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        //}
                        //else if (flag == true)
                        //{
                        //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //    ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        //}
                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's TB Symptoms Details for Non-ART Follow-Up. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }
                #endregion


                #region "Patient's HIV Associated Diseases"

                //if (flag == true)
                //{
                //    /******************* Delete Previous HIV Associated Diseases Details *******************/
                //    theAffectedRows = 0;
                //    ClsUtility.Init_Hashtable();
                //    ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                //    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteMedicalHistoryIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                //    if (theAffectedRows == 0)
                //    {
                //        MsgBuilder theMsg = new MsgBuilder();
                //        theMsg.DataElements["MessageText"] = "Error in Updating Patient's HIV Associated Diseases Details for Non-ART FollowUp. Try Again..";
                //        Exception ex = AppException.Create("#C1", theMsg);
                //        throw ex;
                //    }
                //}

                if (theDS.Tables[2].Rows.Count != 0)
                {
                    for (int i = 0; i < theDS.Tables[2].Rows.Count; i++)
                    {
                        theAffectedRows = 0;
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS.Tables[2].Rows[i][0].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS.Tables[2].Rows[i][1].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, theDS.Tables[2].Rows[i][2].ToString());
                        ClsUtility.AddParameters("@userID", SqlDbType.Int, UserID.ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateNonARTFollowUpHIVAssoCondition_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);


                        //if (flag == false)
                        //{
                        //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVAssoConditionNonARTFollowUp_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        //}
                        //else if (flag == true)
                        //{
                        //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                        //    ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                        //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateNonARTFollowUpHIVAssoCondition_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        //}

                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's HIV Associated Diseases Details for Non-ART Follow-Up. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }

                if (theHIVAssocDisease == true)
                {
                    if (theDS.Tables[3].Rows.Count != 0)
                    {
                        for (int i = 0; i < theDS.Tables[3].Rows.Count; i++)
                        {
                            theAffectedRows = 0;
                            ClsUtility.Init_Hashtable();
                            ClsUtility.AddParameters("@PatientID", SqlDbType.Int, PatientID.ToString());
                            ClsUtility.AddParameters("@Locationid", SqlDbType.Int, LocationID.ToString());
                            ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS.Tables[3].Rows[i][0].ToString());
                            ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS.Tables[3].Rows[i][1].ToString());
                            ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, theDS.Tables[3].Rows[i][2].ToString());
                            ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                            ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                            //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                            theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateNonARTFollowUpHIVAssoCondition_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);


                            //if (flag == false)
                            //{
                            //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVAssoConditionNonARTFollowUp_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                            //}
                            //else if (flag == true)
                            //{
                            //    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                            //    ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, "");
                            //    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateNonARTFollowUpHIVAssoCondition_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                            //}

                            if (theAffectedRows == 0)
                            {
                                MsgBuilder theMsg = new MsgBuilder();
                                theMsg.DataElements["MessageText"] = "Error in Saving Patient's HIV Associated Diseases Details for Non-ART Follow-Up. Try Again..";
                                Exception ex = AppException.Create("#C1", theMsg);
                                throw ex;
                            }
                        }
                    }
                }
                #endregion

                #region "Assessments"

                if (flag == true)
                {
                    /****************** Delete Previous Assessments *******************/
                    theAffectedRows = 0;
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                    ClsUtility.AddParameters("@plannotes", SqlDbType.VarChar, "");
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientAssessment_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    if (theAffectedRows == 0)
                    {
                        MsgBuilder theMsg = new MsgBuilder();
                        theMsg.DataElements["MessageText"] = "Error in Updating Patient's Assessments Details for Non-ART FollowUp. Try Again..";
                        Exception ex = AppException.Create("#C1", theMsg);
                        throw ex;
                    }
                }

                if (theDS.Tables[1].Rows.Count != 0)
                {
                    for (int i = 0; i < theDS.Tables[1].Rows.Count; i++)
                    {
                        theAffectedRows = 0;
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientID", SqlDbType.Int, PatientID.ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString());
                        ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, theDS.Tables[1].Rows[i]["AssessmentID"].ToString());
                        ClsUtility.AddParameters("@userID", SqlDbType.Int, UserID.ToString());

                        if (flag == false)
                        {
                            theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveAssessmentFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }
                        else if (flag == true)
                        {
                            ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString());
                            ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ""); //createdate.ToString());
                            //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, theHT["CreateDate"].ToString()); //createdate.ToString());
                            theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateAssessmentFU_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        }

                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's Assessments Details for Non-ART Follow-Up. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }
                #endregion

                #region "Drugs Details"
                if (flag == true)
                {
                    /***************** Delete Previous Drugs Records *******************/
                    //theAffectedRows = 0;
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                    theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Pharmacy_DeletePharmacyDetail_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    if (theAffectedRows == 0)
                    {
                        MsgBuilder theMsg = new MsgBuilder();
                        theMsg.DataElements["MessageText"] = "Error in Updating Patient's Pharmacy Details for Non-ART FollowUp. Try Again..";
                        Exception ex = AppException.Create("#C1", theMsg);
                        throw ex;
                    }
                }
                if (theDS.Tables[4].Rows.Count != 0)
                {
                    for (int i = 0; i < theDS.Tables[4].Rows.Count; i++)
                    {
                        theAffectedRows = 0;
                        int     theFinanced = 99999;
                        int     theUnit     = 99999;
                        Decimal theDose     = 99999;
                        ClsUtility.Init_Hashtable();

                        ClsUtility.AddParameters("@GenericID", SqlDbType.Int, theDS.Tables[4].Rows[i]["GenericID"].ToString());
                        ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDS.Tables[4].Rows[i]["DrugID"].ToString());
                        ClsUtility.AddParameters("@StrengthID", SqlDbType.Int, theDS.Tables[4].Rows[i]["Strength"].ToString());
                        ClsUtility.AddParameters("@FrequencyID", SqlDbType.Int, theDS.Tables[4].Rows[i]["Frequency"].ToString());
                        ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, theDS.Tables[4].Rows[i]["Duration"].ToString());
                        ClsUtility.AddParameters("@OrderedQuantity", SqlDbType.Decimal, theDS.Tables[4].Rows[i]["QtyPrescribed"].ToString());
                        ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Decimal, theDS.Tables[4].Rows[i]["QtyDispensed"].ToString());
                        ClsUtility.AddParameters("@Finance", SqlDbType.Int, theFinanced.ToString());
                        ClsUtility.AddParameters("@UnitId", SqlDbType.Int, theUnit.ToString());
                        ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, theDose.ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());

                        if (flag == false)
                        {
                            ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, theDSResult.Tables[0].Rows[0][0].ToString());
                        }
                        else if (flag == true)
                        {
                            ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                        }
                        theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveNonARTDrugDetails_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's Pharmacy Details for Non-ART FollowUp. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }

                /***************Save Other OI *****************/

                if (theDT.Rows.Count != 0)
                {
                    for (int i = 0; i < theDT.Rows.Count; i++)
                    {
                        theAffectedRows = 0;

                        ClsUtility.Init_Hashtable();

                        ClsUtility.AddParameters("@GenericID", SqlDbType.Int, theDT.Rows[i]["GenericID"].ToString());
                        ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDT.Rows[i]["DrugID"].ToString());
                        ClsUtility.AddParameters("@StrengthID", SqlDbType.Int, theDT.Rows[i]["StrengthId"].ToString());
                        ClsUtility.AddParameters("@FrequencyID", SqlDbType.Int, theDT.Rows[i]["FrequencyId"].ToString());
                        ClsUtility.AddParameters("@Duration", SqlDbType.Int, theDT.Rows[i]["Duration"].ToString());
                        ClsUtility.AddParameters("@OrderedQuantity", SqlDbType.Int, theDT.Rows[i]["QtyPrescribed"].ToString());
                        ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, theDT.Rows[i]["QtyDispensed"].ToString());
                        ClsUtility.AddParameters("@Finance", SqlDbType.Int, theDT.Rows[i]["Financed"].ToString());
                        ClsUtility.AddParameters("@UnitId", SqlDbType.Int, theDT.Rows[i]["UnitId"].ToString());
                        ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, theDT.Rows[i]["Dose"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());

                        if (flag == false)
                        {
                            ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, theDSResult.Tables[0].Rows[0][0].ToString());
                        }
                        else if (flag == true)
                        {
                            ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                        }
                        theAffectedRows = (int)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveNonARTDrugDetails_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                        if (theAffectedRows == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving Patient's Pharmacy Details for Non-ART FollowUp. Try Again..";
                            Exception ex = AppException.Create("#C1", theMsg);
                            throw ex;
                        }
                    }
                }

                #endregion


                #region "Custom Fields"
                //// Custom Fields //////////////
                ////////////PreSet Values Used/////////////////
                /// #99# --- Ptn_Pk
                /// #88# --- LocationId
                /// #77# --- Visit_Pk
                /// #66# --- Visit_Date
                /// #55# --- Ptn_Pharmacy_Pk
                /// #44# --- OrderedByDate
                /// #33# --- LabId
                /// #22# --- TrackingId
                /// #11# --- CareEndedId
                /// #00# --- HomeVisitId
                ///////////////////////////////////////////////

                //ClsObject theCustomManager = new ClsObject();
                //Generating VisitID from IE Form
                //String VisitIDNonART = "";
                //if (flag == false)
                //{
                //    string theSQL = string.Format("Select IDENT_CURRENT('ord_Visit')");
                //    ClsUtility.Init_Hashtable();
                //    DataTable DTVisitID = (DataTable)NonARTManager.ReturnObject(ClsUtility.theParams, theSQL, ClsDBUtility.ObjectEnum.DataTable);
                //    VisitIDNonART = DTVisitID.Rows[0][0].ToString();
                //}
                //if (flag == true)
                //{
                //    VisitIDNonART = VisitID.ToString();
                //}
                for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    string theQuery = theCustomFieldData.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", PatientID.ToString());
                    theQuery = theQuery.Replace("#88#", LocationID.ToString());
                    theQuery = theQuery.Replace("#77#", VisitID.ToString());
                    theQuery = theQuery.Replace("#66#", "'" + theHT["VisitDate"].ToString() + "'");
                    ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)NonARTManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                ////////////////////////////////
                #endregion
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(theDSResult);
            }
            catch (Exception err)
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw err;
            }
            finally
            {
                NonARTManager = null;
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #15
0
        public DataSet SaveUpdateKNHPeadraticFollowupData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@visitDate", SqlDbType.DateTime, hashTable["visitDate"].ToString());
                ClsUtility.AddParameters("@ChildAccompaniedByCaregiver", SqlDbType.Int, hashTable["ChildAccompaniedByCaregiver"].ToString());
                ClsUtility.AddParameters("@TreatmentSupporterRelationship", SqlDbType.Int, hashTable["TreatmentSupporterRelationship"].ToString());
                ClsUtility.AddParameters("@AddressChanged", SqlDbType.Int, hashTable["AddressChanged"].ToString());
                ClsUtility.AddParameters("@AddressChange", SqlDbType.VarChar, hashTable["AddressChange"].ToString());
                ClsUtility.AddParameters("@PhoneNoChange", SqlDbType.VarChar, hashTable["PhoneNoChange"].ToString());
                ClsUtility.AddParameters("@PrimaryCareGiver", SqlDbType.VarChar, hashTable["PrimaryCareGiver"].ToString());
                ClsUtility.AddParameters("@DisclosureStatus", SqlDbType.Int, hashTable["DisclosureStatus"].ToString());
                ClsUtility.AddParameters("@ReasonNotDisclosed", SqlDbType.VarChar, hashTable["ReasonNotDisclosed"].ToString());
                ClsUtility.AddParameters("@OtherDisclosureReason", SqlDbType.VarChar, hashTable["OtherDisclosureReason"].ToString());
                ClsUtility.AddParameters("@HighestLevelAttained", SqlDbType.Int, hashTable["HighestLevelAttained"].ToString());
                ClsUtility.AddParameters("@HIVSupportGroupMembership", SqlDbType.VarChar, hashTable["HIVSupportGroupMembership"].ToString());
                ClsUtility.AddParameters("@HealthEducation", SqlDbType.Int, hashTable["HealthEducation"].ToString());
                ClsUtility.AddParameters("@FatherAlive2", SqlDbType.Int, hashTable["FatherAlive2"].ToString());
                ClsUtility.AddParameters("@DateOfDeathFather", SqlDbType.DateTime, hashTable["DateOfDeathFather"].ToString());
                ClsUtility.AddParameters("@MotherAlive2", SqlDbType.Int, hashTable["MotherAlive2"].ToString());
                ClsUtility.AddParameters("@DateOfDeathMother", SqlDbType.DateTime, hashTable["DateOfDeathMother"].ToString());
                ClsUtility.AddParameters("@MedicalHistory", SqlDbType.Int, hashTable["MedicalHistory"].ToString());
                ClsUtility.AddParameters("@OtherMedicalHistorySpecify", SqlDbType.VarChar, hashTable["OtherMedicalHistorySpecify"].ToString());

                ClsUtility.AddParameters("@OtherChronicCondition", SqlDbType.VarChar, hashTable["OtherChronicCondition"].ToString());
                //ClsUtility.AddParameters("@PresentingComplaintsAdditionalNotes", SqlDbType.VarChar, hashTable["PresentingComplaintsAdditionalNotes"].ToString());
                ClsUtility.AddParameters("@SchoolPerfomance", SqlDbType.Int, hashTable["SchoolPerfomance"].ToString());
                ClsUtility.AddParameters("@ImmunisationStatus", SqlDbType.Int, hashTable["ImmunisationStatus"].ToString());
                ClsUtility.AddParameters("@TBHistory", SqlDbType.Int, hashTable["TBHistory"].ToString());
                ClsUtility.AddParameters("@TBrxCompleteDate", SqlDbType.DateTime, hashTable["TBrxCompleteDate"].ToString());
                ClsUtility.AddParameters("@TBRetreatmentDate", SqlDbType.DateTime, hashTable["TBRetreatmentDate"].ToString());
                ClsUtility.AddParameters("@TissueBiopsyTest", SqlDbType.Int, hashTable["TissueBiopsyTest"].ToString());
                ClsUtility.AddParameters("@TBFindings", SqlDbType.Int, hashTable["TBFindings"].ToString());
                ClsUtility.AddParameters("@SputumSmear", SqlDbType.Int, hashTable["SputumSmear"].ToString());
                ClsUtility.AddParameters("@TissueBiopsy", SqlDbType.Int, hashTable["TissueBiopsy"].ToString());
                ClsUtility.AddParameters("@ChestXRay", SqlDbType.Int, hashTable["ChestXRay"].ToString());
                ClsUtility.AddParameters("@CXR", SqlDbType.Int, hashTable["CXR"].ToString());
                ClsUtility.AddParameters("@OtherCXR", SqlDbType.VarChar, hashTable["OtherCXR"].ToString());
                ClsUtility.AddParameters("@TissueBiopsyResults", SqlDbType.VarChar, hashTable["TissueBiopsyResults"].ToString());
                ClsUtility.AddParameters("@TBTypePeads", SqlDbType.Int, hashTable["TBTypePeads"].ToString());
                ClsUtility.AddParameters("@PeadsTBPatientType", SqlDbType.Int, hashTable["PeadsTBPatientType"].ToString());
                ClsUtility.AddParameters("@TBPlan", SqlDbType.Int, hashTable["TBPlan"].ToString());
                ClsUtility.AddParameters("@OtherTBPlan", SqlDbType.VarChar, hashTable["OtherTBPlan"].ToString());
                ClsUtility.AddParameters("@TBRegimen", SqlDbType.Int, hashTable["TBRegimen"].ToString());
                ClsUtility.AddParameters("@OtherTBRegimen", SqlDbType.VarChar, hashTable["OtherTBRegimen"].ToString());
                ClsUtility.AddParameters("@TBRegimenStartDate", SqlDbType.DateTime, hashTable["TBRegimenStartDate"].ToString());
                ClsUtility.AddParameters("@TBRegimenEndDate", SqlDbType.DateTime, hashTable["TBRegimenEndDate"].ToString());
                ClsUtility.AddParameters("@TBTreatmentOutcomesPeads", SqlDbType.Int, hashTable["TBTreatmentOutcomesPeads"].ToString());
                ClsUtility.AddParameters("@NoTB", SqlDbType.Int, hashTable["NoTB"].ToString());
                ClsUtility.AddParameters("@ReminderIPT", SqlDbType.Int, hashTable["ReminderIPT"].ToString());
                ClsUtility.AddParameters("@INHStartDate", SqlDbType.DateTime, hashTable["INHStartDate"].ToString());
                ClsUtility.AddParameters("@INHEndDate", SqlDbType.DateTime, hashTable["INHEndDate"].ToString());
                ClsUtility.AddParameters("@PyridoxineStartDate", SqlDbType.DateTime, hashTable["PyridoxineStartDate"].ToString());
                ClsUtility.AddParameters("@PyridoxineEndDate", SqlDbType.DateTime, hashTable["PyridoxineEndDate"].ToString());
                ClsUtility.AddParameters("@TBAdherenceAssessed", SqlDbType.Int, hashTable["TBAdherenceAssessed"].ToString());
                ClsUtility.AddParameters("@ReferredForAdherence", SqlDbType.Int, hashTable["ReferredForAdherence"].ToString());
                ClsUtility.AddParameters("@OtherTBsideEffects", SqlDbType.VarChar, hashTable["OtherTBsideEffects"].ToString());
                ClsUtility.AddParameters("@StopINH", SqlDbType.Int, hashTable["StopINH"].ToString());
                ClsUtility.AddParameters("@StopINHDate", SqlDbType.DateTime, hashTable["StopINHDate"].ToString());
                ClsUtility.AddParameters("@ContactsScreenedForTB", SqlDbType.Int, hashTable["ContactsScreenedForTB"].ToString());
                ClsUtility.AddParameters("@TBnotScreenedSpecify", SqlDbType.VarChar, hashTable["TBnotScreenedSpecify"].ToString());
                ClsUtility.AddParameters("@LongTermMedications", SqlDbType.Int, hashTable["LongTermMedications"].ToString());
                ClsUtility.AddParameters("@MultivitaminsDate", SqlDbType.DateTime, hashTable["MultivitaminsDate"].ToString());
                ClsUtility.AddParameters("@SulfaTMPDate", SqlDbType.DateTime, hashTable["SulfaTMPDate"].ToString());
                ClsUtility.AddParameters("@TBRxDate", SqlDbType.DateTime, hashTable["TBRxDate"].ToString());
                ClsUtility.AddParameters("@HormonalContraceptivesDate", SqlDbType.DateTime, hashTable["HormonalContraceptivesDate"].ToString());
                ClsUtility.AddParameters("@AntifungalsDate", SqlDbType.DateTime, hashTable["AntifungalsDate"].ToString());
                ClsUtility.AddParameters("@AnticonvulsantsDate", SqlDbType.DateTime, hashTable["AnticonvulsantsDate"].ToString());
                ClsUtility.AddParameters("@OtherLongTermMedications", SqlDbType.VarChar, hashTable["OtherLongTermMedications"].ToString());
                ClsUtility.AddParameters("@OtherCurrentLongTermMedications", SqlDbType.VarChar, hashTable["OtherCurrentLongTermMedications"].ToString());
                //ClsUtility.AddParameters("@MilestoneAppropriate", SqlDbType.Int, hashTable["MilestoneAppropriate"].ToString());
                ClsUtility.AddParameters("@ResonMilestoneInappropriate", SqlDbType.VarChar, hashTable["ResonMilestoneInappropriate"].ToString());
                ClsUtility.AddParameters("@OtherGeneralConditions", SqlDbType.VarChar, hashTable["OtherGeneralConditions"].ToString());
                ClsUtility.AddParameters("@OtherAbdomenConditions", SqlDbType.VarChar, hashTable["OtherAbdomenConditions"].ToString());
                ClsUtility.AddParameters("@OtherCardiovascularConditions", SqlDbType.VarChar, hashTable["OtherCardiovascularConditions"].ToString());
                ClsUtility.AddParameters("@OtherOralCavityConditions", SqlDbType.VarChar, hashTable["OtherOralCavityConditions"].ToString());
                ClsUtility.AddParameters("@OtherGenitourinaryConditions", SqlDbType.VarChar, hashTable["OtherGenitourinaryConditions"].ToString());
                ClsUtility.AddParameters("@OtherCNSConditions", SqlDbType.VarChar, hashTable["OtherCNSConditions"].ToString());
                ClsUtility.AddParameters("@OtherChestLungsConditions", SqlDbType.VarChar, hashTable["OtherChestLungsConditions"].ToString());
                ClsUtility.AddParameters("@OtherSkinConditions", SqlDbType.VarChar, hashTable["OtherSkinConditions"].ToString());
                ClsUtility.AddParameters("@OtherMedicalConditionNotes", SqlDbType.VarChar, hashTable["OtherMedicalConditionNotes"].ToString());
                ClsUtility.AddParameters("@ProgressionInWHOstage", SqlDbType.VarChar, hashTable["ProgressionInWHOstage"].ToString());
                ClsUtility.AddParameters("@SpecifyWHOprogression", SqlDbType.VarChar, hashTable["SpecifyWHOprogression"].ToString());
                ClsUtility.AddParameters("@CurrentlyOnHAART", SqlDbType.Int, hashTable["CurrentlyOnHAART"].ToString());
                ClsUtility.AddParameters("@CurrentARTRegimenLine", SqlDbType.Int, hashTable["CurrentARTRegimenLine"].ToString());
                ClsUtility.AddParameters("@CurrentARTRegimen", SqlDbType.Int, hashTable["CurrentARTRegimen"].ToString());
                ClsUtility.AddParameters("@OtherARTRegimen", SqlDbType.VarChar, hashTable["OtherARTRegimen"].ToString());
                ClsUtility.AddParameters("@CurrentARTRegimenDate", SqlDbType.DateTime, hashTable["CurrentARTRegimenDate"].ToString());
                ClsUtility.AddParameters("@OIProphylaxis", SqlDbType.Int, hashTable["OIProphylaxis"].ToString());
                ClsUtility.AddParameters("@ReasonCTXpresribed", SqlDbType.Int, hashTable["ReasonCTXpresribed"].ToString());
                ClsUtility.AddParameters("@OtherOIProphylaxis", SqlDbType.VarChar, hashTable["OtherOIProphylaxis"].ToString());
                ClsUtility.AddParameters("@OtherTreatment", SqlDbType.VarChar, hashTable["OtherTreatment"].ToString());
                ClsUtility.AddParameters("@MissedDosesFUP", SqlDbType.Int, hashTable["MissedDosesFUP"].ToString());
                ClsUtility.AddParameters("@MissedDosesFUPspecify", SqlDbType.VarChar, hashTable["MissedDosesFUPspecify"].ToString());
                ClsUtility.AddParameters("@DelaysInTakingMedication", SqlDbType.Int, hashTable["DelaysInTakingMedication"].ToString());
                ClsUtility.AddParameters("@ARVSideEffects", SqlDbType.Int, hashTable["ARVSideEffects"].ToString());
                ClsUtility.AddParameters("@Specifyothershorttermeffects", SqlDbType.VarChar, hashTable["Specifyothershorttermeffects"].ToString());
                ClsUtility.AddParameters("@listlongtermeffect", SqlDbType.VarChar, hashTable["listlongtermeffect"].ToString());
                ClsUtility.AddParameters("@HAARTImpression", SqlDbType.Int, hashTable["HAARTImpression"].ToString());
                ClsUtility.AddParameters("@HAARTexperienced", SqlDbType.Int, hashTable["HAARTexperienced"].ToString());
                ClsUtility.AddParameters("@OtherHAARTImpression", SqlDbType.VarChar, hashTable["OtherHAARTImpression"].ToString());
                ClsUtility.AddParameters("@ReviewedPreviousResults", SqlDbType.Int, hashTable["ReviewedPreviousResults"].ToString());
                ClsUtility.AddParameters("@ResultsReviewComments", SqlDbType.VarChar, hashTable["ResultsReviewComments"].ToString());
                ClsUtility.AddParameters("@HIVRelatedOI", SqlDbType.VarChar, hashTable["HIVRelatedOI"].ToString());
                ClsUtility.AddParameters("@NonHIVRelatedOI", SqlDbType.VarChar, hashTable["NonHIVRelatedOI"].ToString());
                ClsUtility.AddParameters("@LabEvaluationPeads", SqlDbType.Int, hashTable["LabEvaluationPeads"].ToString());
                ClsUtility.AddParameters("@OtherCounselling", SqlDbType.VarChar, hashTable["OtherCounselling"].ToString());
                ClsUtility.AddParameters("@AdditionalPsychosocialAssessment", SqlDbType.VarChar, hashTable["AdditionalPsychosocialAssessment"].ToString());
                ClsUtility.AddParameters("@ARTTreatmentPlan", SqlDbType.Int, hashTable["ARTTreatmentPlan"].ToString());
                ClsUtility.AddParameters("@SubstituteRegimenDrug", SqlDbType.VarChar, hashTable["SubstituteRegimenDrug"].ToString());
                ClsUtility.AddParameters("@SpecifyotherARTchangereason", SqlDbType.VarChar, hashTable["SpecifyotherARTchangereason"].ToString());
                ClsUtility.AddParameters("@2ndLineRegimenSwitch", SqlDbType.Int, hashTable["2ndLineRegimenSwitch"].ToString());
                ClsUtility.AddParameters("@RegimenPrescribed", SqlDbType.Int, hashTable["RegimenPrescribed"].ToString());
                ClsUtility.AddParameters("@OtherRegimenPrescribed", SqlDbType.VarChar, hashTable["OtherRegimenPrescribed"].ToString());
                ClsUtility.AddParameters("@rdoSexualOrientation", SqlDbType.Int, hashTable["rdoSexualOrientation"].ToString());
                ClsUtility.AddParameters("@SexualOrientation", SqlDbType.Int, hashTable["SexualOrientation"].ToString());
                ClsUtility.AddParameters("@KnowSexualPartnerHIVStatus", SqlDbType.Int, hashTable["KnowSexualPartnerHIVStatus"].ToString());
                ClsUtility.AddParameters("@PartnerHIVStatus", SqlDbType.Int, hashTable["PartnerHIVStatus"].ToString());
                ClsUtility.AddParameters("@LMPassessed", SqlDbType.Int, hashTable["LMPassessed"].ToString());
                ClsUtility.AddParameters("@LMPDate", SqlDbType.DateTime, hashTable["LMPDate"].ToString());
                ClsUtility.AddParameters("@LMPNotaccessedReason", SqlDbType.Int, hashTable["LMPNotaccessedReason"].ToString());
                ClsUtility.AddParameters("@pregnant", SqlDbType.Int, hashTable["pregnant"].ToString());
                ClsUtility.AddParameters("@EDD", SqlDbType.DateTime, hashTable["EDD"].ToString());
                ClsUtility.AddParameters("@GivenPWPMessages", SqlDbType.Int, hashTable["GivenPWPMessages"].ToString());
                ClsUtility.AddParameters("@UnsafeSexImportanceExplained", SqlDbType.Int, hashTable["UnsafeSexImportanceExplained"].ToString());
                ClsUtility.AddParameters("@CondomsIssued", SqlDbType.Int, hashTable["CondomsIssued"].ToString());
                ClsUtility.AddParameters("@ReasonfornotIssuingCondoms", SqlDbType.VarChar, hashTable["ReasonfornotIssuingCondoms"].ToString());
                ClsUtility.AddParameters("@STIscreenedPeads", SqlDbType.Int, hashTable["STIscreenedPeads"].ToString());
                ClsUtility.AddParameters("@UrethralDischarge", SqlDbType.Int, hashTable["UrethralDischarge"].ToString());
                ClsUtility.AddParameters("@VaginalDischarge", SqlDbType.Int, hashTable["VaginalDischarge"].ToString());
                ClsUtility.AddParameters("@GenitalUlceration", SqlDbType.Int, hashTable["GenitalUlceration"].ToString());
                ClsUtility.AddParameters("@STItreatmentPlan", SqlDbType.VarChar, hashTable["STItreatmentPlan"].ToString());
                ClsUtility.AddParameters("@CervicalCancerScreened", SqlDbType.Int, hashTable["CervicalCancerScreened"].ToString());
                ClsUtility.AddParameters("@CervicalCancerScreeningResults", SqlDbType.Int, hashTable["CervicalCancerScreeningResults"].ToString());
                ClsUtility.AddParameters("@ReferredForCervicalCancerScreening", SqlDbType.Int, hashTable["ReferredForCervicalCancerScreening"].ToString());
                ClsUtility.AddParameters("@HPVOffered", SqlDbType.Int, hashTable["HPVOffered"].ToString());
                ClsUtility.AddParameters("@OfferedHPVaccine", SqlDbType.Int, hashTable["OfferedHPVaccine"].ToString());
                ClsUtility.AddParameters("@HPVDoseDate", SqlDbType.DateTime, hashTable["HPVDoseDate"].ToString());
                ClsUtility.AddParameters("@OtherPwPInteventions", SqlDbType.VarChar, hashTable["OtherPwPInteventions"].ToString());
                ClsUtility.AddParameters("@WardAdmission", SqlDbType.Int, hashTable["WardAdmission"].ToString());
                ClsUtility.AddParameters("@ReferredTo", SqlDbType.Int, hashTable["ReferredTo"].ToString());
                ClsUtility.AddParameters("@SpecifyOtherReferredTo", SqlDbType.Int, hashTable["SpecifyOtherReferredTo"].ToString());
                ClsUtility.AddParameters("@ScheduledAppointment", SqlDbType.VarChar, hashTable["ScheduledAppointment"].ToString());
                ClsUtility.AddParameters("@Otherappointmentreason", SqlDbType.VarChar, hashTable["Otherappointmentreason"].ToString());


                if (hashTable["Temp"].ToString() != "")
                {
                    ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["Temp"].ToString());
                }
                if (hashTable["RR"].ToString() != "")
                {
                    ClsUtility.AddParameters("@RR", SqlDbType.Decimal, hashTable["RR"].ToString());
                }
                if (hashTable["HR"].ToString() != "")
                {
                    ClsUtility.AddParameters("@HR", SqlDbType.Decimal, hashTable["HR"].ToString());
                }
                if (hashTable["height"].ToString() != "")
                {
                    ClsUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString());
                }
                if (hashTable["weight"].ToString() != "")
                {
                    ClsUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString());
                }
                if (hashTable["BPDiastolic"].ToString() != "")
                {
                    ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString());
                }
                if (hashTable["BPSystolic"].ToString() != "")
                {
                    ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString());
                }

                ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString());
                ClsUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_KNH_PaediatricFollowup_FORM", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "")
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #16
0
ファイル: BMigration.cs プロジェクト: wamathaga/IQCare-4.X.0
        public int UpsizeData(DataTable theDT, DataTable tblDataTypes, string DBName, string TableName)
        {
            //////SqlConnection theCon = (SqlConnection)Entity.GetConnection(ConStr);
            //////SqlTransaction theTran = theCon.BeginTransaction();

            int i = 0;

            /////////////////////////////
            //StreamWriter theWriter = new StreamWriter("c:\\miglog.txt");
            //theWriter = File.AppendText("c:\\miglog.txt");
            ////////////////////////////

            try
            {
                //////this.Connection = theCon;
                //////this.Transaction = theTran;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                //////Entity theObject = new Entity();
                //////theObject.Connection = this.Connection;
                //////theObject.Transaction = this.Transaction;
                ClsObject objUpsize = new ClsObject();
                objUpsize.Connection  = this.Connection;
                objUpsize.Transaction = this.Transaction;

                /////// Table Creation//////
                string ColumnList = "";
                foreach (DataColumn theCol in theDT.Columns)
                {
                    DataView theDV = new DataView(tblDataTypes);
                    theDV.RowFilter = "COLUMN_NAME ='" + theCol.ColumnName.ToString() + "'";

                    if (ColumnList == "")
                    {
                        ColumnList = "[" + theCol.ColumnName.ToString() + "]";
                        if (theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString() != "")
                        {
                            ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString());
                        }
                        else
                        {
                            ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["NUMERIC_PRECISION"].ToString());
                        }
                    }
                    else
                    {
                        ColumnList = ColumnList + "," + "[" + theCol.ColumnName.ToString() + "]";
                        if (theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString() != "")
                        {
                            ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString());
                        }
                        else
                        {
                            ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["NUMERIC_PRECISION"].ToString());
                        }
                    }
                }
                string cmd = "create table " + TableName + "( " + ColumnList + ")";
                ClsUtility.Init_Hashtable();
                int RowsAffected = (Int32)objUpsize.ReturnObject(ClsUtility.theParams, cmd, ClsDBUtility.ObjectEnum.ExecuteNonQuery);


                ////////////////////////////////

                ////////////////////////////////
                /////Export Data/////////////
                ColumnList = "";
                cmd        = "";
                string theColumns = "";
                foreach (DataRow theDR in theDT.Rows)
                {
                    cmd        = "insert into " + TableName + " values(";
                    theColumns = "";
                    for (i = 0; i < theDT.Columns.Count; i++)
                    {
                        if (theColumns == "")
                        {
                            theColumns = FString(theDR[i].ToString());
                        }
                        else
                        {
                            theColumns = theColumns + "," + FString(theDR[i].ToString());
                        }
                    }
                    cmd = cmd + theColumns + ")";
                    ClsUtility.Init_Hashtable();
                    RowsAffected = (Int32)objUpsize.ReturnObject(ClsUtility.theParams, cmd, ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                //////theTran.Commit();
                //////theCon.Close();
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(RowsAffected);
            }
            ////////////////////////////////
            //////catch (SqlException ex)
            catch
            {
                //theWriter.WriteLine(ex.Message.ToString()+"-"+ TableName + "-" + i.ToString());
                //////theTran.Rollback();
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #17
0
        public DataSet SaveUpdateKNHPeadraticFollowupData_TriageTab(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["visitDate"].ToString()));
                ClsUtility.AddParameters("@ChildAccompaniedByCaregiver", SqlDbType.Int, hashTable["ChildAccompaniedByCaregiver"].ToString());
                ClsUtility.AddParameters("@TreatmentSupporterRelationship", SqlDbType.Int, hashTable["TreatmentSupporterRelationship"].ToString());
                ClsUtility.AddParameters("@PrimaryCareGiver", SqlDbType.VarChar, hashTable["PrimaryCareGiver"].ToString());
                ClsUtility.AddParameters("@DisclosureStatus", SqlDbType.Int, hashTable["DisclosureStatus"].ToString());
                ClsUtility.AddParameters("@ReasonNotDisclosed", SqlDbType.VarChar, hashTable["ReasonNotDisclosed"].ToString());
                ClsUtility.AddParameters("@OtherDisclosureReason", SqlDbType.VarChar, hashTable["OtherDisclosureReason"].ToString());
                ClsUtility.AddParameters("@FatherAlive2", SqlDbType.Int, hashTable["FatherAlive2"].ToString());
                ClsUtility.AddParameters("@DateOfDeathFather", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["DateOfDeathFather"].ToString()));
                ClsUtility.AddParameters("@MotherAlive2", SqlDbType.Int, hashTable["MotherAlive2"].ToString());
                ClsUtility.AddParameters("@DateOfDeathMother", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["DateOfDeathMother"].ToString()));
                ClsUtility.AddParameters("@HealthEducation", SqlDbType.Int, hashTable["HealthEducation"].ToString());
                ClsUtility.AddParameters("@SchoolingStatus", SqlDbType.Int, hashTable["SchoolingStatus"].ToString());
                ClsUtility.AddParameters("@HighestLevelAttained", SqlDbType.Int, hashTable["HighestLevelAttained"].ToString());
                ClsUtility.AddParameters("@HIVSupportGroup", SqlDbType.Int, hashTable["HIVSupportGroup"].ToString());
                ClsUtility.AddParameters("@HIVSupportGroupMembership", SqlDbType.VarChar, hashTable["HIVSupportGroupMembership"].ToString());
                ClsUtility.AddParameters("@AddressChanged", SqlDbType.Int, hashTable["AddressChanged"].ToString());
                ClsUtility.AddParameters("@AddressChange", SqlDbType.VarChar, hashTable["AddressChange"].ToString());
                ClsUtility.AddParameters("@PhoneNoChange", SqlDbType.VarChar, hashTable["PhoneNoChange"].ToString());
                ClsUtility.AddParameters("@NursesComments", SqlDbType.VarChar, hashTable["NursesComments"].ToString());

                if (hashTable["Temp"].ToString() != "")
                {
                    ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["Temp"].ToString());
                }
                if (hashTable["RR"].ToString() != "")
                {
                    ClsUtility.AddParameters("@RR", SqlDbType.Decimal, hashTable["RR"].ToString());
                }
                if (hashTable["HR"].ToString() != "")
                {
                    ClsUtility.AddParameters("@HR", SqlDbType.Decimal, hashTable["HR"].ToString());
                }
                if (hashTable["height"].ToString() != "")
                {
                    ClsUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString());
                }
                if (hashTable["weight"].ToString() != "")
                {
                    ClsUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString());
                }
                if (hashTable["BPDiastolic"].ToString() != "")
                {
                    ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString());
                }
                if (hashTable["BPSystolic"].ToString() != "")
                {
                    ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString());
                }
                if (hashTable["HeadCircumference"].ToString() != "")
                {
                    ClsUtility.AddParameters("@HeadCircumference", SqlDbType.Decimal, hashTable["HeadCircumference"].ToString());
                }
                if (hashTable["WeightForAge"].ToString() != "")
                {
                    ClsUtility.AddParameters("@WeightForAge", SqlDbType.Decimal, hashTable["WeightForAge"].ToString());
                }
                if (hashTable["WeightForHeight"].ToString() != "")
                {
                    ClsUtility.AddParameters("WeightForHeight", SqlDbType.Int, hashTable["WeightForHeight"].ToString());
                }
                ClsUtility.AddParameters("@StartTime", SqlDbType.VarChar, hashTable["starttime"].ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString());
                ClsUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_KNH_PaediatricFollow_FORM_TriageTab", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "")
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                        ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_Notes"].ToString());
                        ClsUtility.AddParameters("@DateField1", SqlDbType.DateTime, dtMultiSelectValues.Rows[i]["DateField1"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #18
0
        public int UpdateICDCodeRecord(string Id, Hashtable theHT, ArrayList theAL)
        {
            String    TableName     = "mst_" + theHT["TableName"].ToString();
            ClsObject CustomManager = new ClsObject();

            try
            {
                this.Connection           = DataMgr.GetConnection();
                CustomManager.Connection  = this.Connection;
                this.Transaction          = DataMgr.BeginTransaction(this.Connection);
                CustomManager.Transaction = this.Transaction;
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, TableName);
                ClsUtility.AddParameters("@Id", SqlDbType.Int, Id.ToString());
                ClsUtility.AddParameters("@Name", SqlDbType.VarChar, theHT["Name"].ToString());
                ClsUtility.AddParameters("@Code", SqlDbType.VarChar, "");
                ClsUtility.AddParameters("@Stage", SqlDbType.VarChar, theHT["Stage"].ToString());
                ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, theHT["Status"].ToString());
                ClsUtility.AddParameters("@Sequence", SqlDbType.Int, theHT["Sequence"].ToString());
                ClsUtility.AddParameters("@Category", SqlDbType.Int, theHT["Category"].ToString());
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString());
                ClsUtility.AddParameters("@SystemId", SqlDbType.Int, theHT["SystemId"].ToString());
                ClsUtility.AddParameters("@CID", SqlDbType.Int, theHT["CountryID"].ToString());
                Int32 RowsAffected = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomListMasters_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);

                String DiseaseId = Convert.ToString(Id);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@DiseaseId", SqlDbType.Int, DiseaseId);
                ClsUtility.AddParameters("@ICDCodeId", SqlDbType.Int, theHT["ICDCode"].ToString());
                ClsUtility.AddParameters("@Validate", SqlDbType.Int, theHT["Validate"].ToString());
                if (Convert.ToInt32(theHT["Code"]) == 31)
                {
                    ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "1");
                }
                else
                {
                    ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "0");
                }
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString());
                int RowsAffectedICDCode = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomMastersLinkICDCodes_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                int CountFlag           = 0;
                foreach (String AR in theAL)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@DiseaseId", SqlDbType.Int, DiseaseId);
                    ClsUtility.AddParameters("@CountFlag", SqlDbType.Int, CountFlag.ToString());
                    ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, AR);
                    ClsUtility.AddParameters("@ICDCodeId", SqlDbType.Int, theHT["ICDCode"].ToString());
                    if (Convert.ToInt32(theHT["Code"]) == 31)
                    {
                        ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "1");
                    }
                    else
                    {
                        ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "0");
                    }
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString());
                    int RowsAffectedModuleICDCode = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomMastersLinkModuleICDCodes_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    CountFlag++;
                }
                DataMgr.CommitTransaction(this.Transaction);
                return(RowsAffectedICDCode);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                CustomManager = null;
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #19
0
        public DataSet SaveUpdateKNHPeadraticFollowupData_ExamTab(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString());
                ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["visitDate"].ToString()));
                ClsUtility.AddParameters("@OtherCurrentLongTermMedications", SqlDbType.VarChar, hashTable["OtherCurrentLongTermMedications"].ToString());
                ClsUtility.AddParameters("@MilestoneAppropriate", SqlDbType.Int, hashTable["MilestoneAppropriate"].ToString());
                ClsUtility.AddParameters("@ResonMilestoneInappropriate", SqlDbType.VarChar, hashTable["ResonMilestoneInappropriate"].ToString());
                ClsUtility.AddParameters("@OtherGeneralConditions", SqlDbType.VarChar, hashTable["OtherGeneralConditions"].ToString());
                ClsUtility.AddParameters("@OtherAbdomenConditions", SqlDbType.VarChar, hashTable["OtherAbdomenConditions"].ToString());
                ClsUtility.AddParameters("@OtherCardiovascularConditions", SqlDbType.VarChar, hashTable["OtherCardiovascularConditions"].ToString());
                ClsUtility.AddParameters("@OtherOralCavityConditions", SqlDbType.VarChar, hashTable["OtherOralCavityConditions"].ToString());
                ClsUtility.AddParameters("@OtherGenitourinaryConditions", SqlDbType.VarChar, hashTable["OtherGenitourinaryConditions"].ToString());
                ClsUtility.AddParameters("@OtherCNSConditions", SqlDbType.VarChar, hashTable["OtherCNSConditions"].ToString());
                ClsUtility.AddParameters("@OtherChestLungsConditions", SqlDbType.VarChar, hashTable["OtherChestLungsConditions"].ToString());
                ClsUtility.AddParameters("@OtherSkinConditions", SqlDbType.VarChar, hashTable["OtherSkinConditions"].ToString());
                ClsUtility.AddParameters("@OtherMedicalConditionNotes", SqlDbType.VarChar, hashTable["OtherMedicalConditionNotes"].ToString());
                ClsUtility.AddParameters("@ProgressionInWHOstage", SqlDbType.Int, hashTable["ProgressionInWHOstage"].ToString());
                ClsUtility.AddParameters("@SpecifyWHOprogression", SqlDbType.VarChar, hashTable["SpecifyWHOprogression"].ToString());
                ClsUtility.AddParameters("@WABStage", SqlDbType.Int, hashTable["WABStage"].ToString());
                ClsUtility.AddParameters("@CurrentWHOStage", SqlDbType.Int, hashTable["CurrentWHOStage"].ToString());
                ClsUtility.AddParameters("@Menarche", SqlDbType.Int, hashTable["Menarche"].ToString());
                ClsUtility.AddParameters("@MenarcheDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["MenarcheDate"].ToString()));
                ClsUtility.AddParameters("@TannerStaging", SqlDbType.Int, hashTable["TannerStaging"].ToString());
                ClsUtility.AddParameters("@Impression", SqlDbType.Int, hashTable["Impression"].ToString());
                ClsUtility.AddParameters("@OtherImpression", SqlDbType.VarChar, hashTable["OtherImpression"].ToString());
                ClsUtility.AddParameters("@reviewprevresult", SqlDbType.Int, hashTable["reviewprevresult"].ToString());
                ClsUtility.AddParameters("@additonalinformation", SqlDbType.Int, hashTable["additonalinformation"].ToString());
                ClsUtility.AddParameters("@HIVRelatedOI", SqlDbType.VarChar, hashTable["HIVRelatedOI"].ToString());
                ClsUtility.AddParameters("@NonHIVRelatedOI", SqlDbType.Int, hashTable["NonHIVRelatedOI"].ToString());


                ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString());
                ClsUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsUtility.AddParameters("@StartTime", SqlDbType.VarChar, hashTable["starttime"].ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_KNH_PaediatricFollowup_FORM_ExamTab", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "")
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                        ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                        ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                        ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_Notes"].ToString());
                        ClsUtility.AddParameters("@DateField1", SqlDbType.DateTime, dtMultiSelectValues.Rows[i]["DateField1"].ToString());
                        int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #20
0
        public DataSet SaveUpdate(String Insert, DataSet DS, int TabId)
        {
            DataSet theDS = new DataSet();

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsObject CustomMgrSave = new ClsObject();
                CustomMgrSave.Connection  = this.Connection;
                CustomMgrSave.Transaction = this.Transaction;
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Insert", SqlDbType.VarChar, Insert.ToString());
                theDS = (DataSet)CustomMgrSave.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveCustomForm_Constella", ClsUtility.ObjectEnum.DataSet);

                int LabID = Convert.ToInt32(theDS.Tables[2].Rows[0]["LabID"]);
                for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@LabID", SqlDbType.Int, LabID.ToString());
                    ClsUtility.AddParameters("@LocationID", SqlDbType.Int, theDS.Tables[2].Rows[0]["LocationId"].ToString());
                    ClsUtility.AddParameters("@LabTestID", SqlDbType.Int, DS.Tables[0].Rows[i]["LabTestId"].ToString());
                    ClsUtility.AddParameters("@ParameterID", SqlDbType.Int, DS.Tables[0].Rows[i]["LabParameterId"].ToString());
                    ClsUtility.AddParameters("@TestResults", SqlDbType.Decimal, DS.Tables[0].Rows[i]["LabResult"].ToString());
                    ClsUtility.AddParameters("@TestResults1", SqlDbType.Decimal, DS.Tables[0].Rows[i]["LabResult1"].ToString());
                    ClsUtility.AddParameters("@Financed", SqlDbType.Int, DS.Tables[0].Rows[i]["Financed"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, theDS.Tables[2].Rows[0]["UserId"].ToString());
                    ClsUtility.AddParameters("@TabId", SqlDbType.Int, TabId.ToString());
                    ClsUtility.AddParameters("@Flag", SqlDbType.VarChar, "Lab");
                    int retvaldisclose = (Int32)CustomMgrSave.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveCustomFormLabPharmacyRegimen_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                int PharmacyID = Convert.ToInt32(theDS.Tables[1].Rows[0]["PharmacyID"]);
                for (int i = 0; i < DS.Tables[1].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                    ClsUtility.AddParameters("@Drug_Id", SqlDbType.Int, DS.Tables[1].Rows[i]["DrugId"].ToString());
                    ClsUtility.AddParameters("@GenericID", SqlDbType.Int, DS.Tables[1].Rows[i]["GenericId"].ToString());
                    ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, DS.Tables[1].Rows[i]["Dose"].ToString());
                    ClsUtility.AddParameters("@FrequencyID", SqlDbType.Int, DS.Tables[1].Rows[i]["FrequencyId"].ToString());
                    ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, DS.Tables[1].Rows[i]["Duration"].ToString());
                    ClsUtility.AddParameters("@StrengthID", SqlDbType.Int, "0");
                    ClsUtility.AddParameters("@QtyPrescribed", SqlDbType.Decimal, DS.Tables[1].Rows[i]["QtyPrescribed"].ToString());
                    ClsUtility.AddParameters("@QtyDispensed", SqlDbType.Decimal, DS.Tables[1].Rows[i]["QtyDispensed"].ToString());
                    ClsUtility.AddParameters("@ARFinance", SqlDbType.Int, DS.Tables[1].Rows[i]["ARFinance"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, theDS.Tables[1].Rows[0]["UserID"].ToString());
                    ClsUtility.AddParameters("@TabId", SqlDbType.Int, TabId.ToString());
                    ClsUtility.AddParameters("@Flag", SqlDbType.VarChar, "ARVDrug");
                    int retvaldisclose = (Int32)CustomMgrSave.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveCustomFormLabPharmacyRegimen_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                for (int i = 0; i < DS.Tables[2].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, PharmacyID.ToString());
                    ClsUtility.AddParameters("@Drug_Id", SqlDbType.Int, DS.Tables[2].Rows[i]["DrugId"].ToString());
                    ClsUtility.AddParameters("@GenericID", SqlDbType.Int, DS.Tables[2].Rows[i]["GenericId"].ToString());
                    ClsUtility.AddParameters("@UnitId", SqlDbType.Int, DS.Tables[2].Rows[i]["UnitId"].ToString());
                    ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, DS.Tables[2].Rows[i]["SingleDose"].ToString());
                    ClsUtility.AddParameters("@FrequencyID", SqlDbType.Int, DS.Tables[2].Rows[i]["FrequencyID"].ToString());
                    ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, DS.Tables[2].Rows[i]["Duration"].ToString());
                    ClsUtility.AddParameters("@QtyPrescribed", SqlDbType.Decimal, DS.Tables[2].Rows[i]["QtyOrdered"].ToString());
                    ClsUtility.AddParameters("@QtyDispensed", SqlDbType.Decimal, DS.Tables[2].Rows[i]["QtyDispensed"].ToString());
                    ClsUtility.AddParameters("@ARFinance", SqlDbType.Int, DS.Tables[2].Rows[i]["ARFinance"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, theDS.Tables[1].Rows[0]["UserID"].ToString());
                    ClsUtility.AddParameters("@TabId", SqlDbType.Int, TabId.ToString());
                    ClsUtility.AddParameters("@Flag", SqlDbType.VarChar, "NonARVDrug");
                    int retvaldisclose = (Int32)CustomMgrSave.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveCustomFormLabPharmacyRegimen_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }

            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }

            return(theDS);
        }
コード例 #21
0
ファイル: BInitialEval.cs プロジェクト: wamathaga/IQCare
        public DataSet SaveInitialEvaluation(Hashtable ht, int none, int notDocumented, int AssoCondnone, int AssoCondnotDocumented, DataSet theDS_IE, ArrayList AssessmentAL, int VisitIE, string AssessmentDescription1, string AssessmentDescription2, int intflag, int DataQualityFlag, DataTable theCustomFieldData, string ClinicalNotes)
        {
            ClsObject IEManager = new ClsObject();
            DataSet   theDS;

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                IEManager.Connection  = this.Connection;
                IEManager.Transaction = this.Transaction;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                ClsUtility.AddParameters("@Visit_typeID", SqlDbType.Int, ht["VisitTypeID"].ToString());
                ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, ht["VisitPKID"].ToString());
                ClsUtility.AddParameters("@HIVvisitdate", SqlDbType.VarChar, ht["visitdate"].ToString());
                ClsUtility.AddParameters("@HIVDiagnosisdate", SqlDbType.VarChar, ht["HIVDiagnosisdate"].ToString());

                ClsUtility.AddParameters("@diagnosisverified", SqlDbType.Int, ht["diagnosisverified"].ToString());
                ClsUtility.AddParameters("@disclosed", SqlDbType.Int, ht["disclosed"].ToString());
                ClsUtility.AddParameters("@lmp", SqlDbType.VarChar, ht["lmp"].ToString());
                ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, ht["Pregnant"].ToString());
                ClsUtility.AddParameters("@Delivered", SqlDbType.VarChar, ht["Delivered"].ToString());
                ClsUtility.AddParameters("@DelDate", SqlDbType.VarChar, ht["DelDate"].ToString());
                ClsUtility.AddParameters("@EDDDate", SqlDbType.VarChar, ht["EDDDate"].ToString());
                ClsUtility.AddParameters("@flagsulfa", SqlDbType.VarChar, ht["flagsulfa"].ToString());
                ClsUtility.AddParameters("@sulfaallergyID", SqlDbType.VarChar, ht["allergy_Sulfa_ID"].ToString());
                ClsUtility.AddParameters("@otherallergyID", SqlDbType.VarChar, ht["allergy_Other_ID"].ToString());
                ClsUtility.AddParameters("@allergynameother", SqlDbType.VarChar, ht["allergynameother"].ToString());
                ClsUtility.AddParameters("@longTermMedsSulfa", SqlDbType.VarChar, ht["longTermMedsSulfa"].ToString());
                ClsUtility.AddParameters("@longTermMedsSulfaDesc", SqlDbType.VarChar, ht["longTermMedsSulfaDesc"].ToString());
                ClsUtility.AddParameters("@longTermTBMed", SqlDbType.VarChar, ht["longTermTBMed"].ToString());
                ClsUtility.AddParameters("@longTermTBMedDesc", SqlDbType.VarChar, ht["longTermTBMedDesc"].ToString());
                ClsUtility.AddParameters("@longTermMedsOther1", SqlDbType.VarChar, ht["longTermMedsOther1"].ToString());
                ClsUtility.AddParameters("@longTermMedsOther1Desc", SqlDbType.VarChar, ht["longTermMedsOther1Desc"].ToString());
                ClsUtility.AddParameters("@longTermMedsOther2", SqlDbType.VarChar, ht["longTermMedsOther2"].ToString());
                ClsUtility.AddParameters("@longTermMedsOther2Desc", SqlDbType.VarChar, ht["longTermMedsOther2Desc"].ToString());

                ClsUtility.AddParameters("@PrevLowestCD4None", SqlDbType.VarChar, ht["PrevLowestCD4None"].ToString());
                ClsUtility.AddParameters("@PrevLowestCD4NotDocumented", SqlDbType.VarChar, ht["PrevLowestCD4NotDocumented"].ToString());
                ClsUtility.AddParameters("@PrevLowestCD4", SqlDbType.VarChar, ht["PrevLowestCD4"].ToString());
                ClsUtility.AddParameters("@PrevLowestCD4Percent", SqlDbType.VarChar, ht["PrevLowestCD4Percent"].ToString());

                ClsUtility.AddParameters("@PrevARVsCD4None", SqlDbType.VarChar, ht["PrevARVsCD4None"].ToString());
                ClsUtility.AddParameters("@PrevARVsCD4NotDocumented", SqlDbType.VarChar, ht["PrevARVsCD4NotDocumented"].ToString());
                ClsUtility.AddParameters("@PrevARVsCD4", SqlDbType.VarChar, ht["PrevARVsCD4"].ToString());
                ClsUtility.AddParameters("@VisitID_IE", SqlDbType.VarChar, VisitIE.ToString());
                ClsUtility.AddParameters("@PrevARVsCD4Percent", SqlDbType.VarChar, ht["PrevARVsCD4Percent"].ToString());

                ClsUtility.AddParameters("@PrevMostRecentCD4None", SqlDbType.VarChar, ht["PrevMostRecentCD4None"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentCD4NotDocumented", SqlDbType.VarChar, ht["PrevMostRecentCD4NotDocumented"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentCD4", SqlDbType.VarChar, ht["PrevMostRecentCD4"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentCD4Percent", SqlDbType.VarChar, ht["PrevMostRecentCD4Percent"].ToString());

                ClsUtility.AddParameters("@PrevMostRecentViralLoadNone", SqlDbType.VarChar, ht["PrevMostRecentViralLoadNone"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentViralLoadNotDocumented", SqlDbType.VarChar, ht["PrevMostRecentViralLoadNotDocumented"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentViralLoad", SqlDbType.VarChar, ht["PrevMostRecentViralLoad"].ToString());

                ClsUtility.AddParameters("@PrevARVExposureNone", SqlDbType.VarChar, ht["PrevARVExposureNone"].ToString());
                ClsUtility.AddParameters("@PrevARVExposureNotDocumented", SqlDbType.VarChar, ht["PrevARVExposureNotDocumented"].ToString());
                ClsUtility.AddParameters("@PrevARVExposure", SqlDbType.VarChar, ht["PrevARVExposure"].ToString());
                ClsUtility.AddParameters("@CurrentART", SqlDbType.VarChar, ht["CurrentART"].ToString());
                ClsUtility.AddParameters("@PrevSingleDoseNVP", SqlDbType.VarChar, ht["PrevSingleDoseNVP"].ToString());

                ClsUtility.AddParameters("@PrevARVRegimen", SqlDbType.VarChar, ht["PrevARVRegimen"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen1Name", SqlDbType.VarChar, ht["PrevARVRegimen1Name"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen1Months", SqlDbType.VarChar, ht["PrevARVRegimen1Months"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen2Name", SqlDbType.VarChar, ht["PrevARVRegimen2Name"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen2Months", SqlDbType.VarChar, ht["PrevARVRegimen2Months"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen3Name", SqlDbType.VarChar, ht["PrevARVRegimen3Name"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen3Months", SqlDbType.VarChar, ht["PrevARVRegimen3Months"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen4Name", SqlDbType.VarChar, ht["PrevARVRegimen4Name"].ToString());
                ClsUtility.AddParameters("@PrevARVRegimen4Months", SqlDbType.VarChar, ht["PrevARVRegimen4Months"].ToString());

                ClsUtility.AddParameters("@Temp", SqlDbType.VarChar, ht["Temp"].ToString());
                ClsUtility.AddParameters("@RR", SqlDbType.VarChar, ht["RR"].ToString());
                ClsUtility.AddParameters("@HR", SqlDbType.VarChar, ht["HR"].ToString());
                ClsUtility.AddParameters("@BPDiastolic", SqlDbType.VarChar, ht["BPDiastolic"].ToString());
                ClsUtility.AddParameters("@BPSystolic", SqlDbType.VarChar, ht["BPSystolic"].ToString());
                ClsUtility.AddParameters("@Height", SqlDbType.VarChar, ht["Height"].ToString());
                ClsUtility.AddParameters("@Weight", SqlDbType.VarChar, ht["Weight"].ToString());
                ClsUtility.AddParameters("@Pain", SqlDbType.VarChar, ht["Pain"].ToString());
                ClsUtility.AddParameters("@WABStage", SqlDbType.VarChar, ht["WABStage"].ToString());
                ClsUtility.AddParameters("@WHOStage", SqlDbType.VarChar, ht["WHOStage"].ToString());
                ClsUtility.AddParameters("@ARVtherapyPlan", SqlDbType.VarChar, ht["ARVtherapyPlan"].ToString());
                ClsUtility.AddParameters("@ARVTherapyReasonCode", SqlDbType.VarChar, ht["ARVTherapyReasonCode"].ToString());
                ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, ht["ARVTherapyReasonOther"].ToString());
                ClsUtility.AddParameters("@signatureid", SqlDbType.VarChar, ht["Signatureid"].ToString());
                ClsUtility.AddParameters("@userID", SqlDbType.VarChar, ht["UserID"].ToString());
                ClsUtility.AddParameters("@DataQuality", SqlDbType.VarChar, DataQualityFlag.ToString());

                ClsUtility.AddParameters("@PrevSingleDoseNVPDate1", SqlDbType.VarChar, ht["txtprevSingleDoseNVPDate1"].ToString());
                ClsUtility.AddParameters("@PrevSingleDoseNVPDate2", SqlDbType.VarChar, ht["txtprevSingleDoseNVPDate2"].ToString());
                ClsUtility.AddParameters("@currentARTStartDate", SqlDbType.VarChar, ht["currentARTStartDate"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentViralLoadDate", SqlDbType.VarChar, ht["PrevMostRecentViralLoadDate"].ToString());
                ClsUtility.AddParameters("@PrevARVsCD4Date", SqlDbType.VarChar, ht["PrevARVsCD4Date"].ToString());
                ClsUtility.AddParameters("@PrevLowestCD4Date", SqlDbType.VarChar, ht["PrevLowestCD4Date"].ToString());
                ClsUtility.AddParameters("@longTermTBStartDate", SqlDbType.VarChar, ht["longTermTBStartDate"].ToString());
                ClsUtility.AddParameters("@PrevMostRecentCD4Date", SqlDbType.VarChar, ht["PrevMostRecentCD4Date"].ToString());
                ClsUtility.AddParameters("@AppExist", SqlDbType.VarChar, ht["AppExist"].ToString());
                ClsUtility.AddParameters("@VisitIDApp", SqlDbType.VarChar, Convert.ToString(ht["VisitIDApp"]));
                ClsUtility.AddParameters("@appdate", SqlDbType.VarChar, Convert.ToString(ht["appdate"]));
                ClsUtility.AddParameters("@appreason", SqlDbType.VarChar, Convert.ToString(ht["appreason"]));
                ClsUtility.AddParameters("@ClinicalNotes", SqlDbType.VarChar, ClinicalNotes);
                ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                ClsUtility.AddParameters("@Flag", SqlDbType.Int, ht["Flag"].ToString());
                theDS = (DataSet)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdateIE_Constella", ClsDBUtility.ObjectEnum.DataSet);

                if (Convert.ToInt32(ht["AppExist"].ToString()) == 1)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@Visit_pkAppID", SqlDbType.Int, ht["VisitIDApp"].ToString());
                    ClsUtility.AddParameters("@signatureid", SqlDbType.BigInt, ht["Signatureid"].ToString());
                    int RowsAffected = (int)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateIEAppointmentSignature_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                /**Disclose To**/
                for (int i = 0; i < theDS_IE.Tables[0].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@disclosureid", SqlDbType.Int, theDS_IE.Tables[0].Rows[i]["DisclosureID"].ToString());
                    ClsUtility.AddParameters("@HIVDisclosureOther", SqlDbType.VarChar, theDS_IE.Tables[0].Rows[i]["DisclosureOther"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    int retvaldisclose = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateDiscloseIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                /** Presenting Complaints **/
                for (int i = 0; i < theDS_IE.Tables[1].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_IE.Tables[1].Rows[i]["PresentComplaintsID"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalcomplaint = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }

                /****TBScreening*****/
                for (int i = 0; i < theDS_IE.Tables[5].Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_IE.Tables[5].Rows[i]["TBScreeningID"].ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalcomplaint = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }

                /* MediHistoryManager*/
                //None
                if (none == 95)
                {
                    Boolean DiseasePresent = false;
                    String  DiseaseYear    = "1900";
                    String  SpDisease      = "None";
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@MedHistDiseaseID", SqlDbType.Int, none.ToString());
                    ClsUtility.AddParameters("@MediHisDiseasePresent", SqlDbType.Bit, DiseasePresent.ToString());
                    ClsUtility.AddParameters("@MedHistDiseaseYear", SqlDbType.VarChar, DiseaseYear);
                    ClsUtility.AddParameters("@MedHistSpecifyDisease", SqlDbType.VarChar, SpDisease);
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalMedHistory = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateMedicalHistoryIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                //Not Documented
                else if (notDocumented == 94)
                {
                    Boolean DiseasePresent = false;
                    String  DiseaseYear    = "1900";
                    String  SpDisease      = "Notdocumented";
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@MedHistDiseaseID", SqlDbType.Int, notDocumented.ToString());
                    ClsUtility.AddParameters("@MediHisDiseasePresent", SqlDbType.Bit, DiseasePresent.ToString());
                    ClsUtility.AddParameters("@MedHistDiseaseYear", SqlDbType.VarChar, DiseaseYear);
                    ClsUtility.AddParameters("@MedHistSpecifyDisease", SqlDbType.VarChar, SpDisease);
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalMedHistory = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateMedicalHistoryIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                else if (none == 0 && notDocumented == 0)
                {
                    for (int i = 0; i < theDS_IE.Tables[2].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                        ClsUtility.AddParameters("@MedHistDiseaseID", SqlDbType.Int, theDS_IE.Tables[2].Rows[i]["MedHistoryID"].ToString());
                        ClsUtility.AddParameters("@MediHisDiseasePresent", SqlDbType.Bit, theDS_IE.Tables[2].Rows[i]["MediHisDiseasePresent"].ToString());
                        ClsUtility.AddParameters("@MedHistDiseaseYear", SqlDbType.VarChar, theDS_IE.Tables[2].Rows[i]["YearDiseasePresent"].ToString());
                        ClsUtility.AddParameters("@MedHistSpecifyDisease", SqlDbType.VarChar, theDS_IE.Tables[2].Rows[i]["SpecifyDiseasePresent"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                        int retvalMedHistory = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateMedicalHistoryIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                /* Associate Condition Left */
                //Associated Assocond - None
                if (AssoCondnone == 97)
                {
                    Boolean DiseasePresent = false;
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, AssoCondnone.ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, DiseasePresent.ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseaseYear", SqlDbType.VarChar, "");
                    ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "");
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalleft = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateHIVAssoConditionIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                //Associated Assocond - Not Documented
                if (AssoCondnotDocumented == 96)
                {
                    Boolean DiseasePresent = false;
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, AssoCondnotDocumented.ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, DiseasePresent.ToString());
                    ClsUtility.AddParameters("@HIVAssocDiseaseYear", SqlDbType.VarChar, "");
                    ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "");
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalleft = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateHIVAssoConditionIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                //HIV Associated Conditions
                if (AssoCondnone == 0 && AssoCondnotDocumented == 0)
                {
                    //Left Side Items.
                    for (int i = 0; i < theDS_IE.Tables[3].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_IE.Tables[3].Rows[i]["chkHIVAssoCondID1"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, theDS_IE.Tables[3].Rows[i]["HIVAssoDiseasePresent1"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseYear", SqlDbType.VarChar, theDS_IE.Tables[3].Rows[i]["HIVAssocCondYear1"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "");
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                        int retvalleft = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateHIVAssoConditionIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                    //Right Side Items
                    for (int i = 0; i < theDS_IE.Tables[4].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                        ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_IE.Tables[4].Rows[i]["chkHIVAssoCondid2"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseasePresent", SqlDbType.Bit, theDS_IE.Tables[4].Rows[i]["HIVAssoDiseasePresent2"].ToString());
                        ClsUtility.AddParameters("@HIVAssocDiseaseYear", SqlDbType.VarChar, theDS_IE.Tables[4].Rows[i]["HIVAssocCondYear2"].ToString());
                        ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_IE.Tables[4].Rows[i]["HIVAssoDiseaseDesc"].ToString());
                        ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                        ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                        //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                        int retvalright = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateHIVAssoConditionIE_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }

                /* Saving Assessment Details */
                for (int i = 0; i < AssessmentAL.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@patientid", SqlDbType.Int, ht["patientid"].ToString());
                    ClsUtility.AddParameters("@locationid", SqlDbType.Int, ht["locationid"].ToString());
                    ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, AssessmentAL[i].ToString());
                    ClsUtility.AddParameters("@Description1", SqlDbType.VarChar, AssessmentDescription1.ToString());
                    ClsUtility.AddParameters("@Description2", SqlDbType.VarChar, AssessmentDescription2.ToString());
                    ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString());
                    ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, ht["CreateDate"].ToString());
                    int retvalAssessnent = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateAssessment_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                //// Custom Fields //////////////
                ////////////PreSet Values Used/////////////////
                /// #99# --- Ptn_Pk
                /// #88# --- LocationId
                /// #77# --- Visit_Pk
                /// #66# --- Visit_Date
                /// #55# --- Ptn_Pharmacy_Pk
                /// #44# --- OrderedByDate
                /// #33# --- LabId
                /// #22# --- TrackingId
                /// #11# --- CareEndedId
                /// #00# --- HomeVisitId
                ///////////////////////////////////////////////

                //ClsObject theCustomManager = new ClsObject();
                //Generating VisitID from IE Form
                for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++)
                {
                    ClsUtility.Init_Hashtable();
                    string theQuery = theCustomFieldData.Rows[i]["Query"].ToString();
                    theQuery = theQuery.Replace("#99#", ht["patientid"].ToString());
                    theQuery = theQuery.Replace("#88#", ht["locationid"].ToString());
                    theQuery = theQuery.Replace("#77#", theDS.Tables[0].Rows[0]["Visit_Id"].ToString());
                    theQuery = theQuery.Replace("#66#", "'" + ht["visitdate"].ToString() + "'");
                    ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery);
                    int RowsAffected = (Int32)IEManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }
                ////////////////////////////////
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                IEManager = null;
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(theDS);
        }
コード例 #22
0
ファイル: BUserRole.cs プロジェクト: wamathaga/IQCare-4.X.0
        public int SaveUserGroupDetail(int GroupID, String Groupname, DataSet theDS, int UserID, int Flag, int EnrollmentFlag, int PreCareEnd, int EditIdentifiers)
        {
            ClsObject UserGroupManager = new ClsObject();

            try
            {
                this.Connection              = DataMgr.GetConnection();
                this.Transaction             = DataMgr.BeginTransaction(this.Connection);
                UserGroupManager.Connection  = this.Connection;
                UserGroupManager.Transaction = this.Transaction;
                ClsUtility.Init_Hashtable();
                DataRow theDR;
                ClsUtility.AddParameters("@GID", SqlDbType.Int, GroupID.ToString());
                ClsUtility.AddParameters("@Flag", SqlDbType.Int, Flag.ToString());
                ClsUtility.AddParameters("@GroupName", SqlDbType.VarChar, Groupname);
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString());
                ClsUtility.AddParameters("@PerEnrollment", SqlDbType.Int, EnrollmentFlag.ToString());
                ClsUtility.AddParameters("@PerCareEnd", SqlDbType.Int, PreCareEnd.ToString());
                ClsUtility.AddParameters("@EditIdentifiers", SqlDbType.Int, EditIdentifiers.ToString());
                theDR = (DataRow)UserGroupManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_SaveUserGroup_Detail_Constella", ClsDBUtility.ObjectEnum.DataRow);
                int GroupId = Convert.ToInt32(theDR[0].ToString());
                if (GroupId != 0)
                {
                    for (int i = 0; i < theDS.Tables[0].Rows.Count; i++)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@FacilityID", SqlDbType.Int, theDS.Tables[0].Rows[i]["FacilityID"].ToString());
                        ClsUtility.AddParameters("@ModuleID", SqlDbType.Int, theDS.Tables[0].Rows[i]["ModuleID"].ToString());
                        ClsUtility.AddParameters("@FeatureID", SqlDbType.Int, theDS.Tables[0].Rows[i]["FeatureID"].ToString());
                        ClsUtility.AddParameters("@FeatureName", SqlDbType.VarChar, theDS.Tables[0].Rows[i]["FeatureName"].ToString());
                        ClsUtility.AddParameters("@TabID", SqlDbType.Int, theDS.Tables[0].Rows[i]["TabID"].ToString());
                        ClsUtility.AddParameters("@FunctionID", SqlDbType.Int, theDS.Tables[0].Rows[i]["FunctionID"].ToString());
                        ClsUtility.AddParameters("@GroupID", SqlDbType.Int, GroupId.ToString());
                        int RowsAffected = (int)UserGroupManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_SaveFacilityServiceUserGroupFunction_Detail", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        if (RowsAffected == 0)
                        {
                            MsgBuilder theMsg = new MsgBuilder();
                            theMsg.DataElements["MessageText"] = "Error in Saving UserGroupRole. Try Again..";
                            AppException.Create("#C1", theMsg);
                        }
                    }
                }
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(Convert.ToInt32(theDR[0]));
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                UserGroupManager = null;
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #23
0
        public int IQTouchSaveExpressDetails(List <BIQTouchExpressFields> lstobjExpressFields)
        {
            ClsObject expressManagerTest = new ClsObject();
            int       theRowAffected     = 0;
            int       totalRowInserted   = 0;


            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                expressManagerTest.Connection  = this.Connection;
                expressManagerTest.Transaction = this.Transaction;
                if (lstobjExpressFields.Count > 0)
                {
                    foreach (var objExpressFields in lstobjExpressFields)
                    {
                        ClsUtility.Init_Hashtable();
                        ClsUtility.AddParameters("@ID", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.ID).ToString());
                        ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.PtnPk).ToString());
                        ClsUtility.AddParameters("@LocationId", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.LocationId).ToString());
                        ClsUtility.AddParameters("@UserId", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.UserId).ToString());
                        ClsUtility.AddParameters("@ChildAccompaniedByCaregiver", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.ChildAccompaniedByCaregiver).ToString());
                        ClsUtility.AddParameters("@TreatmentSupporterRelationship", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.TreatmentSupporterRelationship).ToString());
                        ClsUtility.AddParameters("@Temperature", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.Temperature).ToString());
                        ClsUtility.AddParameters("@RespirationRate", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.RespirationRate).ToString());
                        ClsUtility.AddParameters("@HeartRate", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.HeartRate).ToString());
                        ClsUtility.AddParameters("@SystolicBloodPressure", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.SystolicBloodPressure).ToString());
                        ClsUtility.AddParameters("@DiastolicBloodPressure", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.DiastolicBloodPressure).ToString());
                        ClsUtility.AddParameters("@MedicalCondition", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.MedicalCondition).ToString());
                        ClsUtility.AddParameters("@SpecificMedicalCondition", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.SpecificMedicalCondition).ToString());
                        ClsUtility.AddParameters("@OnFollowUp", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.OnFollowUp).ToString());
                        if (objExpressFields.LastFollowUpDate.Year.ToString() != "1900")
                        {
                            ClsUtility.AddParameters("@LastFollowUpDate", SqlDbType.DateTime, objExpressFields.LastFollowUpDate.ToString());
                        }
                        ClsUtility.AddParameters("@PreviousAdmission", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.PreviousAdmission).ToString());
                        ClsUtility.AddParameters("@PreviousAdmissionDiagnosis", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.PreviousAdmissionDiagnosis).ToString());

                        if (objExpressFields.PreviousAdmissionStart.Year.ToString() != "1900")
                        {
                            ClsUtility.AddParameters("@PreviousAdmissionStart", SqlDbType.DateTime, objExpressFields.PreviousAdmissionStart.ToString());
                        }
                        if (objExpressFields.PreviousAdmissionEnd.Year.ToString() != "1900")
                        {
                            ClsUtility.AddParameters("@PreviousAdmissionEnd", SqlDbType.DateTime, objExpressFields.PreviousAdmissionEnd.ToString());
                        }
                        ClsUtility.AddParameters("@TBAssessmentICF", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.TBAssessmentIcf).ToString());
                        ClsUtility.AddParameters("@TBFindings", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.TBFindings).ToString());
                        ClsUtility.AddParameters("@RegimenPrescribedFUP", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.RegimenPrescribedFup).ToString());
                        ClsUtility.AddParameters("@LabEvaluationPeads", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.LabEvaluationPeads).ToString());
                        ClsUtility.AddParameters("@SpecifyLabEvaluation", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.SpecifyLabEvaluation).ToString());
                        ClsUtility.AddParameters("@OIProphylaxis", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.OIProphylaxis).ToString());
                        ClsUtility.AddParameters("@OtherOIProphylaxis", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.OtherOIProphylaxis).ToString());
                        ClsUtility.AddParameters("@TreatmentPlan", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.TreatmentPlan).ToString());
                        ClsUtility.AddParameters("@PwPMessagesGiven", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.PwPMessagesGiven).ToString());
                        ClsUtility.AddParameters("@CondomsIssued", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.CondomsIssued).ToString());
                        ClsUtility.AddParameters("@ReasonfornotIssuingCondoms", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.ReasonfornotIssuingCondoms).ToString());
                        ClsUtility.AddParameters("@IntentionOfPregnancy", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.IntentionOfPregnancy).ToString());
                        ClsUtility.AddParameters("@DiscussedDualContraception", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.DiscussedDualContraception).ToString());
                        ClsUtility.AddParameters("@DiscussedFertilityOption", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.DiscussedFertilityOption).ToString());
                        ClsUtility.AddParameters("@OnFP", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.OnFP).ToString());
                        ClsUtility.AddParameters("@FPmethod", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.FPmethod).ToString());
                        ClsUtility.AddParameters("@CervicalCancerScreened", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.CervicalCancerScreened).ToString());
                        ClsUtility.AddParameters("@ReferredForCervicalCancerScreening", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.ReferredForCervicalCancerScreening).ToString());
                        ClsUtility.AddParameters("@CervicalCancerScreeningResults", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.CervicalCancerScreeningResults).ToString());

                        ClsUtility.AddParameters("@RegimenPrescribed", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.RegimenPrescribed).ToString());
                        ClsUtility.AddParameters("@OtherRegimenPrescribed", SqlDbType.VarChar, ConverTotValue.NullToInt(objExpressFields.OtherRegimenPrescribed).ToString());

                        ClsUtility.AddParameters("@ResultsCervicalCancer", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.ResultsCervicalCancer).ToString());
                        ClsUtility.AddParameters("@ReasonCTXpresribed", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.ReasonCTXpresribed).ToString());
                        ClsUtility.AddParameters("@Flag", SqlDbType.VarChar, ConverTotValue.NullToString(objExpressFields.Flag).ToString());
                        if (objExpressFields.VisitDate.Year.ToString() != "1900")
                        {
                            ClsUtility.AddParameters("@VisitDate", SqlDbType.DateTime, objExpressFields.VisitDate.ToString());
                        }
                        ClsUtility.AddParameters("@SignatureID", SqlDbType.Int, ConverTotValue.NullToInt(objExpressFields.Signature).ToString());
                        ClsUtility.AddParameters("@Height", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.Height).ToString());
                        ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, ConverTotValue.NullToInt(objExpressFields.Weight).ToString());

                        theRowAffected   = (int)expressManagerTest.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_AddKNHExpress", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                        totalRowInserted = totalRowInserted + theRowAffected;
                    }
                }



                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(totalRowInserted);
            }

            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #24
0
        public int SaveHomePageIndicator(DataSet dsSaveIndicatorQuery, string Flag)
        {
            int iFeatureId;

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                ClsObject FormDetail = new ClsObject();
                FormDetail.Connection  = this.Connection;
                FormDetail.Transaction = this.Transaction;
                int     theRowAffected = 0;
                DataRow theDR;
                int     iId;

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["FeatureId"].ToString());
                ClsUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[1].Rows[0]["FeatureName"].ToString());
                ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0");
                ClsUtility.AddParameters("@SystemId", SqlDbType.Int, "0");
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["UserID"].ToString());
                ClsUtility.AddParameters("@Published", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["Published"].ToString());
                ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["ModuleId"].ToString());
                theDR      = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFeature_Futures", ClsUtility.ObjectEnum.DataRow);
                iFeatureId = System.Convert.ToInt32(theDR[0].ToString());

                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveIndicatorQuery.Tables[2].Rows[0]["Id"].ToString());
                ClsUtility.AddParameters("@Name", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[2].Rows[0]["Name"].ToString());
                ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0");
                ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveIndicatorQuery.Tables[2].Rows[0]["UserId"].ToString());
                theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveHomePageIndicatorQuery_Futures", ClsUtility.ObjectEnum.DataRow);
                iId   = System.Convert.ToInt32(theDR[0].ToString());
                for (int i = 0; i <= dsSaveIndicatorQuery.Tables[0].Rows.Count - 1; i++)
                {
                    ClsUtility.Init_Hashtable();

                    if (Flag == "U")
                    {
                        ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveIndicatorQuery.Tables[0].Rows[i]["Id"].ToString());
                    }
                    else
                    {
                        ClsUtility.AddParameters("@Id", SqlDbType.Int, "0");
                    }
                    ClsUtility.AddParameters("@HomePageId", SqlDbType.Int, iId.ToString());
                    ClsUtility.AddParameters("@IndicatorName", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[0].Rows[i]["Indicator"].ToString());
                    ClsUtility.AddParameters("@Query", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[0].Rows[i]["Query"].ToString());
                    ClsUtility.AddParameters("@Seq", SqlDbType.Int, (i + 1).ToString());
                    ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0");
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[0].Rows[i]["UserId"].ToString());
                    theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SavedtlHomePageIndicatorQuery_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch (Exception err)
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw err;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(iFeatureId);
        }
コード例 #25
0
ファイル: BDrug.cs プロジェクト: kiambupharmacy/IQCare
        public DataTable SavePharmacyDispense(Int32 thePatientId, Int32 theLocationId, Int32 theStoreId, Int32 theUserId, DateTime theDispDate,
                                              Int32 theOrderType, Int32 theProgramId, string theRegimen, Int32 theOrderId, DataTable theDT, DateTime PharmacyRefillDate)
        {
            DataTable thePharmacyDT = new DataTable();

            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                ClsObject theManager = new ClsObject();
                ClsUtility.Init_Hashtable();
                ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, thePatientId.ToString());
                ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theLocationId.ToString());
                ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, theUserId.ToString());
                ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", theDispDate).ToString());
                ClsUtility.AddParameters("@OrderType", SqlDbType.Int, theOrderType.ToString());
                ClsUtility.AddParameters("@ProgramId", SqlDbType.Int, theProgramId.ToString());
                ClsUtility.AddParameters("@StoreId", SqlDbType.Int, theStoreId.ToString());
                ClsUtility.AddParameters("@Regimen", SqlDbType.VarChar, theRegimen);
                ClsUtility.AddParameters("@UserId", SqlDbType.Int, theUserId.ToString());
                ClsUtility.AddParameters("@OrderId", SqlDbType.Int, theOrderId.ToString());
                ClsUtility.AddParameters("@PharmacyRefillAppDate", SqlDbType.VarChar, PharmacyRefillDate.ToString("dd-MMM-yyyy"));
                thePharmacyDT = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrder_Futures", ClsDBUtility.ObjectEnum.DataTable);

                foreach (DataRow theDR in theDT.Rows)
                {
                    ClsUtility.Init_Hashtable();
                    ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, thePatientId.ToString());
                    ClsUtility.AddParameters("@StoreId", SqlDbType.Int, theStoreId.ToString());
                    ClsUtility.AddParameters("@VisitId", SqlDbType.Int, thePharmacyDT.Rows[0]["VisitId"].ToString());
                    ClsUtility.AddParameters("@Ptn_Pharmacy_Pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString());
                    ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDR["ItemId"].ToString());
                    ClsUtility.AddParameters("@StrengthId", SqlDbType.Int, theDR["StrengthId"].ToString());
                    ClsUtility.AddParameters("@FrequencyId", SqlDbType.Int, theDR["FrequencyId"].ToString());
                    ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, Convert.ToInt32(theDR["QtyDisp"]).ToString());
                    ClsUtility.AddParameters("@Prophylaxis", SqlDbType.Int, theDR["Prophylaxis"].ToString());
                    ClsUtility.AddParameters("@BatchId", SqlDbType.Int, theDR["BatchId"].ToString());
                    ClsUtility.AddParameters("@CostPrice", SqlDbType.Decimal, theDR["CostPrice"].ToString() != "" ? theDR["CostPrice"].ToString() : "0");
                    if (theDR["BatchNo"].ToString().Contains("("))
                    {
                        ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString().Substring(0, theDR["BatchNo"].ToString().IndexOf('(')));
                    }
                    else
                    {
                        ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString());
                    }
                    ClsUtility.AddParameters("@Margin", SqlDbType.Decimal, theDR["Margin"].ToString() != "" ? theDR["Margin"].ToString() : "0");
                    ClsUtility.AddParameters("@SellingPrice", SqlDbType.Decimal, theDR["SellingPrice"].ToString() != "" ? theDR["SellingPrice"].ToString() : "0");
                    ClsUtility.AddParameters("@BillAmount", SqlDbType.Decimal, theDR["BillAmount"].ToString() != "" ? theDR["BillAmount"].ToString() : "0");
                    ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString());
                    ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theDR["DispensingUnitId"].ToString());
                    ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, theDispDate.ToString("dd-MMM-yyyy"));
                    ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theLocationId.ToString());
                    ClsUtility.AddParameters("@UserId", SqlDbType.Int, theUserId.ToString());
                    ClsUtility.AddParameters("@DataStatus", SqlDbType.Int, theDR["DataStatus"].ToString());
                    ClsUtility.AddParameters("@PrescribeOrderedQuantity", SqlDbType.Decimal, theDR["OrderedQuantity"].ToString() != "" ? theDR["OrderedQuantity"].ToString() : "0");
                    ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, theDR["Dose"].ToString() != "" ? theDR["Dose"].ToString() : "0");
                    ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, theDR["Duration"].ToString() != "" ? theDR["Duration"].ToString() : "0");
                    ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString());
                    ClsUtility.AddParameters("@PatientInstructions", SqlDbType.VarChar, theDR["PatientInstructions"].ToString());
                    Int32 theRowCount = (Int32)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrderDetail_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
                }

                //    return thePharmacyDT;

                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
            return(thePharmacyDT);
        }
コード例 #26
0
ファイル: BKNHRevisedAdult.cs プロジェクト: uon-coehm/IQCare
        public DataSet SaveUpdateKNHRevisedAdultFollowupData(Hashtable hashTable, DataTable dtMultiSelectValues, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                oUtility.Init_Hashtable();
                oUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                oUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                oUtility.AddParameters("@LocationId", SqlDbType.Int, hashTable["locationID"].ToString());
                oUtility.AddParameters("@visitdate", SqlDbType.DateTime, hashTable["visitDate"].ToString());
                oUtility.AddParameters("@ChildAccompaniedByCaregiver", SqlDbType.Int, hashTable["ChildAccompaniedByCaregiver"].ToString());
                oUtility.AddParameters("@TreatmentSupporterRelationship", SqlDbType.Int, hashTable["TreatmentSupporterRelationship"].ToString());
                oUtility.AddParameters("@DisclosureStatus", SqlDbType.Int, hashTable["DisclosureStatus"].ToString());
                oUtility.AddParameters("@HealthEducation", SqlDbType.Int, hashTable["HealthEducation"].ToString());
                oUtility.AddParameters("@ReasonNotDisclosed", SqlDbType.VarChar, hashTable["ReasonNotDisclosed"].ToString());
                oUtility.AddParameters("@OtherDisclosureReason", SqlDbType.VarChar, hashTable["OtherDisclosureReason"].ToString());
                oUtility.AddParameters("@SchoolingStatus", SqlDbType.Int, hashTable["SchoolingStatus"].ToString());
                oUtility.AddParameters("@HighestLevelAttained", SqlDbType.Int, hashTable["HighestLevelAttained"].ToString());
                oUtility.AddParameters("@HIVSupportGroup", SqlDbType.Int, hashTable["HIVSupportGroup"].ToString());
                oUtility.AddParameters("@HIVSupportGroupMembership", SqlDbType.VarChar, hashTable["HIVSupportGroupMembership"].ToString());
                oUtility.AddParameters("@AddressChanged", SqlDbType.Int, hashTable["AddressChanged"].ToString());
                oUtility.AddParameters("@AddressChange", SqlDbType.VarChar, hashTable["AddressChange"].ToString());
                oUtility.AddParameters("@PhoneNoChange", SqlDbType.VarChar, hashTable["PhoneNoChange"].ToString());
                oUtility.AddParameters("@NursesComments", SqlDbType.VarChar, hashTable["NursesComments"].ToString());
                oUtility.AddParameters("@CurrentlyOnHAART", SqlDbType.Int, hashTable["CurrentlyOnHAART"].ToString());
                oUtility.AddParameters("@CurrentARTRegimenLine", SqlDbType.Int, hashTable["CurrentARTRegimenLine"].ToString());
                oUtility.AddParameters("@CurrentARTRegimen", SqlDbType.Int, hashTable["CurrentARTRegimen"].ToString());
                oUtility.AddParameters("@OtherARTRegimen", SqlDbType.VarChar, hashTable["OtherARTRegimen"].ToString());
                oUtility.AddParameters("@CurrentARTRegimenDate", SqlDbType.DateTime, hashTable["CurrentARTRegimenDate"].ToString());
                oUtility.AddParameters("@SchoolPerfomance", SqlDbType.Int, hashTable["SchoolPerfomance"].ToString());
                oUtility.AddParameters("@OtherPresentingComplaints", SqlDbType.VarChar, hashTable["OtherPresentingComplaints"].ToString());
                oUtility.AddParameters("@MedicalCondition", SqlDbType.Int, hashTable["MedicalCondition"].ToString());
                oUtility.AddParameters("@CurrentSurgicalCondition", SqlDbType.VarChar, hashTable["CurrentSurgicalCondition"].ToString());
                oUtility.AddParameters("@PreviousSurgicalCondition", SqlDbType.VarChar, hashTable["PreviousSurgicalCondition"].ToString());
                oUtility.AddParameters("@PreExistingMedicalConditionsFUP", SqlDbType.Int, hashTable["PreExistingMedicalConditionsFUP"].ToString());
                oUtility.AddParameters("@Antihypertensives", SqlDbType.VarChar, hashTable["Antihypertensives"].ToString());
                oUtility.AddParameters("@Anticonvulsants", SqlDbType.VarChar, hashTable["Anticonvulsants"].ToString());
                oUtility.AddParameters("@Hypoglycemics", SqlDbType.VarChar, hashTable["Hypoglycemics"].ToString());
                oUtility.AddParameters("@RadiotherapyChemotherapy", SqlDbType.VarChar, hashTable["RadiotherapyChemotherapy"].ToString());
                oUtility.AddParameters("@PreviousAdmission", SqlDbType.Int, hashTable["PreviousAdmission"].ToString());
                oUtility.AddParameters("@PreviousAdmissionDiagnosis", SqlDbType.VarChar, hashTable["PreviousAdmissionDiagnosis"].ToString());
                oUtility.AddParameters("@PreviousAdmissionStart", SqlDbType.DateTime, hashTable["PreviousAdmissionStart"].ToString());
                oUtility.AddParameters("@PreviousAdmissionEnd", SqlDbType.DateTime, hashTable["PreviousAdmissionEnd"].ToString());
                oUtility.AddParameters("@HIVAssociatedConditionsPeads", SqlDbType.Int, hashTable["HIVAssociatedConditionsPeads"].ToString());
                oUtility.AddParameters("@TBFindings", SqlDbType.Int, hashTable["TBFindings"].ToString());
                oUtility.AddParameters("@TBresultsAvailable", SqlDbType.Int, hashTable["TBresultsAvailable"].ToString());
                oUtility.AddParameters("@SputumSmear", SqlDbType.Int, hashTable["SputumSmear"].ToString());
                oUtility.AddParameters("@SputumSmearDate", SqlDbType.DateTime, hashTable["SputumSmearDate"].ToString());
                oUtility.AddParameters("@TissueBiopsy", SqlDbType.Int, hashTable["TissueBiopsy"].ToString());
                oUtility.AddParameters("@TissueBiopsyDate", SqlDbType.DateTime, hashTable["TissueBiopsyDate"].ToString());
                oUtility.AddParameters("@ChestXRay", SqlDbType.Int, hashTable["ChestXRay"].ToString());
                oUtility.AddParameters("@ChestXRayDate", SqlDbType.DateTime, hashTable["ChestXRayDate"].ToString());
                oUtility.AddParameters("@CXR", SqlDbType.Int, hashTable["CXR"].ToString());
                oUtility.AddParameters("@OtherCXR", SqlDbType.VarChar, hashTable["OtherCXR"].ToString());
                oUtility.AddParameters("@TBTypePeads", SqlDbType.Int, hashTable["TBTypePeads"].ToString());
                oUtility.AddParameters("@PeadsTBPatientType", SqlDbType.Int, hashTable["PeadsTBPatientType"].ToString());
                oUtility.AddParameters("@TBPlan", SqlDbType.Int, hashTable["TBPlan"].ToString());
                oUtility.AddParameters("@OtherTBPlan", SqlDbType.VarChar, hashTable["OtherTBPlan"].ToString());
                oUtility.AddParameters("@TBRegimen", SqlDbType.Int, hashTable["TBRegimen"].ToString());
                oUtility.AddParameters("@OtherTBRegimen", SqlDbType.VarChar, hashTable["OtherTBRegimen"].ToString());
                oUtility.AddParameters("@TBRegimenStartDate", SqlDbType.DateTime, hashTable["TBRegimenStartDate"].ToString());
                oUtility.AddParameters("@TBRegimenEndDate", SqlDbType.DateTime, hashTable["TBRegimenEndDate"].ToString());
                oUtility.AddParameters("@TBTreatmentOutcomesPeads", SqlDbType.Int, hashTable["TBTreatmentOutcomesPeads"].ToString());
                oUtility.AddParameters("@ARVSideEffects", SqlDbType.Int, hashTable["ARVSideEffects"].ToString());
                oUtility.AddParameters("@Specifyothershorttermeffects", SqlDbType.VarChar, hashTable["Specifyothershorttermeffects"].ToString());
                oUtility.AddParameters("@listlongtermeffect", SqlDbType.Int, hashTable["listlongtermeffect"].ToString());
                oUtility.AddParameters("@ReviewedPreviousResults", SqlDbType.Int, hashTable["ReviewedPreviousResults"].ToString());
                oUtility.AddParameters("@ResultsReviewComments", SqlDbType.VarChar, hashTable["ResultsReviewComments"].ToString());
                oUtility.AddParameters("@HIVRelatedOI", SqlDbType.VarChar, hashTable["HIVRelatedOI"].ToString());
                oUtility.AddParameters("@NonHIVRelatedOI", SqlDbType.VarChar, hashTable["NonHIVRelatedOI"].ToString());
                if (hashTable["ProgressionInWHOstage"] != null)
                {
                    oUtility.AddParameters("@ProgressionInWHOstage", SqlDbType.Int, hashTable["ProgressionInWHOstage"].ToString());
                }
                oUtility.AddParameters("@SpecifyWHOprogression", SqlDbType.VarChar, hashTable["SpecifyWHOprogression"].ToString());
                oUtility.AddParameters("@MissedDosesFUP", SqlDbType.Int, hashTable["MissedDosesFUP"].ToString());
                oUtility.AddParameters("@MissedDosesFUPspecify", SqlDbType.VarChar, hashTable["MissedDosesFUPspecify"].ToString());
                oUtility.AddParameters("@DelaysInTakingMedication", SqlDbType.Int, hashTable["DelaysInTakingMedication"].ToString());
                oUtility.AddParameters("@SpecifyARVallergy", SqlDbType.VarChar, hashTable["SpecifyARVallergy"].ToString());
                oUtility.AddParameters("@SpecifyAntibioticAllery", SqlDbType.VarChar, hashTable["SpecifyAntibioticAllery"].ToString());
                oUtility.AddParameters("@OtherDrugAllergy", SqlDbType.VarChar, hashTable["OtherDrugAllergy"].ToString());
                oUtility.AddParameters("@WorkUpPlan", SqlDbType.VarChar, hashTable["WorkUpPlan"].ToString());
                oUtility.AddParameters("@OtherCounselling", SqlDbType.VarChar, hashTable["OtherCounselling"].ToString());
                oUtility.AddParameters("@SubstituteRegimenDrug", SqlDbType.VarChar, hashTable["SubstituteRegimenDrug"].ToString());
                oUtility.AddParameters("@ARTTreatmentPlan", SqlDbType.Int, hashTable["ARTTreatmentPlan"].ToString());
                oUtility.AddParameters("@SpecifyotherARTchangereason", SqlDbType.VarChar, hashTable["SpecifyotherARTchangereason"].ToString());
                oUtility.AddParameters("@2ndLineRegimenSwitch", SqlDbType.Int, hashTable["2ndLineRegimenSwitch"].ToString());
                oUtility.AddParameters("@RegimenPrescribed", SqlDbType.Int, hashTable["RegimenPrescribed"].ToString());
                oUtility.AddParameters("@OtherRegimenPrescribed", SqlDbType.VarChar, hashTable["OtherRegimenPrescribed"].ToString());
                oUtility.AddParameters("@OIProphylaxis", SqlDbType.Int, hashTable["OIProphylaxis"].ToString());
                oUtility.AddParameters("@ReasonCTXpresribed", SqlDbType.Int, hashTable["ReasonCTXpresribed"].ToString());
                oUtility.AddParameters("@OtherOIProphylaxis", SqlDbType.VarChar, hashTable["OtherOIProphylaxis"].ToString());
                oUtility.AddParameters("@OtherTreatment", SqlDbType.VarChar, hashTable["OtherTreatment"].ToString());
                oUtility.AddParameters("@SexuallyActive", SqlDbType.Int, hashTable["SexuallyActive"].ToString());
                oUtility.AddParameters("@SexualOrientation", SqlDbType.Int, hashTable["SexualOrientation"].ToString());
                oUtility.AddParameters("@KnowSexualPartnerHIVStatus", SqlDbType.Int, hashTable["KnowSexualPartnerHIVStatus"].ToString());
                oUtility.AddParameters("@PartnerHIVStatus", SqlDbType.Int, hashTable["PartnerHIVStatus"].ToString());
                oUtility.AddParameters("@LMPassessed", SqlDbType.Int, hashTable["LMPassessed"].ToString());
                oUtility.AddParameters("@LMPDate", SqlDbType.DateTime, hashTable["LMPDate"].ToString());
                oUtility.AddParameters("@LMPNotaccessedReason", SqlDbType.Int, hashTable["LMPNotaccessedReason"].ToString());
                oUtility.AddParameters("@PDTdonet", SqlDbType.Int, hashTable["PDTdonet"].ToString());
                oUtility.AddParameters("@pregnant", SqlDbType.Int, hashTable["pregnant"].ToString());
                oUtility.AddParameters("@PMTCToffered", SqlDbType.Int, hashTable["PMTCToffered"].ToString());
                oUtility.AddParameters("@EDD", SqlDbType.DateTime, hashTable["EDD"].ToString());
                oUtility.AddParameters("@GivenPWPMessages", SqlDbType.Int, hashTable["GivenPWPMessages"].ToString());
                oUtility.AddParameters("@UnsafeSexImportanceExplained", SqlDbType.Int, hashTable["UnsafeSexImportanceExplained"].ToString());
                oUtility.AddParameters("@CondomsIssued", SqlDbType.Int, hashTable["CondomsIssued"].ToString());
                oUtility.AddParameters("@ReasonfornotIssuingCondoms", SqlDbType.VarChar, hashTable["ReasonfornotIssuingCondoms"].ToString());
                oUtility.AddParameters("@IntentionOfPregnancy", SqlDbType.Int, hashTable["IntentionOfPregnancy"].ToString());
                oUtility.AddParameters("@DiscussedFertilityOption", SqlDbType.Int, hashTable["DiscussedFertilityOption"].ToString());
                oUtility.AddParameters("@DiscussedDualContraception", SqlDbType.Int, hashTable["DiscussedDualContraception"].ToString());
                oUtility.AddParameters("@OnFP", SqlDbType.Int, hashTable["OnFP"].ToString());
                oUtility.AddParameters("@FPmethod", SqlDbType.Int, hashTable["FPmethod"].ToString());
                oUtility.AddParameters("@CervicalCancerEverScreened", SqlDbType.Int, hashTable["CervicalCancerEverScreened"].ToString());
                if (hashTable["CervicalCancerScreeningResults"] != null)
                {
                    oUtility.AddParameters("@CervicalCancerScreeningResults", SqlDbType.Int, hashTable["CervicalCancerScreeningResults"].ToString());
                }
                if (hashTable["ReferredForCervicalCancerScreening"] != null)
                {
                    oUtility.AddParameters("@ReferredForCervicalCancerScreening", SqlDbType.Int, hashTable["ReferredForCervicalCancerScreening"].ToString());
                }
                oUtility.AddParameters("@HPVOffered", SqlDbType.Int, hashTable["HPVOffered"].ToString());
                oUtility.AddParameters("@OfferedHPVaccine", SqlDbType.Int, hashTable["OfferedHPVaccine"].ToString());
                oUtility.AddParameters("@HPVDoseDate", SqlDbType.DateTime, hashTable["HPVDoseDate"].ToString());
                oUtility.AddParameters("@STIscreened", SqlDbType.Int, hashTable["STIscreened"].ToString());
                oUtility.AddParameters("@UrethralDischarge", SqlDbType.Int, hashTable["UrethralDischarge"].ToString());
                oUtility.AddParameters("@VaginalDischarge", SqlDbType.Int, hashTable["VaginalDischarge"].ToString());
                oUtility.AddParameters("@GenitalUlceration", SqlDbType.Int, hashTable["GenitalUlceration"].ToString());
                oUtility.AddParameters("@STItreatmentPlan", SqlDbType.VarChar, hashTable["STItreatmentPlan"].ToString());
                oUtility.AddParameters("@WardAdmission", SqlDbType.Int, hashTable["WardAdmission"].ToString());
                oUtility.AddParameters("@ReferToSpecialistClinic", SqlDbType.VarChar, hashTable["ReferToSpecialistClinic"].ToString());
                oUtility.AddParameters("@TransferOut", SqlDbType.VarChar, hashTable["TransferOut"].ToString());
                oUtility.AddParameters("@SpecifyOtherReferredTo", SqlDbType.VarChar, hashTable["SpecifyOtherReferredTo"].ToString());
                oUtility.AddParameters("@OtherGeneralConditions", SqlDbType.VarChar, hashTable["OtherGeneralConditions"].ToString());
                oUtility.AddParameters("@OtherAbdomenConditions", SqlDbType.VarChar, hashTable["OtherAbdomenConditions"].ToString());
                oUtility.AddParameters("@OtherCardiovascularConditions", SqlDbType.VarChar, hashTable["OtherCardiovascularConditions"].ToString());
                oUtility.AddParameters("@OtherOralCavityConditions", SqlDbType.VarChar, hashTable["OtherOralCavityConditions"].ToString());
                oUtility.AddParameters("@OtherGenitourinaryConditions", SqlDbType.VarChar, hashTable["OtherGenitourinaryConditions"].ToString());
                oUtility.AddParameters("@OtherCNSConditions", SqlDbType.VarChar, hashTable["OtherCNSConditions"].ToString());
                oUtility.AddParameters("@OtherChestLungsConditions", SqlDbType.VarChar, hashTable["OtherChestLungsConditions"].ToString());
                oUtility.AddParameters("@OtherSkinConditions", SqlDbType.VarChar, hashTable["OtherSkinConditions"].ToString());
                oUtility.AddParameters("@OtherMedicalConditionNotes", SqlDbType.VarChar, hashTable["OtherMedicalConditionNotes"].ToString());



                if (hashTable["Temp"].ToString() != "")
                {
                    oUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["Temp"].ToString());
                }
                if (hashTable["RR"].ToString() != "")
                {
                    oUtility.AddParameters("@RR", SqlDbType.Decimal, hashTable["RR"].ToString());
                }
                if (hashTable["HR"].ToString() != "")
                {
                    oUtility.AddParameters("@HR", SqlDbType.Decimal, hashTable["HR"].ToString());
                }
                if (hashTable["height"].ToString() != "")
                {
                    oUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString());
                }
                if (hashTable["weight"].ToString() != "")
                {
                    oUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString());
                }
                if (hashTable["BPDiastolic"].ToString() != "")
                {
                    oUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString());
                }
                if (hashTable["BPSystolic"].ToString() != "")
                {
                    oUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString());
                }
                if (hashTable["HeadCircumference"].ToString() != "")
                {
                    oUtility.AddParameters("@HeadCircumference", SqlDbType.Decimal, hashTable["HeadCircumference"].ToString());
                }
                if (hashTable["WeightForAge"].ToString() != "")
                {
                    oUtility.AddParameters("@WeightForAge", SqlDbType.Decimal, hashTable["WeightForAge"].ToString());
                }
                if (hashTable["WeightForHeight"].ToString() != "")
                {
                    oUtility.AddParameters("WeightForHeight", SqlDbType.Decimal, hashTable["WeightForHeight"].ToString());
                }
                oUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                oUtility.AddParameters("@DataQlty", SqlDbType.Int, hashTable["qltyFlag"].ToString());
                oUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(oUtility.theParams, "pr_Clinical_SaveUpdate_KNH_RevisedFollowup_FORM", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                    oUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                    oUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                    oUtility.AddParameters("@OtherNotes", SqlDbType.Int, dtMultiSelectValues.Rows[i]["OtherNotes"].ToString());
                    oUtility.AddParameters("@DateField1", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["DateField1"].ToString());
                    int temp = (int)VisitManager.ReturnObject(oUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #27
0
        public int SaveCustomRegistrationFormDetail(DataSet dsSaveFormData, DataTable dtFieldDetails)
        {
            try
            {
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);

                ClsObject FormDetail = new ClsObject();
                FormDetail.Connection  = this.Connection;
                FormDetail.Transaction = this.Transaction;
                int     theRowAffected = 0;
                DataRow theDR;
                int     iFeatureId;
                string  strTableName = string.Empty;
                //save mst_feature data
                oUtility.Init_Hashtable();
                if (dsSaveFormData.Tables[0].Rows[0]["InsertUpdateStatus"].ToString() == "I")
                {
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, "0");
                }
                else
                {
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["FeatureId"].ToString());
                }

                oUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Replace("'", ""));
                oUtility.AddParameters("@ReportFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ReportFlag"].ToString());
                oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["DeleteFlag"].ToString());
                oUtility.AddParameters("@AdminFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["AdminFlag"].ToString());

                oUtility.AddParameters("@SystemId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["SystemId"].ToString());
                oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString());
                oUtility.AddParameters("@Published", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["Published"].ToString());
                oUtility.AddParameters("@CountryId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["CountryId"].ToString());
                oUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ModuleId"].ToString());
                oUtility.AddParameters("@MultiVisit", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["MultiVisit"].ToString());

                theDR      = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveMstFeature_Futures", ClsUtility.ObjectEnum.DataRow);
                iFeatureId = System.Convert.ToInt32(theDR[0].ToString());

                string[] strFeatureName = new string[10];
                strFeatureName = dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Split(' ');
                for (int j = 0; j < strFeatureName.Length; j++)
                {
                    if (j > 0)
                    {
                        strTableName += "_" + strFeatureName[j];
                    }
                    else
                    {
                        strTableName += strFeatureName[j];
                    }
                }
                for (int i = 0; i < dsSaveFormData.Tables[1].Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["SectionId"].ToString());
                    oUtility.AddParameters("@SectionName", SqlDbType.VarChar, dsSaveFormData.Tables[1].Rows[i]["SectionName"].ToString());
                    oUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["Sequence"].ToString());
                    oUtility.AddParameters("@CustomFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["CustomFlag"].ToString());
                    oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString());
                    oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["UserId"].ToString());
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveMstSection_Futures", ClsUtility.ObjectEnum.DataRow);
                }

                //save lnk_form data
                for (int i = 0; i < dsSaveFormData.Tables[2].Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Id"].ToString());
                    oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                    oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString());
                    oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                    oUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["FieldLabel"].ToString());
                    oUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Sequence"].ToString());
                    oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["UserId"].ToString());
                    oUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString());
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveLnkForm_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);

                    DataView dvFilteredRow = new DataView();
                    dvFilteredRow = dtFieldDetails.DefaultView;
                    DataTable dtRow = new DataTable();

                    if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString().Contains("7100000") == true)
                    {
                        dvFilteredRow.RowFilter = "ID='71' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString();
                    }
                    else
                    {
                        dvFilteredRow.RowFilter = "ID='" + dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() + "' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString();
                    }

                    dtRow = dvFilteredRow.ToTable();
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString());
                    oUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString());
                    oUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString());
                    oUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString());
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_PatientRegistrationCustomTableCreation_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }

                //Delete fields selected from remove field in formbuilder while in update mode
                for (int i = 0; i < dsSaveFormData.Tables[3].Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[3].Rows[i]["Id"].ToString());
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dsSaveFormData.Tables[3].Rows[i]["FieldName"].ToString());
                    oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                    theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_RemoveFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }
                //Delete sections selected from remove section in formbuilder while in update mode
                if (dsSaveFormData.Tables.Count > 4)
                {
                    for (int i = 0; i < dsSaveFormData.Tables[4].Rows.Count; i++)
                    {
                        oUtility.Init_Hashtable();
                        oUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[4].Rows[i]["SectionId"].ToString());
                        oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString());
                        oUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName);
                        theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_RemoveSectionAndFieldInFormBuilder_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery);
                    }
                }
                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);
                return(iFeatureId);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #28
0
ファイル: BKNHRevisedAdult.cs プロジェクト: uon-coehm/IQCare
        public DataSet SaveUpdateKNHRevisedFollowupData_CATab(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, int UserId)
        {
            try
            {
                DataSet theDS;
                int     visitID;
                this.Connection  = DataMgr.GetConnection();
                this.Transaction = DataMgr.BeginTransaction(this.Connection);
                oUtility.Init_Hashtable();
                oUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                oUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString());
                oUtility.AddParameters("@LocationId", SqlDbType.Int, hashTable["locationID"].ToString());
                oUtility.AddParameters("@visitdate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["visitDate"].ToString()));
                oUtility.AddParameters("@SchoolPerfomance", SqlDbType.Int, hashTable["SchoolPerfomance"].ToString());
                oUtility.AddParameters("@OtherPresentingComplaints", SqlDbType.VarChar, hashTable["OtherPresentingComplaints"].ToString());
                oUtility.AddParameters("@AdditonalPresentingComplaints", SqlDbType.VarChar, hashTable["OtherAdditionPresentingComplaints"].ToString());
                //oUtility.AddParameters("@MedicalCondition", SqlDbType.Int, hashTable["MedicalCondition"].ToString());
                oUtility.AddParameters("@OtherMedicalConditionNotes", SqlDbType.Int, hashTable["OtherMedicalCondition"].ToString());
                oUtility.AddParameters("@CurrentSurgicalCondition", SqlDbType.VarChar, hashTable["CurrentSurgicalCondition"].ToString());
                oUtility.AddParameters("@PreviousSurgicalCondition", SqlDbType.VarChar, hashTable["PreviousSurgicalCondition"].ToString());
                oUtility.AddParameters("@PreExistingMedicalConditionsFUP", SqlDbType.Int, hashTable["PreExistingMedicalConditionsFUP"].ToString());
                oUtility.AddParameters("@Antihypertensives", SqlDbType.VarChar, hashTable["Antihypertensives"].ToString());
                oUtility.AddParameters("@Anticonvulsants", SqlDbType.VarChar, hashTable["Anticonvulsants"].ToString());
                oUtility.AddParameters("@Hypoglycemics", SqlDbType.VarChar, hashTable["Hypoglycemics"].ToString());
                oUtility.AddParameters("@RadiotherapyChemotherapy", SqlDbType.VarChar, hashTable["RadiotherapyChemotherapy"].ToString());
                oUtility.AddParameters("@Othercurrentlongmedication", SqlDbType.VarChar, hashTable["OtherCurrentLongtermMedication"].ToString());
                oUtility.AddParameters("@PreviousAdmission", SqlDbType.Int, hashTable["PreviousAdmission"].ToString());
                oUtility.AddParameters("@PreviousAdmissionDiagnosis", SqlDbType.VarChar, hashTable["PreviousAdmissionDiagnosis"].ToString());
                oUtility.AddParameters("@PreviousAdmissionStart", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["PreviousAdmissionStart"].ToString()));
                oUtility.AddParameters("@PreviousAdmissionEnd", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", hashTable["PreviousAdmissionEnd"].ToString()));
                oUtility.AddParameters("@HIVAssociatedConditionsPeads", SqlDbType.Int, hashTable["HIVAssociatedConditionsPeads"].ToString());

                oUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString());
                oUtility.AddParameters("@DataQlty", SqlDbType.Int, hashTable["qltyFlag"].ToString());
                oUtility.AddParameters("@signature", SqlDbType.Int, signature.ToString());
                oUtility.AddParameters("@StartTime", SqlDbType.VarChar, hashTable["starttime"].ToString());
                ClsObject VisitManager = new ClsObject();
                VisitManager.Connection = this.Connection;

                VisitManager.Transaction = this.Transaction;

                // DataSet tempDataSet;
                theDS   = (DataSet)VisitManager.ReturnObject(oUtility.theParams, "pr_Clinical_SaveUpdate_KNH_RevisedFollowup_FORM_CATab", ClsUtility.ObjectEnum.DataSet);
                visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"];

                //Pre Existing Medical Condition
                for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++)
                {
                    oUtility.Init_Hashtable();
                    oUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString());
                    oUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString());
                    oUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString());
                    oUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString());
                    oUtility.AddParameters("@OtherNotes", SqlDbType.Int, dtMultiSelectValues.Rows[i]["OtherNotes"].ToString());
                    oUtility.AddParameters("@DateField1", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["DateField1"].ToString());
                    int temp = (int)VisitManager.ReturnObject(oUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsUtility.ObjectEnum.ExecuteNonQuery);
                }


                DataMgr.CommitTransaction(this.Transaction);
                DataMgr.ReleaseConnection(this.Connection);

                return(theDS);
            }
            catch
            {
                DataMgr.RollBackTransation(this.Transaction);
                throw;
            }
            finally
            {
                if (this.Connection != null)
                {
                    DataMgr.ReleaseConnection(this.Connection);
                }
            }
        }
コード例 #29
0
        public object ReturnObjectNewImpl(Hashtable Params, string CommandText, ClsDBUtility.ObjectEnum Obj)
        {
            int                i;
            string             cmdpara, cmdvalue, cmddbtype;
            ParameterDirection cmdDirection;
            SqlCommand         theCmd   = new SqlCommand();
            SqlTransaction     theTran  = (SqlTransaction)this.Transaction;
            SqlConnection      cnn      = null;
            StringBuilder      strParam = new StringBuilder();

            try
            {
                if (null == this.Connection)
                {
                    cnn = (SqlConnection)DataMgr.GetConnection();
                }
                else
                {
                    cnn = (SqlConnection)this.Connection;
                }

                if (null == this.Transaction)
                {
                    theCmd = new SqlCommand(CommandText, cnn);
                }
                else
                {
                    theCmd = new SqlCommand(CommandText, cnn, theTran);
                }

                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    if (Params[i + 2] != null)
                    {
                        if (Params[i + 2].GetType() != ParameterDirection.Output.GetType())
                        {
                            cmdvalue = Params[i + 2].ToString();
                            SqlDbType sType = (SqlDbType)Enum.Parse(typeof(SqlDbType), cmddbtype);

                            if (sType == SqlDbType.DateTime)
                            {
                                //if (string.IsNullOrEmpty(cmdvalue.Trim()) == true)
                                //{
                                //    theCmd.Parameters.AddWithValue(cmdpara, DBNull.Value);
                                //}
                                //else if (String.IsNullOrWhiteSpace(cmdvalue) == true)
                                //{
                                //    theCmd.Parameters.AddWithValue(cmdpara, DBNull.Value);
                                //}
                                //else
                                //{
                                DateTime tmpDate;
                                if (DateTime.TryParse(cmdvalue, out tmpDate))
                                {
                                    theCmd.Parameters.Add(cmdpara, sType).Value = tmpDate.ToString("yyyy-MM-dd hh:mm:ss");
                                }
                                else
                                {
                                    theCmd.Parameters.AddWithValue(cmdpara, DBNull.Value);
                                }
                                //}
                            }
                            else
                            {
                                theCmd.Parameters.Add(cmdpara, cmddbtype).Value = cmdvalue;
                            }
                        }
                        else
                        {
                            cmdDirection = (ParameterDirection)Params[i + 2];
                            theCmd.Parameters.Add(cmdpara, (SqlDbType)Params[i + 1]).Direction = cmdDirection;
                        }
                    }
                    else
                    {
                        cmdvalue = string.Empty;
                        theCmd.Parameters.Add(cmdpara, cmddbtype).Value = cmdvalue;
                    }
                    i = i + 3;
                }

                theCmd.CommandType    = CommandType.StoredProcedure;
                theCmd.CommandTimeout = DataMgr.CommandTimeOut();
                string theSubstring = CommandText.Substring(0, 6).ToUpper();
                switch (theSubstring)
                {
                case "SELECT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "UPDATE":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "INSERT":
                    theCmd.CommandType = CommandType.Text;
                    break;

                case "DELETE":
                    theCmd.CommandType = CommandType.Text;
                    break;
                }

                theCmd.Connection = cnn;

                if (Obj == ClsDBUtility.ObjectEnum.DataSet)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataSet        theDS   = new DataSet();
                    theAdpt.Fill(theDS);
                    theAdpt.Dispose();
                    return(theDS);
                }

                if (Obj == ClsDBUtility.ObjectEnum.DataTable)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT);
                }

                if (Obj == ClsDBUtility.ObjectEnum.DataRow)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT.Rows[0]);
                }


                if (Obj == ClsDBUtility.ObjectEnum.ExecuteNonQuery)
                {
                    int NoRowsAffected = 0;
                    NoRowsAffected = theCmd.ExecuteNonQuery();
                    if (theCmd.Parameters.Contains("@idNEW"))
                    {
                        if ((int)theCmd.Parameters["@idNEW"].Value > 0)
                        {
                            NoRowsAffected = (int)theCmd.Parameters["@idNEW"].Value;
                        }
                    }

                    return(NoRowsAffected);
                }
                return(0);
            }
            catch (Exception err)
            {
                for (i = 1; i < Params.Count;)
                {
                    cmdpara   = Params[i].ToString();
                    cmddbtype = Params[i + 1].ToString();
                    if (Params[i + 2] != null)
                    {
                        if (Params[i + 2].GetType() != ParameterDirection.Output.GetType())
                        {
                            cmdvalue = Params[i + 2].ToString();
                            SqlDbType sType = (SqlDbType)Enum.Parse(typeof(SqlDbType), cmddbtype);
                            string    val   = cmdvalue;
                            if (sType == SqlDbType.DateTime)
                            {
                                if (string.IsNullOrEmpty(cmdvalue.Trim()) == true ||
                                    cmdvalue.ToString().ToLower() == "null" ||
                                    String.IsNullOrWhiteSpace(cmdvalue) == true)
                                {
                                    val = DBNull.Value.ToString();
                                }
                                else
                                {
                                    val = DateTime.Parse(cmdvalue).ToString("yyyy-MM-dd hh:mm:ss");
                                }
                            }
                            strParam.Append("Name: " + cmdpara + ", Type: " + cmddbtype + ", Value: " + val + ", Direction: Input");

                            strParam.Append(Environment.NewLine);
                        }
                        else
                        {
                            cmdDirection = (ParameterDirection)Params[i + 2];
                            strParam.Append("Name: " + cmdpara + ", Type: " + cmddbtype + ", Direction: Output");
                            strParam.Append(Environment.NewLine);
                        }
                    }
                    i = i + 3;
                }

                CLogger.WriteLog("Namespace: DataAccess.Entity, Class: ClsObject, Method: ReturnObject - Call started.", CommandText, strParam.ToString(), err.ToString());

                throw err;
            }
            finally
            {
                if (null != cnn)
                {
                    if (null == this.Connection)
                    {
                        DataMgr.ReleaseConnection(cnn);
                    }
                }
            }
        }
コード例 #30
0
ファイル: ClsObject.cs プロジェクト: palladiumkenya/IQCareKe
        /// <summary>
        /// Returns the object.
        /// </summary>
        /// <param name="paramaters">The parameters.</param>
        /// <param name="commandText">The command text.</param>
        /// <param name="Obj">The object.</param>
        /// <param name="Mode">The mode.</param>
        /// <returns></returns>
        public object ReturnObject(Hashtable paramaters, string commandText, ClsUtility.ObjectEnum Obj, ConnectionMode Mode)
        {
            //int i;
            //string cmdpara, cmdvalue, cmddbtype;
            SqlCommand     theCmd  = new SqlCommand();
            SqlTransaction theTran = (SqlTransaction)this.Transaction;
            SqlConnection  cnn;

            if (null == this.Connection)
            {
                cnn = (SqlConnection)DataMgr.GetConnection(Mode);
            }
            else
            {
                cnn = (SqlConnection)this.Connection;
            }
            if (null == this.Transaction)
            {
                theCmd = new SqlCommand(commandText, cnn);
            }
            else
            {
                theCmd = new SqlCommand(commandText, cnn, theTran);
            }

            /* for (i = 1; i < Params.Count; )
             * {
             *   cmdpara = Params[i].ToString();
             *   cmddbtype = Params[i + 1].ToString();
             *   cmdvalue = Params[i + 2].ToString();
             *   System.Data.Common.DbParameter p = theCmd.CreateParameter();
             *   p.ParameterName = cmdpara;
             *   p.Value = cmdvalue;
             *   theCmd.Parameters.Add(cmdpara);
             *
             *   theCmd.Parameters.Add(cmdpara, cmddbtype).Value = cmdvalue;
             *   i = i + 3;
             * }
             */
            for (int i = 1; i <= paramaters.Count;)
            {
                theCmd.Parameters.Add(paramaters[i]);
                i++;
            }
            theCmd.CommandType    = CommandType.StoredProcedure;
            theCmd.CommandTimeout = DataMgr.CommandTimeOut();
            string theSubstring = commandText.Substring(0, 6).ToUpper();

            switch (theSubstring)
            {
            case "SELECT":
                theCmd.CommandType = CommandType.Text;
                break;

            case "UPDATE":
                theCmd.CommandType = CommandType.Text;
                break;

            case "INSERT":
                theCmd.CommandType = CommandType.Text;
                break;

            case "DELETE":
                theCmd.CommandType = CommandType.Text;
                break;

            case "TRUNCA":
                theCmd.CommandType = CommandType.Text;
                break;
            }

            theCmd.Connection = cnn;
            try
            {
                if (Obj == ClsUtility.ObjectEnum.DataSet)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataSet        theDS   = new DataSet();
                    theAdpt.Fill(theDS);
                    theAdpt.Dispose();
                    return(theDS);
                }

                if (Obj == ClsUtility.ObjectEnum.DataTable)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT);
                }

                if (Obj == ClsUtility.ObjectEnum.DataRow)
                {
                    SqlDataAdapter theAdpt = new SqlDataAdapter(theCmd);
                    DataTable      theDT   = new DataTable();
                    theAdpt.Fill(theDT);
                    theAdpt.Dispose();
                    return(theDT.Rows[0]);
                }


                if (Obj == ClsUtility.ObjectEnum.ExecuteNonQuery)
                {
                    int NoRowsAffected = theCmd.ExecuteNonQuery();
                    return(NoRowsAffected);
                }
                return(0);
            }
            catch (Exception err)
            {
                throw err;
            }
            finally
            {
                if (null != cnn)
                {
                    if (null == this.Connection)
                    {
                        DataMgr.ReleaseConnection(cnn);
                    }
                }
            }
        }