Exemplo n.º 1
0
        public static JsonResults GetDashboardDetails()
        {
            JsonResults dashboardDetails = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    dashboardDetails.ErrorCode    = -1001;
                    dashboardDetails.ErrorMessage = "";
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetDashboard(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, out dashboardDetails))
                {
                    dashboardDetails.ErrorCode    = 0;
                    dashboardDetails.ErrorMessage = "";
                }
                else
                {
                    dashboardDetails.ErrorCode    = -1;
                    dashboardDetails.ErrorMessage = "Failed to get Dashboard details. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(dashboardDetails);
        }
        public static JsonResults GetItemRatesList(int ItemMasterID, int ItemRateID)
        {
            JsonResults invoiceList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    invoiceList.ErrorCode    = -1001;
                    invoiceList.ErrorMessage = "";
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetItemMasterRates(currentUser.CompanyID, currentUser.UserId, ItemMasterID, ItemRateID, out invoiceList))
                {
                    invoiceList.ErrorCode    = 0;
                    invoiceList.ErrorMessage = "";
                }
                else
                {
                    invoiceList.ErrorCode    = -1;
                    invoiceList.ErrorMessage = "Failed to get Item Rates. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(invoiceList);
        }
        public static JsonResults AddEditItemToDB(ItemMaster ItemMaster, int itemMasterID)
        {
            JsonResults returnObj = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    returnObj.ErrorCode    = -1001;
                    returnObj.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.AddEditItemMaster(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, itemMasterID, ref ItemMaster))
                {
                    returnObj.ErrorCode    = 0;
                    returnObj.ErrorMessage = "";
                }
                else
                {
                    returnObj.ErrorCode    = customerObj.GetLastErrorCode();
                    returnObj.ErrorMessage = customerObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(returnObj);
        }
        public static JsonResults GetMeasurementList(string AccountCode, string AccountName, string DeliveryFrom, string DeliveryTo)
        {
            JsonResults MeasurList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    MeasurList.ErrorCode    = 1001;
                    MeasurList.ErrorMessage = "";
                    return(MeasurList);
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetMeasurementList(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, AccountCode, AccountName, DeliveryFrom, DeliveryTo, out MeasurList))
                {
                    MeasurList.ErrorCode    = 0;
                    MeasurList.ErrorMessage = "";
                }
                else
                {
                    MeasurList.ErrorCode    = -1;
                    MeasurList.ErrorMessage = "Failed to get Employee List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }
            return(MeasurList);
        }
Exemplo n.º 5
0
        public static JsonResults GetSeriesMaster(int SeriesMasterID)
        {
            JsonResults SeriesList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    SeriesList.ErrorCode    = 1001;
                    SeriesList.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.GetSeriesMaster(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, SeriesMasterID, out SeriesList))
                {
                    SeriesList.ErrorCode    = 0;
                    SeriesList.ErrorMessage = "";
                }
                else
                {
                    SeriesList.ErrorCode    = -1;
                    SeriesList.ErrorMessage = "Failed to get Series List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(SeriesList);
        }
Exemplo n.º 6
0
        public async Task <object> EditEntertainment_Center(Entertainment_CentersRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var entertainment_Center = await _entertainmentCenterService.GetEntertainment_Center(request.Id);

                if (entertainment_Center == null)
                {
                    return(JsonResults.Error(404, "It`s entertainment center not found"));
                }

                entertainment_Center.Name      = request.Name;
                entertainment_Center.Owner     = request.Owner;
                entertainment_Center.Address   = request.Address;
                entertainment_Center.Phone     = request.Phone;
                entertainment_Center.Email     = request.Email;
                entertainment_Center.IsParking = request.IsParking;

                await _entertainmentCenterService.UpdateEntertainment_Center(entertainment_Center);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 7
0
        public async Task <object> AddEntertainment_Center(Entertainment_CentersRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var model = new Entertainment_Centers
                {
                    Name      = request.Name,
                    Owner     = request.Owner,
                    Address   = request.Address,
                    Phone     = request.Phone,
                    Email     = request.Email,
                    IsParking = request.IsParking
                };

                await _entertainmentCenterService.AddEntertainment_Center(model);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 8
0
        // Method that searches the iTunes API for a given input string.
        // Input Parameters: SearchString - String - Spaces are replaced with + symbol
        // The method fetches top 50 search results from the iTunes API and Deserializes it into JSON object and sends to View.
        // Return: View with Deserialized JSON object containing Result Count and Results
        public ActionResult Search(string searchString)
        {
            JsonResults ApiResults = new JsonResults();

            searchString = searchString.Replace(" ", "+");
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://itunes.apple.com/search?term=" + searchString);
                try
                {
                    var responseTask = client.GetAsync(client.BaseAddress);
                    responseTask.Wait();
                    var result = responseTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        var readTask = result.Content.ReadAsStringAsync();
                        readTask.Wait();
                        ApiResults         = JsonConvert.DeserializeObject <JsonResults>(readTask.Result);
                        ApiResults.Results = ApiResults.Results.FindAll(item => item.Id != 0).ToList();
                    }
                }
                catch (Exception e)
                {
                    ViewBag.Message = "Error occured while fetching from iTunes API. Potential exception - " + e.Message;
                    return(View("Exception"));
                }
            }
            return(View(ApiResults));
        }
        public JsonResult GetServiceResource()
        {
            var json = new JsonResults();
            var rm   = new ResultModel();

            try
            {
                int       siteId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SiteId"]);
                DataTable dt     = CRBIYYBBReportProjectRule.Intance().GetServiceResource();
                List <ResourceMonitoringViewModel> list = CRBICommonLib.ModelConvertHelper <ResourceMonitoringViewModel> .ConvertToModel(dt);

                if (list.Count <= 0)
                {
                    rm.Message = "未查询到相关数据!";
                    rm.Status  = false;
                    json.Data  = rm;
                    return(json);
                }
                ResourceMonitoringViewModel model = list[0];
                rm.Result = model;
                rm.Status = true;
            }
            catch (Exception ex)
            {
                rm.Message = ex.Message;
                rm.Status  = false;
            }
            json.Data = rm;
            return(json);
        }
Exemplo n.º 10
0
        public static JsonResults SearchItems(string searchText)
        {
            JsonResults custList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    custList.ErrorCode    = -1001;
                    custList.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.SearchItems(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, searchText, out custList))
                {
                    custList.ErrorCode    = 0;
                    custList.ErrorMessage = "";
                }
                else
                {
                    custList.ErrorCode    = -1;
                    custList.ErrorMessage = "Failed to get Items List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(custList);
        }
Exemplo n.º 11
0
        public static JsonResults GetCustomerList(string BirthDate)
        {
            JsonResults custList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    custList.ErrorCode    = -1001;
                    custList.ErrorMessage = "";
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetCustomerList(currentUser.CompanyID, currentUser.UserId, BirthDate, out custList))
                {
                    custList.ErrorCode    = 0;
                    custList.ErrorMessage = "";
                }
                else
                {
                    custList.ErrorCode    = -1;
                    custList.ErrorMessage = "Failed to get Customer List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(custList);
        }
Exemplo n.º 12
0
        public static JsonResults GetLatestSeriesMaster()
        {
            JsonResults returnObj = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    returnObj.ErrorCode    = -1001;
                    returnObj.ErrorMessage = "";
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetLatestSeriesMaster(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, out returnObj))
                {
                    returnObj.ErrorCode    = 0;
                    returnObj.ErrorMessage = "";
                }
                else
                {
                    returnObj.ErrorCode    = customerObj.GetLastErrorCode();
                    returnObj.ErrorMessage = customerObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(returnObj);
        }
Exemplo n.º 13
0
        public static JsonResults GetUserBranch(string UserID)
        {
            JsonResults BranchList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    BranchList.ErrorCode    = 1001;
                    BranchList.ErrorMessage = "";
                    return(BranchList);
                }

                AdminManagerSP adminObj = new AdminManagerSP();
                if (adminObj.GetUserBranch(currentUser.CompanyID, currentUser.UserId, string.IsNullOrEmpty(UserID) ? 0 : Convert.ToInt32(UserID), true, out BranchList))
                {
                    BranchList.ErrorCode    = 0;
                    BranchList.ErrorMessage = "";
                }
                else
                {
                    BranchList.ErrorCode    = 1;
                    BranchList.ErrorMessage = "Failed to get branch List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(BranchList);
        }
Exemplo n.º 14
0
        public static JsonResults SelectBranch(int branchID)
        {
            JsonResults custList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    custList.ErrorCode    = -1001;
                    custList.ErrorMessage = "";
                }

                if (branchID != 0)
                {
                    currentUser.UserBranchID = branchID;
                    HttpContext.Current.Session["LoginUser"] = currentUser;
                    custList.ErrorCode    = 0;
                    custList.ErrorMessage = "";
                }
                else
                {
                    custList.ErrorCode    = -1;
                    custList.ErrorMessage = "Invalid Branch Selection";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(custList);
        }
