예제 #1
0
        public ResultModels InsertUnit(UnitOfMeasureModel model)
        {
            ResultModels result = new ResultModels();

            result.IsOk = true;
            using (var cxt = new NuWebContext())
            {
                //check code
                var itemDb = cxt.I_UnitOfMeasure.Where(ww => ww.Code.ToUpper() == model.Code.Trim().ToUpper()).FirstOrDefault();
                if (itemDb != null)
                {
                    result.IsOk    = false;
                    result.Message = "UOM is exist!";
                    return(result);
                }
                var item = new I_UnitOfMeasure();
                item.Id          = Guid.NewGuid().ToString();
                item.Code        = item.Code.Trim();
                item.Name        = item.Name;
                item.IsActive    = item.IsActive;
                item.UpdatedBy   = item.UpdatedBy;
                item.UpdatedDate = DateTime.Now;
                item.CreatedBy   = item.CreatedBy;
                item.CreatedDate = item.CreatedDate;
                item.Status      = (int)Commons.EStatus.Actived;
                cxt.I_UnitOfMeasure.Add(item);
                cxt.SaveChanges();
            }

            return(result);
        }
예제 #2
0
        public ResultModels EnableActive(List <string> lstId, bool active)
        {
            //if (!active)
            //{
            //    lstId = ListIngInActive(lstId);
            //}
            ResultModels data = new ResultModels();

            using (var cxt = new NuWebContext())
            {
                var lstObj = cxt.I_Supplier.Where(ww => lstId.Contains(ww.Id)).ToList();
                if (lstObj != null && lstObj.Count > 0)
                {
                    lstObj.ForEach(ss => ss.IsActived = active);
                    cxt.SaveChanges();
                    data.IsOk = true;
                }
                else
                {
                    data.IsOk    = false;
                    data.Message = "Not found!";
                }
            }
            return(data);
        }
 public ActionResult Delete(SettingSchedulerTaskModels model)
 {
     try
     {
         ResultModels result = _factory.DeleteUpdateCurrentSchedulerTask(model);
         if (result.IsOk)
         {
             //return RedirectToAction("Index");
         }
         else
         {
             model.GetListReportName();
             model.ReportName = model.ListNameReport.Where(o => o.Value.Equals(model.ReportId)).Select(s => s.Text).FirstOrDefault();
             ModelState.AddModelError("ReportId", "Have a error when you deleted an Scheduler Report");
             Response.StatusCode = (int)HttpStatusCode.BadRequest;
             return(PartialView("_Delete", model));
         }
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
     catch (Exception ex)
     {
         _logger.Error("SchedulerTaskModels_Delete: " + ex);
         ModelState.AddModelError("Name", "Have a error when you deleted an Scheduler Report");
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         return(PartialView("_Delete", model));
     }
 }
예제 #4
0
        public bool Update(DataEntryModels model, ref string msg)
        {
            bool         result       = true;
            ResultModels resultModels = new ResultModels();

            using (NuWebContext cxt = new NuWebContext())
            {
                using (var transaction = cxt.Database.BeginTransaction())
                {
                    try
                    {
                        var itemUpdate = (from tb in cxt.I_DataEntry
                                          where tb.Id == model.Id
                                          select tb).FirstOrDefault();

                        itemUpdate.ModifierBy   = model.ModifierBy;
                        itemUpdate.ModifierDate = model.ModifierDate;
                        itemUpdate.IsActived    = model.IsActived;

                        //Detail
                        //Check item insert
                        var lstDetailId = model.ListItem.Select(ss => ss.Id).ToList();
                        if (lstDetailId != null && lstDetailId.Count > 0)
                        {
                            var lstDetailUpdate = cxt.I_DataEntryDetail.Where(ww => lstDetailId.Contains(ww.Id)).ToList();
                            foreach (var item in model.ListItem)
                            {
                                var obj = lstDetailUpdate.Where(ww => ww.Id == item.Id).FirstOrDefault();
                                if (obj != null)
                                {
                                    obj.Damage   = item.Damage;
                                    obj.Wastage  = item.Wast;
                                    obj.OrderQty = item.OrderQty;
                                    obj.Reasons  = item.Reasons;
                                }
                            }
                        }

                        cxt.SaveChanges();
                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        _logger.Error(ex);
                        result = false;
                        transaction.Rollback();
                    }
                    finally
                    {
                        if (cxt != null)
                        {
                            cxt.Dispose();
                        }
                    }
                }
            }

            return(result);
        }
예제 #5
0
        public ResultModels ExecuteLoginExtend(LoginModel model)
        {
            ResultModels result = new ResultModels();
            string       url    = model.UrlWebHost + "/" + Commons.LoginExtend;

            result = (ResultModels)ApiResponse.PostWithoutHostConfig <ResultModels>(url, null, model);
            return(result);
        }
예제 #6
0
        public ResultModels InsertIndustry(List <IndustryModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                IndustryFactory IndustryFactory = new IndustryFactory();
                //result.IsOk = IndustryFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #7
0
        public ResultModels InsertStore(List <StoreModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null)
            {
                //StoreFactory storeFactory = new StoreFactory();
                //result.IsOk = storeFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #8
0
        public ResultModels InsertCompany(List <CompanyModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                CompanyFactory CompanyFactory = new CompanyFactory();
                // result.IsOk = CompanyFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #9
0
        //public ResultModels InsertUser(List<UserModels> lstInfo)
        //{
        //    var result = new ResultModels();
        //    if (lstInfo != null && lstInfo.Any())
        //    {
        //        UserFactory userFactory = new UserFactory();
        //        result.IsOk = userFactory.Insert(lstInfo);
        //    }
        //    return result;
        //}
        public ResultModels LoginExtend(LoginModel request)
        {
            var result = new ResultModels();

            if (request != null && !string.IsNullOrEmpty(request.Email))
            {
                UserFactory userFactory = new UserFactory();
                result = userFactory.LoginExtend(request);
            }
            return(result);
        }
예제 #10
0
        public ResultModels InsertOrderPaid(List <OrderPaidModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                OrderPaidFactory OrderPaidFactory = new OrderPaidFactory();
                //result.IsOk = OrderPaidFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #11
0
        public ResultModels InsertOrganization(List <OrganizationModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                //OrganizationFactory organizationFactory = new OrganizationFactory();
                //result.IsOk = organizationFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #12
0
        public ResultModels InsertShiftLog(List <ShiftLogModels> lstShiftLogs)
        {
            NSLog.Logger.Info("Start insert ShiftLog data.......................", lstShiftLogs);
            var result = new ResultModels();

            if (lstShiftLogs != null && lstShiftLogs.Any())
            {
                DailySalesReportFactory dailySalesReportFactory = new DailySalesReportFactory();
                result.IsOk = dailySalesReportFactory.InsertShiftLogs(lstShiftLogs);
            }
            return(result);
        }
예제 #13
0
        public ResultModels InsertDailySalesReport(List <DailySalesReportInsertModels> lstInfo)
        {
            NSLog.Logger.Info("Start insert Daily sale data.......................", lstInfo);
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                DailySalesReportFactory dailySalesReportFactory = new DailySalesReportFactory();
                result.IsOk = dailySalesReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #14
0
        public ResultModels GenerateReceiptNote(GenerateReceiptNoteApiModels request)
        {
            NSLog.Logger.Info("XeroGenerateReceiptNoteApi.......................", request);
            var result = new ResultModels();

            if (request != null)
            {
                XeroFactory _facXero = new XeroFactory();
                result = _facXero.GenerateReceiptNoteAPI(request);
            }
            return(result);
        }
        public ResultModels InsertDailyDetailItemSaleReport(List <DailyItemizedSalesReportDetailPushDataModels> lstInfo)
        {
            NSLog.Logger.Info("Start insert daily item sale detail data.......................", lstInfo);
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                DailyItemizedSalesReportDetailFactory dailyItemSalesReportFactory = new DailyItemizedSalesReportDetailFactory();
                result.IsOk = dailyItemSalesReportFactory.Insert(lstInfo);
            }
            return(result);
        }
        public ResultModels InsertTimeClockReport(List <TimeClockReportModels> lstInfo)
        {
            NSLog.Logger.Info("Start insert [TimeClock for Migration] data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                TimeClockReportFactory timeClockReportFactory = new TimeClockReportFactory();
                result.IsOk = timeClockReportFactory.InsertForMigration(lstInfo);
            }
            return(result);
        }
예제 #17
0
        public ResultModels UpdatePosApiEmployeeConfig(EmployeeConfigApiModels info)
        {
            //_logger.Info(info);
            NSLog.Logger.Info("Start [Update Pos Api Employee Config from POS] data.......................", info);

            var result = new ResultModels();

            if (info != null)
            {
                result.IsOk = _POSMerchantConfigFactory.UpdateEmployee(info);
            }
            return(result);
        }
        public ResultModels InsertTopSellingProductsReport(List <TopSellingProductsReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            NSLog.Logger.Info("Start insert Top Selling data.......................", lstInfo);
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                TopSellingProductsReportFactory topSellingProductsReportFactory = new TopSellingProductsReportFactory();
                result.IsOk = topSellingProductsReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #19
0
        public ResultModels InsertPaymentMenthod(List <PaymentModels> lstInfo)
        {
            NSLog.Logger.Info("Start insert order paid sale data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                OrderPaymentMethodFactory PaymentMenthodFactory = new OrderPaymentMethodFactory();
                result.IsOk = PaymentMenthodFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #20
0
        public ResultModels InsertTax(List <TaxModels> lstInfo)
        {
            NSLog.Logger.Info("Start insert Tax data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                TaxFactory taxFactory = new TaxFactory();
                result.IsOk = taxFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #21
0
        public ResultModels InsertDataSaleFromPOS(PosSaleReportReturnModels datas)
        {
            NSLog.Logger.Info("Start InsertDataSaleFromPOS (Pos Sale).......................", datas);

            var result = new ResultModels();

            if (datas != null && (datas.PosSaleReportDTOs != null && datas.PosSaleReportDTOs.Any()))
            {
                PosSaleFactory posSaleFactory = new PosSaleFactory();
                result.IsOk = posSaleFactory.Insert(datas);
            }
            return(result);
        }
예제 #22
0
        public ResultModels InsertOrderTip(List <OrderTipModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert OrderTip data.......................");
            NSLog.Logger.Info("Start insert Order Tip data.......................", lstInfo);
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                OrderTipFactory orderTipFactory = new OrderTipFactory();
                result.IsOk = orderTipFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #23
0
        public ActionResult Edit(SettingSchedulerTaskModels model)
        {
            try
            {
                //model.GetDateOfWeek();
                //===============
                var           user = System.Web.HttpContext.Current.Session["User"] as UserSession;
                List <string> listOrganizationId = new List <string>();
                if (user != null)
                {
                    listOrganizationId = user.ListOrganizationId;
                }
                var storeName = model.GetDataStore(listOrganizationId).Where(x => x.Value == model.StoreId).Select(x => x.Text).FirstOrDefault();
                model.StoreName = storeName;
                //string DayOfWeeks = "";
                //if (Request.Form["DayOfWeeks"] == null)
                //{
                //    //ModelState.AddModelError("DayOfWeeks", "Please choose Day of week!!!");
                //    DayOfWeeks = Request.Form["DoW"].ToString();
                //}
                //else
                //{
                //    DayOfWeeks = Request.Form["DayOfWeeks"].ToString();
                //}
                //model.DayOfWeeks = DayOfWeeks;
                if (!ModelState.IsValid)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(PartialView("_Edit", model));
                }

                ResultModels result = _factory.UpdateCurrentSchedulerTask(model);
                if (result.IsOk) // Success
                {
                    //return RedirectToAction("Index");
                    return(new HttpStatusCodeResult(HttpStatusCode.OK));
                }
                else //Fail
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(PartialView("_Edit", model));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Organization_Edit: " + ex);
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(PartialView("_Edit", model));
            }
        }
예제 #24
0
        public ResultModels InserNoIncludeOnSaleReport(List <NoIncludeOnSaleDataReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert NoIncludeOnSale data.......................");
            NSLog.Logger.Info("Start NoIncludeOnSale data.......................", lstInfo);
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                NoIncludeOnSaleDataFactory noIncludeOnSaleDataFactory = new NoIncludeOnSaleDataFactory();
                result.IsOk = noIncludeOnSaleDataFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #25
0
        public ResultModels InsertHourlySalesReport(List <HourlySalesReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert HourlySales data.......................");
            NSLog.Logger.Info("Start insert Hourly Sales data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                HourlySalesReportFactory hourlySalesReportFactory = new HourlySalesReportFactory();
                result.IsOk = hourlySalesReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #26
0
        public ResultModels InsertBusinessDay(List <BusinessDayModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert BusinessDay data.......................");
            NSLog.Logger.Info("Start insert Business Day data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                BusinessDayFactory businessDayFactory = new BusinessDayFactory();
                result.IsOk = businessDayFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #27
0
        public ResultModels InsertReceiptsbyPaymentMethodsReport(List <ReceiptsbyPaymentMethodsReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert ReceiptsbyPaymentMethods data.......................");
            NSLog.Logger.Info("Start insert Receipts by Payment Methods data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                ReceiptsbyPaymentMethodsReportFactory receiptsbyPaymentMethodsReportFactory = new ReceiptsbyPaymentMethodsReportFactory();
                result.IsOk = receiptsbyPaymentMethodsReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #28
0
        public ResultModels InsertTimeClockReport(List <TimeClockReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert TimeClock data.......................");
            NSLog.Logger.Info("Start insert Time Clock data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                TimeClockReportFactory timeClockReportFactory = new TimeClockReportFactory();
                result.IsOk = timeClockReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #29
0
        public ResultModels InsertDailyReceiptReport(List <DailyReceiptReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert DailyReceipt data.......................");
            NSLog.Logger.Info("Start insert Daily Receipt data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                DailyReceiptReportFactory dailyReceiptReportFactory = new DailyReceiptReportFactory();
                result.IsOk = dailyReceiptReportFactory.Insert(lstInfo);
            }
            return(result);
        }
예제 #30
0
        public ResultModels InsertAuditTrailReport(List <AuditTrailReportModels> lstInfo)
        {
            //_logger.Info("==========================================================");
            //_logger.Info("Start insert AuditTrailReport data.......................");
            NSLog.Logger.Info("Start insert Audit Trail data.......................", lstInfo);

            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                AuditTrailReportFactory auditTrailReportFactory = new AuditTrailReportFactory();
                result.IsOk = auditTrailReportFactory.Insert(lstInfo);
            }
            return(result);
        }