Пример #1
0
        public object GetServiceDirectoryListSync(ServiceDirectorySearch serv)
        {
            dynamic       TBServiceDirectoryResult;
            List <object> ServiceDirectoryResult = new List <object>();

            try
            {
                ServiceDirector Result = ServiceDirectory.GetServiceDirectoryListSync(serv);

                TBServiceDirectoryResult = new { status = "0", message = "success", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), Result };
            }
            catch
            {
                TBServiceDirectoryResult = new { status = "1", message = "An error occured. Please contact Administrator" };
            }
            return(new
            {
                TBServiceDirectoryResult
            });
        }
Пример #2
0
        public object AddServiceDirectory(AddServiceDirectory addservice)
        {
            dynamic TBAddServiceResult;
            int     str = -1;

            try
            {
                Imgname Result = ServiceDirectory.createService(addservice);

                if (!string.IsNullOrEmpty(Result.imgName))
                {
                    str = GlobalFuns.UploadImage(addservice.groupId, Result.imgName, "servicedirectory");
                }
                else
                {
                    str = 0;
                }

                //if (Result != null)
                //{
                if (str == 0)
                {
                    //TBAddServiceResult = new { status = "0", message = "success" };
                    ServiceDirectorySearch serv = new ServiceDirectorySearch();
                    serv.groupId  = addservice.groupId;
                    serv.moduleId = addservice.moduleId;

                    DateTime dt = DateTime.Now;
                    if (addservice.updatedOn != null)
                    {
                        dt = Convert.ToDateTime(addservice.updatedOn);
                        dt = dt.AddSeconds(-1);
                    }

                    serv.updatedOn = dt.ToString("yyyy/MM/dd HH:mm:ss");

                    ServiceDirector res = ServiceDirectory.GetServiceDirectoryListSync(serv);

                    if (res != null)
                    {
                        TBAddServiceResult = new { status = "0", message = "success", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), res };
                    }
                    else
                    {
                        TBAddServiceResult = new { status = "1", message = "failed", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") };
                    }
                }
                else
                {
                    TBAddServiceResult = new { status = "1", message = "failed" }
                };
                //}
                //else
                //{
                //    TBAddServiceResult = new { status = "0", message = "Record not found" };
                //}
            }
            catch
            {
                TBAddServiceResult = new { status = "1", message = "failed" };
            }

            return(new { TBAddServiceResult });
        }