Exemplo n.º 15
0
        public static JsonResults GetCompanyInfo()
        {
            JsonResults Measur = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    Measur.ErrorCode    = 1001;
                    Measur.ErrorMessage = "";
                    return(Measur);
                }

                CustomerManager adminObj = new CustomerManager();
                if (!adminObj.GetCompanyHeaderInfo(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, out Measur))
                {
                    Measur.ErrorCode    = adminObj.GetLastErrorCode();
                    Measur.ErrorMessage = adminObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Measur.ErrorCode    = -4;
                Measur.ErrorMessage = "Unknown Error Occured";
                Utils.Write(ex);
            }

            return(Measur);
        }
        public async Task <object> AddDiscount_Card(Discount_CardRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            var checkValidateCard = await _discount_CardService.CountDiscount_CardByNumberCard(request.Id, request.NumberCard);

            if (checkValidateCard)
            {
                return(JsonResults.Error(302, "This discount card is already in the database"));
            }

            try
            {
                var model = new Discount_Cards
                {
                    UserId     = request.UserId,
                    NumberCard = request.NumberCard,
                    ServiceId  = request.ServiceId
                };

                await _discount_CardService.AddDiscount_Card(model);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 17
0
        public JsonResult GetDutyOnDuty()
        {
            var json = new JsonResults();
            var rm   = new ResultModel();

            try
            {
                int       siteId                  = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SiteId"]);
                DataTable dtDutyOnDuty            = CRBIYYBBReportProjectRule.Intance().GetDutyOnDuty(siteId);
                DataTable dtDutyOnDutyRemaining   = CRBIYYBBReportProjectRule.Intance().GetDutyOnDutyRemaining(siteId);
                List <DutyOnDutyViewModel> listdd = CRBICommonLib.ModelConvertHelper <DutyOnDutyViewModel> .ConvertToModel(dtDutyOnDuty);

                List <DutyOnDutyRemainingViewModel> listddr = CRBICommonLib.ModelConvertHelper <DutyOnDutyRemainingViewModel> .ConvertToModel(dtDutyOnDutyRemaining);

                DutyOnDutyListViewModel dutyOnDutyListViewModel = new DutyOnDutyListViewModel();
                dutyOnDutyListViewModel.DutyOnDutyRemainingViewModel = listddr.Where(m => DateTime.Now > DateTime.Parse(m.ExecuteTime).AddDays(-7)).ToList();
                dutyOnDutyListViewModel.DutyOnDutyViewModel          = listdd.Where(m => DateTime.Now > DateTime.Parse(m.PlanTime).AddDays(-7)).ToList();
                rm.Result = dutyOnDutyListViewModel;
                rm.Status = true;
            }
            catch (Exception ex)
            {
                rm.Message = ex.Message;
                rm.Status  = false;
            }
            json.Data = rm;
            return(json);
        }
Exemplo n.º 18
0
        public static JsonResults AddNewCustomerToDB(Customer Customer, CustomerAccount CustomerAccountObj)
        {
            JsonResults returnObj = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    returnObj.ErrorCode    = -1001;
                    returnObj.ErrorMessage = "";
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.AddNewCustomer(currentUser.CompanyID, currentUser.UserId, currentUser.UserBranchID, ref Customer, ref CustomerAccountObj))
                {
                    returnObj.ErrorCode    = 0;
                    returnObj.ErrorMessage = "";
                }
                else
                {
                    returnObj.ErrorCode    = customerObj.GetLastErrorCode();
                    returnObj.ErrorMessage = customerObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(returnObj);
        }
Exemplo n.º 19
0
        public async Task <object> EditServiceToEC(Services_Entertainment_Centers request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var entertainment_Center = await _entertainmentCenterService.GetServiceToEC(request.Id);

                if (entertainment_Center == null)
                {
                    return(JsonResults.Error(404, "It`s Service in EC not found"));
                }

                entertainment_Center.ServiceId = request.ServiceId;

                await _entertainmentCenterService.UpdateServiceToEC(entertainment_Center);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 20
0
        public async Task <object> EditCategoryToService(Categories_Services request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var categoryToService = await _categoryService.GetCategoryService(request.Id);

                if (categoryToService == null)
                {
                    return(JsonResults.Error(404, "It`s category not found"));
                }

                categoryToService.IdCategories = request.IdCategories;

                await _categoryService.UpdateCategoryToService(categoryToService);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 21
0
        public async Task <object> AddServiceToEntertainment_Center(Services_Entertainment_CentersRequest request)
        {
            try
            {
                var isServiceContain = await _entertainmentCenterService.CheckServicesInEC(request.Entertainment_CenterId, request.ServiceId);

                if (isServiceContain)
                {
                    return(JsonResults.Error(406, "This entertainment center already has this service."));
                }

                var model = new Services_Entertainment_Centers
                {
                    Entertainment_CenterId = request.Entertainment_CenterId,
                    ServiceId = request.ServiceId
                };

                await _entertainmentCenterService.AddServiceInEntertainment_Center(model);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 22
0
        public async Task <object> GetCategoryService(int id)
        {
            var categoryService = await _categoryService.GetCategoryService(id);

            if (categoryService == null)
            {
                return(JsonResults.Error(errorNum: 404, errorMessage: "Categories in Service not found"));
            }

            var model = new Categories_ServicesResponse
            {
                Id           = categoryService.Id,
                IdCategories = categoryService.IdCategories,
                IdServices   = categoryService.IdServices,
                Category     = (new CategoryViewModel
                {
                    Id = categoryService.Category.Id,
                    Name = categoryService.Category.Name
                }),
                Service = (new ServicesViewModel
                {
                    Id = categoryService.Service.Id,
                    AgeFrom = categoryService.Service.AgeFrom,
                    Cost = categoryService.Service.Cost,
                    Description = categoryService.Service.Description,
                    Floor = categoryService.Service.Floor,
                    Hall = categoryService.Service.Hall,
                    Name = categoryService.Service.Name
                })
            };

            return(JsonResults.Success(model));
        }
Exemplo n.º 23
0
        public static JsonResults GetAccountList()
        {
            JsonResults returnObj = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    returnObj.ErrorCode    = 1001;
                    returnObj.ErrorMessage = "";
                    return(returnObj);
                }

                CustomerManager customerObj = new CustomerManager();
                if (customerObj.GetAccountList(currentUser.CompanyID, currentUser.UserId, out returnObj))
                {
                    returnObj.ErrorCode    = 0;
                    returnObj.ErrorMessage = "";
                }
                else
                {
                    returnObj.ErrorCode    = -1;
                    returnObj.ErrorMessage = "Failed to get Account List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(returnObj);
        }
Exemplo n.º 24
0
        public JsonResult GetOperationCycle()
        {
            var json = new JsonResults();
            var rm   = new ResultModel();

            try
            {
                string  filePath       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Setting.ini");
                IniFile ini            = new IniFile(filePath);
                string  defaultDateStr = ini.ReadString("FristOpenDate", "DateTime", "");
                if (string.IsNullOrEmpty(defaultDateStr))
                {
                    defaultDateStr = DateTime.Now.ToShortDateString();
                }
                DateTime nowDate     = DateTime.Now;
                DateTime defaultDate = DateTime.Parse(defaultDateStr);
                TimeSpan ts          = nowDate - defaultDate;
                rm.Result = ts.Days.ToString();
                rm.Status = true;
            }
            catch (Exception ex)
            {
                rm.Message = ex.Message;
                rm.Status  = false;
            }
            json.Data = rm;
            return(json);
        }
Exemplo n.º 25
0
        public static JsonResults GetEmployeeList()
        {
            JsonResults emplList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    emplList.ErrorCode    = 1001;
                    emplList.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.GetEmployeeList(currentUser.CompanyID, currentUser.UserId, false, out emplList))
                {
                    emplList.ErrorCode    = 0;
                    emplList.ErrorMessage = "";
                }
                else
                {
                    emplList.ErrorCode    = -1;
                    emplList.ErrorMessage = "Failed to get Employee List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(emplList);
        }
Exemplo n.º 26
0
        public async Task <object> AddUser(User request)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var model = new User
                {
                    FirstName        = request.FirstName,
                    LastName         = request.LastName,
                    Email            = request.Email,
                    Password         = _userService.HashPassword(request.Password),
                    IsAdministration = request.IsAdministration,
                    IsBlocked        = false,
                    DateRegistered   = DateTime.Now.Date,
                    BonusScore       = request.BonusScore
                };

                await _userService.AddUser(model);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
        public static JsonResults AddEditItemRate(string StartDate, string ItemPrice, int ItemRateID, int itemMasterID, string TotalGST,
                                                  string SGSTPer, string SGST, string CGSTPer, string CGST, string BillAmt)
        {
            JsonResults invoiceList = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    invoiceList.ErrorCode    = -1001;
                    invoiceList.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.AddEditItemRate(currentUser.CompanyID, currentUser.UserId, ItemRateID, itemMasterID, ItemPrice, StartDate, string.IsNullOrEmpty(TotalGST) ? 0 : Convert.ToSingle(TotalGST),
                                                string.IsNullOrEmpty(SGSTPer) ? 0 : Convert.ToSingle(SGSTPer), string.IsNullOrEmpty(SGST) ? 0 : Convert.ToSingle(SGST), string.IsNullOrEmpty(CGSTPer) ? 0 : Convert.ToSingle(CGSTPer),
                                                string.IsNullOrEmpty(CGST) ? 0 : Convert.ToSingle(CGST), string.IsNullOrEmpty(BillAmt) ? 0 : Convert.ToSingle(BillAmt)))
                {
                    invoiceList.ErrorCode    = 0;
                    invoiceList.ErrorMessage = "";
                }
                else
                {
                    invoiceList.ErrorCode    = customerObj.GetLastErrorCode();
                    invoiceList.ErrorMessage = customerObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(invoiceList);
        }
Exemplo n.º 28
0
        public async Task <object> EditUser(UserEditRequest user)
        {
            if (!ModelState.IsValid)
            {
                return(JsonResults.Error(400, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage.ToString()));
            }

            try
            {
                var users = await _userService.GetUser(user.Id);

                if (users == null)
                {
                    return(JsonResults.Error(404, "It`s user not found"));
                }

                users.FirstName = user.FirstName;
                users.LastName  = user.LastName;
                users.Country   = user.Country;
                users.City      = user.City;
                users.Address   = user.Address;
                users.Phone     = user.Phone;
                users.Email     = user.Email;
                users.Birsday   = user.Birsday;

                await _userService.UpdateUser(users);

                return(JsonResults.Success());
            }
            catch (Exception ex)
            {
                return(JsonResults.Error(400, ex.Message));
            }
        }
Exemplo n.º 29
0
        public static JsonResults GetPincodeDetails(string pincode)
        {
            JsonResults plist = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    plist.ErrorCode    = 1001;
                    plist.ErrorMessage = "";
                    return(plist);
                }

                AdminManagerSP adminObj = new AdminManagerSP();
                if (!adminObj.GetPincodeDetails(currentUser.CompanyID, currentUser.UserId, pincode, out plist))
                {
                    plist.ErrorCode    = adminObj.GetLastErrorCode();
                    plist.ErrorMessage = adminObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                plist.ErrorCode    = -4;
                plist.ErrorMessage = "Unknown Error Occured";
                Utils.Write(ex);
            }

            return(plist);
        }
Exemplo n.º 30
0
        public static JsonResults GetItemGroups()
        {
            JsonResults returnObj = new JsonResults();
            LoginUser   currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    returnObj.ErrorCode    = 1001;
                    returnObj.ErrorMessage = "";
                }

                AdminManagerSP customerObj = new AdminManagerSP();
                if (customerObj.GetPickLists(currentUser.CompanyID, currentUser.UserId, "ItemMasterGroup", out returnObj))
                {
                    returnObj.ErrorCode    = 0;
                    returnObj.ErrorMessage = "";
                }
                else
                {
                    returnObj.ErrorCode    = customerObj.GetLastErrorCode();
                    returnObj.ErrorMessage = customerObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(returnObj);
        }
Exemplo n.º 31
0
		private void MaybeAddFutureBatch(JsonResults past)
		{
			if (context.Configuration.MaxNumberOfParallelIndexTasks == 1)
				return;
			if (past.Results.Length == 0 || past.LoadedFromDisk == false)
				return;
			if (futureIndexBatches.Count > 5) // we limit the number of future calls we do
			{
				var alreadyLoaded = futureIndexBatches.Sum(x =>
				{
					if (x.Task.IsCompleted)
						return x.Task.Result.Results.Length;
					return 0;
				});

				if (alreadyLoaded > autoTuner.NumberOfItemsToIndexInSingleBatch)
					return;
			}

			// ensure we don't do TOO much future cachings
			if (MemoryStatistics.AvailableMemory < context.Configuration.AvailableMemoryForRaisingIndexBatchSizeLimit)
				return;

			// we loaded the maximum amount, there are probably more items to read now.
			var nextEtag = GetNextHighestEtag(past.Results);

			var nextBatch = futureIndexBatches.FirstOrDefault(x => x.StartingEtag == nextEtag);

			if (nextBatch != null)
				return;

			var futureBatchStat = new FutureBatchStats
			{
				Timestamp = SystemTime.UtcNow,
			};
			var sp = Stopwatch.StartNew();
			context.AddFutureBatch(futureBatchStat);
			futureIndexBatches.Add(new FutureIndexBatch
			{
				StartingEtag = nextEtag,
				Age = currentIndexingAge,
				Task = System.Threading.Tasks.Task.Factory.StartNew(() =>
				{
					var jsonDocuments = GetJsonDocuments(nextEtag);
					int localWork = workCounter;
					while (jsonDocuments.Results.Length == 0 && context.DoWork)
					{
						futureBatchStat.Retries++;

						if (context.WaitForWork(TimeSpan.FromMinutes(10), ref localWork, "PreFetching") == false)
							continue;

						jsonDocuments = GetJsonDocuments(nextEtag);
					}
					futureBatchStat.Duration = sp.Elapsed;
					futureBatchStat.Size = jsonDocuments.Results.Length;
					MaybeAddFutureBatch(jsonDocuments);
					return jsonDocuments;
				})
			});
		}