Beispiel #1
0
        public async Task <HttpResponseMessage> Create(MT_SurgicalProcedureInformationTemplates SPIT)
        {
            Db = con.SurgeryCenterDb(SPIT.Slug);
            SPITemplateResponse Response = new SPITemplateResponse();

            try
            {
                UniqueID              = con.GetUniqueKey();
                SPIT.Temp_Unique_ID   = UniqueID;
                SPIT.Temp_Create_Date = con.ConvertTimeZone(SPIT.Temp_TimeZone, Convert.ToDateTime(SPIT.Temp_Create_Date));
                SPIT.Temp_Modify_Date = con.ConvertTimeZone(SPIT.Temp_TimeZone, Convert.ToDateTime(SPIT.Temp_Modify_Date));
                DocumentReference docRef = Db.Collection("MT_SurgicalProcedureInformationTemplates").Document(UniqueID);
                WriteResult       Result = await docRef.SetAsync(SPIT);

                if (Result != null)
                {
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                    Response.Data    = SPIT;
                }
                else
                {
                    Response.Status  = con.StatusNotInsert;
                    Response.Message = con.MessageNotInsert;
                    Response.Data    = null;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
Beispiel #2
0
        public async Task <HttpResponseMessage> Remove(MT_SurgicalProcedureInformationTemplates SPIT)
        {
            Db = con.SurgeryCenterDb(SPIT.Slug);
            SPITemplateResponse Response = new SPITemplateResponse();

            try
            {
                DocumentReference docRef = Db.Collection("MT_SurgicalProcedureInformationTemplates").Document(SPIT.Temp_Unique_ID);
                WriteResult       Result = await docRef.DeleteAsync();

                if (Result != null)
                {
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                    Response.Data    = SPIT;
                }
                else
                {
                    Response.Status  = con.StatusNotInsert;
                    Response.Message = con.MessageNotInsert;
                    Response.Data    = null;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
Beispiel #3
0
        //[Authorize(Roles ="SAdmin")]
        public async Task <HttpResponseMessage> Select(MT_SurgicalProcedureInformationTemplates SPIT)
        {
            Db = con.SurgeryCenterDb(SPIT.Slug);
            SPITemplateResponse Response = new SPITemplateResponse();

            try
            {
                List <MT_SurgicalProcedureInformationTemplates> AnesList = new List <MT_SurgicalProcedureInformationTemplates>();
                Query         docRef       = Db.Collection("MT_SurgicalProcedureInformationTemplates").WhereEqualTo("Temp_Is_Deleted", false).WhereEqualTo("Temp_Unique_ID", SPIT.Temp_Unique_ID);
                QuerySnapshot ObjQuerySnap = await docRef.GetSnapshotAsync();

                if (ObjQuerySnap != null)
                {
                    foreach (DocumentSnapshot Docsnapshot in ObjQuerySnap.Documents)
                    {
                        AnesList.Add(Docsnapshot.ConvertTo <MT_SurgicalProcedureInformationTemplates>());
                    }
                    Response.DataList = AnesList;
                }
                Response.Status  = con.StatusSuccess;
                Response.Message = con.MessageSuccess;
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }