Ejemplo n.º 1
0
        public JsonResult DoctorsScheduleSaveUpdate(HcDoctorTimesEntity obj)
        {
            bool Success = false;

            if (string.IsNullOrEmpty(obj.Isactive))
            {
                obj.Isactive = "Active";
            }
            if (string.IsNullOrEmpty(obj.Id))
            {
                obj.Createdby   = Session["UserId"].ToString();
                obj.Createdtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                obj.Id          = (string)ExecuteDB(HCareTaks.AG_SaveHcDoctorTimesInfo, obj);
                if (!string.IsNullOrEmpty(obj.Id))
                {
                    Success = true;
                }
            }
            else
            {
                obj.Updatedby   = Session["UserId"].ToString();
                obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                Success         = (bool)ExecuteDB(HCareTaks.AG_UpdateHcDoctorTimesInfo, obj);
            }

            string Message = Success ? "Process has been done successfully" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message, Id = obj.Doctorid }));
        }
Ejemplo n.º 2
0
        public object UpdateHcDoctorTimesInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcDoctorTimesEntity hcDoctorTimesEntity = (HcDoctorTimesEntity)param;
                    HcDoctorTimesDAL    hcDoctorTimesDAL    = new HcDoctorTimesDAL();
                    retObj = (object)hcDoctorTimesDAL.UpdateHcDoctorTimesInfo(hcDoctorTimesEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Ejemplo n.º 3
0
        public DataTable GetAllHcDoctorTimesRecord(object param)
        {
            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"SELECT T.ID, T.DoctorID, T.Days, T.Times, T.IsActive, T.CreatedBy, T.CreatedTime, T.UpdatedBy, T.UpdatedTime 
                , (Select Name From HC_DoctorInfo z Where z.ID = T.DoctorID) DoctorName
                FROM HC_Doctor_Times T Where 1=1";

            HcDoctorTimesEntity obj = new HcDoctorTimesEntity();

            if (param != null)
            {
                obj = (HcDoctorTimesEntity)param;
            }


            //------ Call Other Functions
            //------------------------------

            if (obj.GetTimeByDay)
            {
                return(GetAllHcDoctorTimesRecord_ByDay(param));
            }

            //--------------------------



            if (!string.IsNullOrEmpty(obj.Doctorid))
            {
                sql += " And T.DoctorID = '" + obj.Doctorid + "'";
            }
            if (!string.IsNullOrEmpty(obj.Days))
            {
                sql += " And T.Days = '" + obj.Days + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isactive))
            {
                sql += " And T.IsActive = '" + obj.Isactive + "'";
            }

            sql += " Order By T.Days Asc, T.Times Asc";

            if (obj.QueryFlag == "DayOfWeek")
            {
                sql = "Select distinct stuff(( select distinct ', ' + Days from HC_Doctor_Times Where 1=1";
                if (!string.IsNullOrEmpty(obj.Doctorid))
                {
                    sql += " And DoctorID = '" + obj.Doctorid + "'";
                }
                sql += " for xml path('') ), 1, 2, '') DayOfWeek from HC_Doctor_Times T Where 1=1";
                if (!string.IsNullOrEmpty(obj.Doctorid))
                {
                    sql += " And T.DoctorID = '" + obj.Doctorid + "'";
                }
            }
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }
Ejemplo n.º 4
0
        public DataTable GetAllHcDoctorTimesRecord_ByDay(object param)
        {
            HcDoctorTimesEntity obj = new HcDoctorTimesEntity();

            if (param != null)
            {
                obj = (HcDoctorTimesEntity)param;
            }

            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"select * from (
select Days,Times from HC_Doctor_Times 
where DoctorID = '" + obj.Doctorid + "'";

            sql += @" ) A
PIVOT
(
max(Times)
FOR days IN ([Sunday], [Monday],[Tuesday],[Wednesday],[Thursday],[Friday],[Saturday])
) AS PivotTable
 ";


            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }
Ejemplo n.º 5
0
        string getDoctorTime(string id)
        {
            string TimeTable = "";

            TimeTable = TimeTable + @"<div class='table-responsive'> " +
                        "<table class='table'>" +
                        "<thead>" +
                        "<tr>" +
                        "<th scope = 'col'>#</th>" +
                        "<th scope = 'col'> Days </ th >" +
                        "<th scope = 'col'> Time </ th >" +
                        "</tr>" +
                        " </thead > <tbody>";

            HcDoctorTimesEntity obj = new HcDoctorTimesEntity();

            obj.Doctorid = id;
            DataTable dt       = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorTimesRecord, obj);
            int       rowcount = 0;

            foreach (DataRow dr in dt.Rows)
            {
                rowcount++;

                TimeTable = TimeTable + @"<tr>" +
                            "<td>" + rowcount + "</th>" +
                            "<td> " + dr["Days"] + "</th>" +
                            "<td> " + dr["Times"] + "</th>" +
                            "</tr>";
            }
            TimeTable = TimeTable + " </tbody></table> </div>";

            return(TimeTable);
        }
Ejemplo n.º 6
0
        public JsonResult AppointDoctorTimes(string Doc, string Dt)
        {
            bool Success = false; string TimeList = "<option value='' selected>Select...</option>";

            if (!string.IsNullOrEmpty(Doc) && !string.IsNullOrEmpty(Dt))
            {
                string AllDays = DoctorDaysOfWeek(Doc);

                DateTime dbTime = DateTime.ParseExact(Dt, "yyyy-MM-dd", null);
                string   Day    = dbTime.DayOfWeek.ToString();
                if (AllDays.ToUpper().Contains(Day.ToUpper()))
                {
                    Success = true;
                    HcDoctorTimesEntity tObj = new HcDoctorTimesEntity();
                    tObj.Doctorid = Doc;
                    tObj.Days     = Day;
                    tObj.Isactive = "Active";
                    DataTable tDt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorTimesRecord, tObj);
                    foreach (DataRow dr in tDt.Rows)
                    {
                        TimeList += "<option value='" + dr["ID"] + "'>" + dr["Times"] + "</option>";
                    }
                }
            }
            return(Json(new { Success = Success, TimeList = TimeList }));
        }
Ejemplo n.º 7
0
        public HcDoctorTimesEntity GetSingleHcDoctorTimesRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, DoctorID, Days, Times, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime FROM HC_Doctor_Times WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcDoctorTimesEntity hcDoctorTimesEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcDoctorTimesEntity = new HcDoctorTimesEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["DoctorID"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Doctorid = dataReader["DoctorID"].ToString();
                    }
                    if (dataReader["Days"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Days = dataReader["Days"].ToString();
                    }
                    if (dataReader["Times"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Times = dataReader["Times"].ToString();
                    }
                    if (dataReader["IsActive"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Isactive = dataReader["IsActive"].ToString();
                    }
                    if (dataReader["CreatedBy"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Createdby = dataReader["CreatedBy"].ToString();
                    }
                    if (dataReader["CreatedTime"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Createdtime = dataReader["CreatedTime"].ToString();
                    }
                    if (dataReader["UpdatedBy"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Updatedby = dataReader["UpdatedBy"].ToString();
                    }
                    if (dataReader["UpdatedTime"] != DBNull.Value)
                    {
                        hcDoctorTimesEntity.Updatedtime = dataReader["UpdatedTime"].ToString();
                    }
                }
            }
            return(hcDoctorTimesEntity);
        }
Ejemplo n.º 8
0
        public JsonResult DoctorsScheduleDeleteById(string Id)
        {
            bool Success            = false;
            HcDoctorTimesEntity obj = (HcDoctorTimesEntity)ExecuteDB(HCareTaks.AG_GetSingleHcDoctorTimesRecordById, Id);

            if (obj != null)
            {
                obj.Updatedby   = Session["UserId"].ToString();
                obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy");
                obj.Isactive    = "Inactive";
                Success         = (bool)ExecuteDB(HCareTaks.AG_UpdateHcDoctorTimesInfo, obj);
            }
            string Message = Success ? "Delete Success" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message }));
        }
Ejemplo n.º 9
0
        public string DoctorDaysOfWeek(string Id)
        {
            string AllDays           = "none";
            HcDoctorTimesEntity tObj = new HcDoctorTimesEntity();

            tObj.Doctorid  = Id;
            tObj.Isactive  = "Active";
            tObj.QueryFlag = "DayOfWeek";
            DataTable tDt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorTimesRecord, tObj);

            if (tDt.Rows.Count > 0)
            {
                AllDays = tDt.Rows[0]["DayOfWeek"].ToString();
            }
            return(AllDays);
        }
Ejemplo n.º 10
0
        public bool UpdateHcDoctorTimesInfo(HcDoctorTimesEntity hcDoctorTimesEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE HC_Doctor_Times SET DoctorID= @Doctorid, Days= @Days, Times= @Times, IsActive= @Isactive, UpdatedBy= @Updatedby, UpdatedTime= @Updatedtime WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcDoctorTimesEntity.Id);
            db.AddInParameter(dbCommand, "Doctorid", DbType.String, hcDoctorTimesEntity.Doctorid);
            db.AddInParameter(dbCommand, "Days", DbType.String, hcDoctorTimesEntity.Days);
            db.AddInParameter(dbCommand, "Times", DbType.String, hcDoctorTimesEntity.Times);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcDoctorTimesEntity.Isactive);
            db.AddInParameter(dbCommand, "Updatedby", DbType.String, hcDoctorTimesEntity.Updatedby);
            db.AddInParameter(dbCommand, "Updatedtime", DbType.String, hcDoctorTimesEntity.Updatedtime);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Ejemplo n.º 11
0
        public object SaveHcDoctorTimesInfo(HcDoctorTimesEntity hcDoctorTimesEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO HC_Doctor_Times ( DoctorID, Days, Times, IsActive, CreatedBy, CreatedTime ) output inserted.ID VALUES (  @Doctorid,  @Days,  @Times,  @Isactive,  @Createdby,  @Createdtime )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Doctorid", DbType.String, hcDoctorTimesEntity.Doctorid);
            db.AddInParameter(dbCommand, "Days", DbType.String, hcDoctorTimesEntity.Days);
            db.AddInParameter(dbCommand, "Times", DbType.String, hcDoctorTimesEntity.Times);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcDoctorTimesEntity.Isactive);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcDoctorTimesEntity.Createdby);
            db.AddInParameter(dbCommand, "Createdtime", DbType.String, hcDoctorTimesEntity.Createdtime);

            var id = db.ExecuteScalar(dbCommand, transaction).ToString();

            return(id);
        }
Ejemplo n.º 12
0
        string DoctorsScheduleListTableData(string DocId)
        {
            string TableData        = "";
            HcDoctorTimesEntity obj = new HcDoctorTimesEntity();

            obj.Doctorid = DocId;
            DataTable dt    = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorTimesRecord, obj);
            int       Count = 1;

            foreach (DataRow dr in dt.Rows)
            {
                string Action = "<i class='mdi mdi-table-edit iAction' title='Edit This' onclick=\"EditDetails('" + dr["Id"].ToString() + "')\" style='color:orange'></i>";
                Action    += "<i class='mdi mdi-close-box iAction' title='Inactive This' onclick=\"DeleteDetails('" + dr["Id"].ToString() + "', this)\" style='color:red'></i>";
                TableData +=
                    "<tr>" +
                    "<td>" + Count + "</td>" +
                    "<td>" + dr["DoctorName"] + "</td>" +
                    "<td>" + dr["Days"] + "</td>" +
                    "<td>" + dr["Times"] + "</td>" +
                    "<td class='IsActive'>" + dr["IsActive"] + "</td>" +
                    "<td>" + Action + "</td>" +
                    "</tr>";
                Count += 1;
            }

            string CreateBtn = "<button class='btn btn-primary' type='button' onclick='CreateDetails()'  style='margin-bottom:10px;'> New</button>";
            string tHead     =
                "<tr>" +
                "<th>Sort</th>" +
                "<th>DoctorName</th>" +
                "<th>Days</th>" +
                "<th>Times</th>" +
                "<th>IsActive</th>" +
                "<th>Action</th>" +
                "</tr>";

            TableData = CreateBtn + "<div class='table-responsive'><table id='zero_config' class='table table-striped table-bordered'>" +
                        "<thead>" + tHead + "</thead><tbody>" + TableData + "</tbody></table></div>";

            return(TableData);
        }
Ejemplo n.º 13
0
        public ActionResult DoctorsScheduleCreate(string Id, string Doc)
        {
            string eMsg = SiteMainMenuList("Doctor Schedule Details", "Settings", "DoctorList");

            if (!string.IsNullOrEmpty(eMsg))
            {
                return(RedirectToOut(eMsg));
            }
            //else if (!SiteUserAccess("", "V")) return RedirectToOut();

            ViewBag.ListDays   = List_Days();
            ViewBag.ListDoctor = List_Doctor("", "");

            HcDoctorTimesEntity obj = new HcDoctorTimesEntity();

            obj.Doctorid = Doc;
            if (!string.IsNullOrEmpty(Id))
            {
                obj = (HcDoctorTimesEntity)ExecuteDB(HCareTaks.AG_GetSingleHcDoctorTimesRecordById, Id);
            }

            return(View(obj));
        }