public async Task <IActionResult> CreateCarBrand(string Id, string TypeId)
        {
            ViewBag.IsEditMode = "false";
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            List <CarType> AuthorList = new List <CarType>();
            var            _ReCarType = ServiceExtension.RestshapExtension.CallRestApiGETEDIT(AuthorList, "http://192.168.10.46/sdapi/sdapi/CarTypeGet/" + Id + "/" + TypeId, Getkey());

            List <CarBrand> AuthorListdetail = new List <CarBrand>();
            CarBrand        _CarBrand        = new CarBrand();
            var             Call             = ServiceExtension.RestshapExtension.CallRestApiGETEDIT(AuthorListdetail, "http://192.168.10.46/sdapi/sdapi/CarBrandGet/" + Id + "/" + TypeId, Getkey());

            foreach (var item in Call)
            {
                _CarBrand.TypeCode    = item.TypeCode;
                _CarBrand.Description = "";
                _CarBrand.Active      = item.Active;
            }
            foreach (var sname in _ReCarType)
            {
                _CarBrand.CompCode     = _UserProfile.CompCode;
                _CarBrand.TypeCode     = sname.TypeCode;
                _CarBrand.TypeFullname = sname.TypeCode + " | " + sname.Description;
            }
            _CarBrand.CarBranList = Call;
            return(View("CreateCarBrand", _CarBrand));
        }
Beispiel #2
0
        public async Task <IActionResult> Index()
        {
            var UserCompCode = GetCurrenCompCode();
            var _CompCode    = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            List <Override> AuthorList = new List <Override> ();
            var             Call       = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/OverrideLevelGet/" + _CompCode.CompCode, Getkey());

            return(View(Call));
        }
Beispiel #3
0
        public IActionResult Index()
        {
            var UserCurrenCompCode = GetCurrenCompCode();
            var _UserProfile       = _IUserprofileRepository.GetUserProfile(UserCurrenCompCode);
            var year = ConvertYear();
            List <DocumentType> AuthorList = new List <DocumentType> ();
            var Call = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/DocumentTypeGet", Getkey());

            return(View(Call));
        }
Beispiel #4
0
        public async Task <IActionResult> Index()
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            List <Grade> AuthorList = new List <Grade> ();
            var          Call       = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/GradeGet?CompCode=" + _UserProfile.CompCode + "&CaneYear=" + ConvertYear(), Getkey());

            return(View(Call));
        }
Beispiel #5
0
        public async Task <IActionResult> Index()
        {
            var UserCurrenId = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCurrenId);

            var         year       = ConvertYear();
            List <Unit> AuthorList = new List <Unit>();
            var         Call       = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/UnitGet", Getkey());

            return(View(Call));
        }
Beispiel #6
0
        public async Task <IActionResult> Create()
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            var DocRunningmodel = new DocRunning()
            {
                CompCode = _UserProfile.CompCode,
            };

            ViewBag.IsEditMode = "false";
            return(View(DocRunningmodel));
        }
Beispiel #7
0
        public async Task <IActionResult> Create(QuotaViewModel _Quotamodel, string IsEditMode)
        {
            //*-------- Sen to save api
            QuotaType _Quotagetapi = new QuotaType()
            {
                TypeCode    = _Quotamodel.TypeCode,
                Description = _Quotamodel.Description
            };
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            if (ModelState.IsValid)
            {
                if (IsEditMode.Equals("false"))
                {
                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_Quotagetapi, "http://192.168.10.46/sdapi/sdapi/QuotaTypePost", Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "บันทึกข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                else
                {
                    QuotaType _Quota = new QuotaType()
                    {
                        TypeCode    = _Quotamodel.TypeCode,
                        Description = _Quotamodel.Description,
                        UpdateBy    = _UserProfile.EmployeeId,
                        Version     = 0,
                        UpdateDate  = ConvertDatetime(DateTime.UtcNow)
                    };

                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_Quota, "http://192.168.10.46/sdapi/sdapi/QuotaTypePut/" + _Quota.TypeCode, Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "แก้ไขข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View("Create", _Quotamodel));
        }
Beispiel #8
0
        public async Task <IActionResult> SaveCarTypeDetaill(CarTypeDetail _Cardetaill, string IsEditMode)
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            if (ModelState.IsValid)
            {
                if (IsEditMode.Equals("false"))
                {
                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_Cardetaill, "http://192.168.10.46/sdapi/sdapi/CarTypeDetailPost", Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "บันทึกข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                    }
                }
                else
                {
                    CarTypeDetail _CardetaillUP = new CarTypeDetail()
                    {
                        CompCode    = _Cardetaill.CompCode,
                        TypeCode    = _Cardetaill.TypeCode,
                        SubTypeCode = _Cardetaill.SubTypeCode,
                        Description = _Cardetaill.Description,
                        WeightIn    = _Cardetaill.WeightIn,
                        WeightOut   = _Cardetaill.WeightOut,
                        TotalFuel   = _Cardetaill.TotalFuel,
                        Active      = _Cardetaill.Active,
                        DeleteFlag  = _Cardetaill.DeleteFlag,
                        UpdateBy    = _UserProfile.EmployeeId,
                        UpdateDate  = ConvertDatetime(DateTime.UtcNow)
                    };

                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_CardetaillUP, "http://192.168.10.46/sdapi/sdapi/CarTypeDetailPut/" + _Cardetaill.CompCode + "/" + _Cardetaill.TypeCode + "/" + _Cardetaill.SubTypeCode, Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "แก้ไขข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                        return(RedirectToAction(nameof(CreateDetaill), new { Id = _Cardetaill.CompCode, TypeId = _Cardetaill.TypeCode }));
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                    }
                }
                return(RedirectToAction(nameof(CreateDetaill), new { Id = _Cardetaill.CompCode, TypeId = _Cardetaill.TypeCode }));
            }
            return(View("CreateDetaill", _Cardetaill));
        }
Beispiel #9
0
        public async Task <IActionResult> Create(Bank Bankmodel, string IsEditMode)
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            if (ModelState.IsValid)
            {
                if (IsEditMode.Equals("false"))
                {
                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(Bankmodel, "http://192.168.10.46/sdapi/sdapi/bankPost", Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "บันทึกข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                else
                {
                    Bank bankup = new Bank()
                    {
                        BankCode   = Bankmodel.BankCode,
                        BankName   = Bankmodel.BankName,
                        UpdateBy   = _UserProfile.EmployeeId,
                        UpdateDate = ConvertDatetime(DateTime.UtcNow)
                    };

                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(bankup, "http://192.168.10.46/sdapi/sdapi/bankPut/" + Bankmodel.BankCode, Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "แก้ไขข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View("Create", Bankmodel));
        }
Beispiel #10
0
        public async Task <IActionResult> Index()
        {
            var UserCompCode = GetCurrenCompCode();
            var _CompCode    = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            // var stopwatch = new Stopwatch ();
            // stopwatch.Start ();
            // List<GrowMethod> AuthorList = new List<GrowMethod> ();
            // List<GrowMethod> GrowMethod;
            // if (!_memorycahe.TryGetValue ("GrowMethod", out GrowMethod)) {
            //     var Call1 = ServiceExtension.RestshapExtension.CallRestApiGET (AuthorList, "http://192.168.10.46/sdapi/sdapi/GrowMethodGet?CompCode=" + _CompCode.CompCode + "&CaneYear=" + ConvertYear (), Getkey ());
            //     _memorycahe.Set ("GrowMethod", Call1);
            // }
            // GrowMethod = _memorycahe.Get ("GrowMethod") as List<GrowMethod>;
            // stopwatch.Stop ();
            // ViewBag.Totaltime = stopwatch.Elapsed;
            List <GrowMethod> AuthorList = new List <GrowMethod>();

            var Call1 = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/GrowMethodGet?CompCode=" + _CompCode.CompCode + "&CaneYear=" + ConvertYear(), Getkey());


            return(View(Call1));
        }
        public async Task <IActionResult> CreateCarMinor(string Id, string TypeId, string SubTypeId)
        {
            ViewBag.IsEditMode = "false";
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            List <CarType> AuthorList = new List <CarType>();
            var            _ReCarType = ServiceExtension.RestshapExtension.CallRestApiGETEDIT(AuthorList, "http://192.168.10.46/sdapi/sdapi/CarTypeGet/" + Id + "/" + TypeId, Getkey());

            List <CarTypeDetail> AuthorListCarDetail = new List <CarTypeDetail>();
            var _ReCarTypeDetail = ServiceExtension.RestshapExtension.CallRestApiGETEDIT(AuthorListCarDetail, "http://192.168.10.46/sdapi/sdapi/CarTypeDetailGet/" + Id + "/" + TypeId + "/" + SubTypeId, Getkey());

            List <CarTypeMinor> AuthorListdetail = new List <CarTypeMinor>();
            CarTypeMinor        _CarTypeMinor    = new CarTypeMinor();
            var Call = ServiceExtension.RestshapExtension.CallRestApiGETEDIT(AuthorListdetail, "http://192.168.10.46/sdapi/sdapi/CarTypeDetailDescGet/" + Id + "/" + TypeId + "/" + SubTypeId, Getkey());

            foreach (var item in Call)
            {
                _CarTypeMinor.TypeCode    = item.TypeCode;
                _CarTypeMinor.Description = "";
                _CarTypeMinor.Active      = item.Active;
            }
            foreach (var Sub in _ReCarTypeDetail)
            {
                _CarTypeMinor.CompCode    = _UserProfile.CompCode;
                _CarTypeMinor.SubTypeCode = Sub.SubTypeCode;
                _CarTypeMinor.SubFullname = Sub.SubTypeCode + " | " + Sub.Description;
            }
            foreach (var Type in _ReCarType)
            {
                _CarTypeMinor.TypeCode     = Type.TypeCode;
                _CarTypeMinor.TypeFullname = Type.TypeCode + " | " + Type.Description;
            }
            _CarTypeMinor.CarTypeMinorlist = Call;
            return(View("CreateCarMinor", _CarTypeMinor));
        }
        public async Task <IActionResult> Create(SaleAuthViewmodel _SaleAuth, string IsEditMode)
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            if (ModelState.IsValid)
            {
                if (IsEditMode.Equals("false"))
                {
                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_SaleAuth, "http://192.168.10.46/sdapi/sdapi/saleAuthPost", Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "บันทึกข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Create)));
                    }
                }
                else
                {
                    SaleAuth _SaleAuthUp = new SaleAuth()
                    {
                        SaleId     = _SaleAuth.SaleId,
                        RegionCode = _SaleAuth.RegionCode,
                        CompCode   = _SaleAuth.CompCode,
                        Position   = _SaleAuth.Position,
                        UpdateBy   = _UserProfile.EmployeeId,
                        Version    = 0,
                        UpdateDate = ConvertDatetime(DateTime.UtcNow)
                    };

                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_SaleAuthUp, "http://192.168.10.46/sdapi/sdapi/saleAuthPut/" + _SaleAuth.CompCodeEdit + "/" + _SaleAuth.SaleIdEdit + "/" + _SaleAuth.RegionCodeEdit, Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "แก้ไขข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                return(RedirectToAction(nameof(Create), new { _Id = _SaleAuth.SaleId }));
            }

            //*Dropdown sale ---------------------------
            List <SaleAuth> AuthorList = new List <SaleAuth> ();
            var             Call       = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/saleGet", Getkey());
            var             salefull   = new List <SaleAuth> ();

            foreach (var sname in Call)
            {
                salefull.Add(new SaleAuth {
                    SaleId       = sname.SaleId,
                    SaleFullname = sname.SaleId + " " + sname.SaleName
                });
            }
            List <SaleAuth> Companyget1 = new List <SaleAuth> ();
            var             Call2       = ServiceExtension.RestshapExtension.CallRestApiGET(Companyget1, "http://192.168.10.46/sdapi/sdapi/regionGet", Getkey());
            var             branch      = new List <SaleAuth> ();

            foreach (var users in Call2)
            {
                branch.Add(new SaleAuth {
                    RegionCode     = users.RegionCode,
                    RegCodeAndName = users.RegionCode + " " + users.NameTH
                });
            }
            ViewBag.sale       = salefull;
            ViewBag.branch     = branch;
            ViewBag.IsEditMode = "false";
            return(View(_SaleAuth));
        }
Beispiel #13
0
        public async Task <IActionResult> Create(Companysale _Companysalemodel, string IsEditMode)
        {
            var UserCompCode = GetCurrenCompCode();
            var _UserProfile = await _IUserprofileRepository.GetUserProfile(UserCompCode);

            if (ModelState.IsValid)
            {
                if (IsEditMode.Equals("false"))
                {
                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_Companysalemodel, "http://192.168.10.46/sdapi/sdapi/SalePost", Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "บันทึกข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                else
                {
                    Companysale _sale = new Companysale()
                    {
                        SaleId     = _Companysalemodel.SaleId,
                        SaleName   = _Companysalemodel.SaleName,
                        CompCode   = _Companysalemodel.CompCode,
                        BranchCode = _Companysalemodel.BranchCode,
                        UpdateBy   = _UserProfile.EmployeeId,
                        Version    = 0,
                        UpdateDate = ConvertDatetime(DateTime.UtcNow)
                    };

                    var _Re = ServiceExtension.RestshapExtension.CallRestApiPOST(_sale, "http://192.168.10.46/sdapi/sdapi/SalePut/" + _Companysalemodel.SaleId, Getkey());
                    if (_Re.success)
                    {
                        _clientNotification.AddSweetNotification("สำเร็จ",
                                                                 "แก้ไขข้อมูลเรียบร้อยแล้ว",
                                                                 NotificationHelper.NotificationType.success);
                    }
                    else
                    {
                        _clientNotification.AddSweetNotification("ผิดพลาด !!",
                                                                 _Re.message,
                                                                 NotificationHelper.NotificationType.error);
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            //*Dropdown sale ---------------------------
            List <Companysale> AuthorList = new List <Companysale> ();
            var Call = ServiceExtension.RestshapExtension.CallRestApiGET(AuthorList, "http://192.168.10.46/sdapi/sdapi/saleGet", Getkey());

            ViewBag.sale = Call;
            List <Companysale> Companyget = new List <Companysale> ();
            var Call1 = ServiceExtension.RestshapExtension.CallRestApiGET(Companyget, "http://192.168.10.46/sdapi/sdapi/companyGet", Getkey());
            List <Companysale> Companyget1 = new List <Companysale> ();
            var Call2  = ServiceExtension.RestshapExtension.CallRestApiGET(Companyget1, "http://192.168.10.46/sdapi/sdapi/branchGet", Getkey());
            var branch = new List <Companysale> ();

            foreach (var users in Call2)
            {
                branch.Add(new Companysale {
                    BranchCode     = users.BranchCode,
                    DpComIdandname = users.BranchCode + " " + users.NameTH
                });
            }
            ViewBag.sale       = Call;
            ViewBag.company    = Call1;
            ViewBag.branch     = branch;
            ViewBag.IsEditMode = "false";
            return(View("Create", _Companysalemodel));
        }