public List <ScheduleTemplate> SelectScheduleTemplate(Dictionary <string, object> condition)
        {
            var list = new List <ScheduleTemplate>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from SCHEDULETEMPLATE order by Date desc;";
                        list = DatabaseOp.ExecuteQuery <ScheduleTemplate>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from SCHEDULETEMPLATE where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by Date desc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <ScheduleTemplate>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-SelectScheduleTemplate", e);
                return(list);
            }
        }
Пример #2
0
        public List <PatientGroupPara> SelectPatientGroupPara(Dictionary <string, object> condition)
        {
            var list = new List <PatientGroupPara>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from PATIENTGROUPPARA order by ID asc;";
                        list = DatabaseOp.ExecuteQuery <PatientGroupPara>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from PATIENTGROUPPARA where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by ID asc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <PatientGroupPara>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientGroupParaDao.cs-SelectPatientGroupPara", e);
                return(list);
            }
        }
Пример #3
0
        public List <TreatMethod> SelectTreatMethod(Dictionary <string, object> condition)
        {
            var list = new List <TreatMethod>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from TREATMETHOD order by ID desc;";
                        list = DatabaseOp.ExecuteQuery <TreatMethod>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from TREATMETHOD where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by ID desc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <TreatMethod>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("TreatMethodDao.cs-SelectTreatMethod", e);
                return(list);
            }
        }
 public bool UpdateScheduleTemplate(Dictionary <string, object> fields, Dictionary <string, object> condition)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             string sqlcommand = "update SCHEDULETEMPLATE set ";
             var    parameters = new Dictionary <string, object>();
             DatabaseOp.TransferParameteres(ref sqlcommand, "@", ",", fields, sqlcomm.Parameters);
             sqlcommand  = sqlcommand.Substring(0, sqlcommand.LastIndexOf(","));
             sqlcommand += " where ";
             DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
             sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
             sqlcomm.CommandText = sqlcommand;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-UpdateScheduleTemplate", e);
         return(false);
     }
     return(true);
 }