Esempio n. 1
0
        internal static bool FieldInsert(Guid guid, string name, out int id)
        {
            bool r = false;

            id = 0;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(Field_Insert))
            {
                FieldParameters(cmd, guid, name);

                SqlParameter prmId = AppDatabase.AddOutParameter(cmd, "@FieldId", SqlDbType.Int);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    id = AppShared.DbValueToInteger(prmId.Value);
                }
            }
            return(r);
        }
        internal static bool OPDInvestigationProcedureUpdate(Guid OPDInvestigationProcedureGuid, Guid PatientGuid, string RadiologyInvestigation,
                                                             string SpecialInvestigation, DateTime OPDInvestigationProcedureDate, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(OPDInvestigationProcedure_Update))
            {
                OPDInvestigationProcedureParameters(cmd, OPDInvestigationProcedureGuid, PatientGuid, RadiologyInvestigation, SpecialInvestigation,
                                                    OPDInvestigationProcedureDate, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, OPDInvestigationProcedure.Columns.OPDInvestigationProcedureModifiedOn, SqlDbType.DateTime);
                AppDatabase  db      = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
Esempio n. 3
0
        internal static bool AppointmentInsert(Guid PatientGuid, Guid AppointmentGuid, DateTime AppointmentDate, string AppointmentDescription, Guid createdByUser,
                                               out DateTime createdOn)
        {
            bool r = false;

            createdOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(Appointment_Insert))
            {
                AppointmentParameters(cmd, PatientGuid, AppointmentGuid, AppointmentDate, AppointmentDescription, createdByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, Appointment.Columns.AppointmentModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    createdOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
Esempio n. 4
0
        internal static bool OPDPrescriptionUpdate(Guid OPDPrescriptionProcedureGuid, Guid PatientGuid, string Doseage, string Timings,
                                                   DateTime OPDPrescriptionDate, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(OPDPrescription_Update))
            {
                OPDPrescriptionParameters(cmd, OPDPrescriptionProcedureGuid, PatientGuid, Doseage, Timings, OPDPrescriptionDate, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, OPDPrescription.Columns.OPDPrescriptionModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
Esempio n. 5
0
        internal static bool UserRoleUpdate(Guid guid, string userRoleName, int userRoleLevel, string userRoleDesc, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(UserRole_Update))
            {
                UserRoleParameters(cmd, guid, userRoleName, userRoleLevel, userRoleDesc, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, UserRole.Columns.UserRoleModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }

            return(r);
        }
Esempio n. 6
0
        internal static bool ProcedureUpdate(Guid guid, string name, string description, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(Procedure_Update))
            {
                ProcedureParameters(cmd, guid, name, description, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, Procedure.Columns.ProcedureModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }

            return(r);
        }
        internal static bool IPDPatientTreatmentUpdate(Guid guid, Guid patientGuid, Guid treatmentGuid, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(IPDPatientTreatment_Update))
            {
                IPDPatientTreatmentParameters(cmd, guid, patientGuid, treatmentGuid, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, IPDPatientTreatment.Columns.IPDPatientTreatmentModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }

            return(r);
        }
Esempio n. 8
0
        internal static bool UserUpdate(Guid guid, string name, string loginName, Guid userRoleGuid, string password, string addressline1, string addressline2, string addressline3, string phoneNo, string mobileNo, byte[] photo, string desc, decimal doctorShare, bool isDisable, Guid modifiedByUser, out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(User_Update))
            {
                UserParameters(cmd, guid, name, loginName, userRoleGuid, password, addressline1, addressline2, addressline3, phoneNo, mobileNo, photo, desc, doctorShare, isDisable, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, User.Columns.UserModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }

            return(r);
        }
Esempio n. 9
0
        internal static bool CheckUsernameAvailibity(string userName, Guid excludeGuid)
        {
            bool r = false;

            if (userName != string.Empty)
            {
                using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(User_CheckName))
                {
                    AppDatabase.AddInParameter(cmd, "@Username", SqlDbType.NVarChar, userName);
                    AppDatabase.AddInParameter(cmd, "@ExcludeGuid", SqlDbType.UniqueIdentifier, AppShared.ToDbValueNullable(excludeGuid));
                    SqlParameter prmAvailable = AppDatabase.AddOutParameter(cmd, "@IsAvailable", SqlDbType.Bit);

                    AppDatabase db = OpenDatabase();
                    if (db != null && db.ExecuteCommand(cmd))
                    {
                        r = AppShared.DbValueToBoolean(prmAvailable.Value);
                    }
                }
            }
            return(r);
        }
        internal static bool LabInvestigationInsert(Guid LabInvestigationGuid, string LabInvestigationName, string LabInvestigationDescription, Guid createdByUser, out DateTime createdOn)
        {
            bool r = false;

            //id = 0;
            createdOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(LabInvestigation_Insert))
            {
                LabInvestigationParameter(cmd, LabInvestigationGuid, LabInvestigationName, LabInvestigationDescription, createdByUser);
                //  SqlParameter prmId = AppDatabase.AddOutParameter(cmd, LabInvestigation.Columns.LabInvestigationId, SqlDbType.Int);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, LabInvestigation.Columns.LabInvestigationModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    //id = AppShared.DbValueToInteger(prmId.Value);
                    createdOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
        internal static bool HistoryProcedureUpdate(Guid HistoryProcedureGuid, Guid PatientGuid, string ProblemSince,
                                                    string AssociateComplainDuration, string FamilyHistory, string FamilyHistoryDuration, DateTime Date, string BP, string HR, string RR, string Temp, string RBS, string ECG, string Wt, string Other, string MLCNo, DateTime FollowUpDate, string TimeHour, string TimeMinute, string TimeAMPM, Guid modifiedByUser,
                                                    out DateTime modifiedOn)
        {
            bool r = false;

            modifiedOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(HistoryProcedure_Update))
            {
                HistoryProcedureParameter(cmd, HistoryProcedureGuid, PatientGuid, ProblemSince, AssociateComplainDuration,
                                          FamilyHistory, FamilyHistoryDuration, Date, BP, HR, RR, Temp, RBS, ECG, Wt, Other, MLCNo, FollowUpDate, TimeHour, TimeMinute, TimeAMPM, modifiedByUser);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, HistoryProcedure.Columns.HistoryProcedureModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    modifiedOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
        internal static bool InvestigationProcedureInsert(Guid InvestigationProcedureGuid, Guid MainInvestigationGUID, Guid LabInvestigationGUID, string RadiologyInvestigation, string SpecialInvestigation, DateTime InvestigationProcedureDate, Guid createdByUser, out DateTime createdOn)
        {
            bool r = false;

            //id = 0;
            createdOn = DateTime.MinValue;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(InvestigationProcedure_Insert))
            {
                InvestigationProcedureParameter(cmd, InvestigationProcedureGuid, MainInvestigationGUID, LabInvestigationGUID, RadiologyInvestigation, SpecialInvestigation, InvestigationProcedureDate, createdByUser);
                //  SqlParameter prmId = AppDatabase.AddOutParameter(cmd, InvestigationProcedure.Columns.InvestigationProcedureId, SqlDbType.Int);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, InvestigationProcedure.Columns.InvestigationProcedureModifiedOn, SqlDbType.DateTime);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    //id = AppShared.DbValueToInteger(prmId.Value);
                    createdOn = AppShared.DbValueToDateTime(prmDate.Value);
                }
            }
            return(r);
        }
Esempio n. 13
0
        internal static bool EntityInsert(Guid guid, string name, string caption, string typeName, string listCaption, string listTypeName, byte[] iconSmall, byte[] iconLarge, string groupName, string desc, Guid createdByUser, out DateTime createdOn, out int id)
        {
            bool r = false;

            createdOn = DateTime.MinValue;
            id        = 0;
            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(Entity_Insert))
            {
                EntityParameters(cmd, guid, name, caption, typeName, listCaption, listTypeName, iconSmall, iconLarge, groupName, desc, createdByUser);

                SqlParameter prmCreatedOn = AppDatabase.AddOutParameter(cmd, "@EntityModifiedOn", SqlDbType.DateTime);
                SqlParameter prmId        = AppDatabase.AddOutParameter(cmd, "@EntityId", SqlDbType.Int);

                AppDatabase db = OpenDatabase();
                r = db != null && db.ExecuteCommand(cmd);
                if (r)
                {
                    id        = AppShared.DbValueToInteger(prmId.Value);
                    createdOn = AppShared.DbValueToDateTime(prmCreatedOn.Value);
                }
            }
            return(r);
        }
Esempio n. 14
0
        internal static Decimal GetAvailableStockMedicine(Guid CategoryGuid, Guid CompanyGuid, Guid ItemGuid)
        {
            decimal AvailableStock = 0;
            bool    r = false;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(Medicine_MaxQuantity))
            {
                AppDatabase.AddInParameter(cmd, Medicines.Columns.MedicineCategoryGuid, SqlDbType.UniqueIdentifier, CategoryGuid);
                AppDatabase.AddInParameter(cmd, Medicines.Columns.MedicineCompanyGuid, SqlDbType.UniqueIdentifier, CompanyGuid);
                AppDatabase.AddInParameter(cmd, Medicines.Columns.MedicineItemGuid, SqlDbType.UniqueIdentifier, ItemGuid);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, Medicines.Columns.MedicineCurrentStock, SqlDbType.Decimal);
                AppDatabase  db      = OpenDatabase();
                if (db != null)
                {
                    r = db.ExecuteCommand(cmd);
                }
                if (r)
                {
                    AvailableStock = AppShared.DbValueToDecimal(prmDate.Value);
                }
            }
            return(AvailableStock);
            // return GetReader(Patient_Search, "@SearchText", SqlDbType.NVarChar, AppShared.ToDbLikeText(searchText));
        }
Esempio n. 15
0
        internal static Decimal MRPFromPurchase(Guid CategoryGuid, Guid CompanyGuid, Guid ItemGuid)
        {
            decimal MRP = 0;
            bool    r   = false;

            using (SqlCommand cmd = AppDatabase.GetStoreProcCommand(MedicinePurchase_GETMRP))
            {
                AppDatabase.AddInParameter(cmd, MedicinePurchase.Columns.MedicinePurchaseCategoryGuid, SqlDbType.UniqueIdentifier, CategoryGuid);
                AppDatabase.AddInParameter(cmd, MedicinePurchase.Columns.MedicinePurchaseCompanyGuid, SqlDbType.UniqueIdentifier, CompanyGuid);
                AppDatabase.AddInParameter(cmd, MedicinePurchase.Columns.MedicinePurchaseItemGuid, SqlDbType.UniqueIdentifier, ItemGuid);
                SqlParameter prmDate = AppDatabase.AddOutParameter(cmd, MedicinePurchase.Columns.MedicinePurchaseMRP, SqlDbType.Decimal);
                AppDatabase  db      = OpenDatabase();
                if (db != null)
                {
                    r = db.ExecuteCommand(cmd);
                }
                if (r)
                {
                    MRP = AppShared.DbValueToDecimal(prmDate.Value);
                }
            }
            return(MRP);
            // return GetReader(Patient_Search, "@SearchText", SqlDbType.NVarChar, AppShared.ToDbLikeText(searchText));
        }