예제 #1
0
        private void loadSupplier()
        {
            SupplierBL supplierBL = new SupplierBL();

            cmbSupplier.DataSource     = supplierBL.GetSuppliers(false);
            cmbSupplier.DataTextField  = "name";
            cmbSupplier.DataValueField = "supplierID";
            cmbSupplier.DataBind();
        }
예제 #2
0
        public List <SupplierDetailEntity> GetSupplierList()
        {
            ISupplierBL _supplierBL = new SupplierBL();

            List <SupplierDetailEntity> SupplierList = new List <SupplierDetailEntity>();

            SupplierList = _supplierBL.GetSupplierList();
            return(SupplierList);
        }
예제 #3
0
        /// <summary>
        /// Login (based on Email and Password)
        /// </summary>
        /// <returns></returns>
        static async Task <(UserType, IUser)> ShowLoginScreen()
        {
            //Read inputs
            string email, password;

            WriteLine("=====LOGIN=========");
            Write("Email: ");
            email = ReadLine();
            Write("Password: "******"Invalid Email or Password. Please try again...");
            return(UserType.Anonymous, null);
        }
예제 #4
0
        /// <summary>
        /// Gets all customers.
        /// </summary>
        /// <returns>Get All Customers</returns>
        public IEnumerable <SupplierDetailEntity> GetAllSupplier()
        {
            ISupplierBL _supplierBL = new SupplierBL();

            IList <SupplierDetailEntity> SupplierList = new List <SupplierDetailEntity>();


            SupplierList = _supplierBL.GetAllSupplier();
            return(SupplierList);
        }
예제 #5
0
        public SupplierController()
        {
            string connectionString = "Server=tcp:lasmargaritas.database.windows.net,1433;Initial Catalog=LasMargaritasDBDev;Persist Security Info=False;User ID=LasMargaritasDbUser;Password=LasMargaritasPassw0rd!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";

            if (ConfigurationManager.ConnectionStrings["LasMargaritasDb"] != null)
            {
                connectionString = ConfigurationManager.ConnectionStrings["LasMargaritasDb"].ConnectionString;
            }
            supplierBL = new SupplierBL(connectionString);
        }
예제 #6
0
        public static List <string> GetSupplierCodes()
        {
            List <SupplierVM> suppList     = SupplierBL.GetAllSupp();
            List <string>     suppCodeList = new List <string>();

            foreach (SupplierVM s in suppList)
            {
                suppCodeList.Add(s.SuppCode);
            }
            return(suppCodeList);
        }
예제 #7
0
        protected override ResultMessage Delete()
        {
            var bl = new SupplierBL();
            var rm = bl.Delete(this.Current);

            if (rm.Result == false)
            {
                Utility.ShowError(string.Format("{0}'{1}'{2}", this.Title, this.Current.SupplierName, rm.Message), this);
            }
            return(rm);
        }
예제 #8
0
        protected override ResultMessage Create()
        {
            var bl = new SupplierBL();

            this.Current  = bl.Create();
            this.Original = CopyEntity(this.Current);

            var result  = this.Current != null;
            var message = result ? "" : "err";

            return(new ResultMessage(result, message));
        }
예제 #9
0
        public List <TaxModel> GetTaxCodeAndRatesList()
        {
            ISupplierBL _supplierBL = new SupplierBL();

            var cTaxRateList = _supplierBL.GetTaxCodeAndRate();

            if (cTaxRateList != null)
            {
                cTaxRateList = cTaxRateList.FindAll(x => x.IsInActive != "Y");
            }
            return(cTaxRateList);
        }
예제 #10
0
 public HttpResponseMessage GetSupplier(int?id)
 {
     try
     {
         var data = new SupplierBL().GetSupplier(id);
         return(Request.CreateResponse(HttpStatusCode.OK, data));
     }
     catch (Exception ex)
     {
         LogManager.Instance.Error(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError));
     }
 }
예제 #11
0
        protected override ResultMessage Save_Update()
        {
            var bl = new SupplierBL();

            var rm = bl.Update(this.Original, this.Current);

            if (rm.Result)
            {
                this.Original = CopyEntity(this.Current);
            }

            return(rm);
        }
예제 #12
0
        private void loadIntoForm()
        {
            CategoryBL categoryBL = new CategoryBL();

            //cmbCategory.DataSource = categoryBL.GetCategories();
            cmbCategory.DataSource     = categoryBL.GetNestedCategoriesDataTable(true, true);
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            SupplierBL supplierBL = new SupplierBL();

            cmbSupplier.DataSource     = supplierBL.GetSuppliers(true);
            cmbSupplier.DataTextField  = "name";
            cmbSupplier.DataValueField = "supplierID";
            cmbSupplier.DataBind();


            cmbApproved.Items.Add("Sve");
            cmbApproved.Items.Add("Odobrene");
            cmbApproved.Items.Add("Neodobrene");


            cmbActive.Items.Add("Sve");
            cmbActive.Items.Add("Aktivne");
            cmbActive.Items.Add("Neaktivne");

            cmbPageSize.Items.Add("10");
            cmbPageSize.Items.Add("20");
            cmbPageSize.Items.Add("50");
            cmbPageSize.Items.Add("100");
            cmbPageSize.Items.Add("Sve");

            BrandBL brandBL = new BrandBL();

            cmbBrand.DataSource     = brandBL.GetBrands(true);
            cmbBrand.DataTextField  = "name";
            cmbBrand.DataValueField = "brandID";
            cmbBrand.DataBind();

            cmbPromotions.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();

            cmbPromotion.DataSource     = new PromotionBL().GetPromotions(true, null, null);
            cmbPromotion.DataTextField  = "name";
            cmbPromotion.DataValueField = "promotionID";
            cmbPromotion.DataBind();
        }
        /// <summary>
        /// Updates Supplier.
        /// </summary>
        /// <returns></returns>
        public static async Task UpdateSupplier()
        {
            try
            {
                using (ISupplierBL supplierBL = new SupplierBL())
                {
                    //Read Sl.No
                    Write("Supplier #: ");
                    bool isNumberValid = int.TryParse(ReadLine(), out int serial);
                    if (isNumberValid)
                    {
                        serial--;
                        List <Supplier> suppliers = await supplierBL.GetAllSuppliersBL();

                        if (serial <= suppliers.Count - 1)
                        {
                            //Read inputs
                            Supplier supplier = suppliers[serial];
                            Write("Name: ");
                            supplier.SupplierName = ReadLine();
                            Write("Mobile: ");
                            supplier.SupplierMobile = ReadLine();
                            Write("Email: ");
                            supplier.Email = ReadLine();

                            //Invoke UpdateSupplierBL method to update
                            bool isUpdated = await supplierBL.UpdateSupplierBL(supplier);

                            if (isUpdated)
                            {
                                WriteLine("Supplier Updated");
                            }
                        }
                        else
                        {
                            WriteLine($"Invalid Supplier #.\nPlease enter a number between 1 to {suppliers.Count}");
                        }
                    }
                    else
                    {
                        WriteLine($"Invalid number.");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }
        /// <summary>
        /// Delete Supplier.
        /// </summary>
        /// <returns></returns>
        public static async Task DeleteSupplier()
        {
            try
            {
                using (ISupplierBL supplierBL = new SupplierBL())
                {
                    //Read Sl.No
                    Write("Supplier #: ");
                    bool isNumberValid = int.TryParse(ReadLine(), out int serial);
                    if (isNumberValid)
                    {
                        serial--;
                        List <Supplier> suppliers = await supplierBL.GetAllSuppliersBL();

                        if (serial <= suppliers.Count - 1)
                        {
                            //Confirmation
                            Supplier supplier = suppliers[serial];
                            Write("Are you sure? (Y/N): ");
                            string confirmation = ReadLine();

                            if (confirmation.Equals("Y", StringComparison.OrdinalIgnoreCase))
                            {
                                //Invoke DeleteSupplierBL method to delete
                                bool isDeleted = await supplierBL.DeleteSupplierBL(supplier.SupplierID);

                                if (isDeleted)
                                {
                                    WriteLine("Supplier Deleted");
                                }
                            }
                        }
                        else
                        {
                            WriteLine($"Invalid Supplier #.\nPlease enter a number between 1 to {suppliers.Count}");
                        }
                    }
                    else
                    {
                        WriteLine($"Invalid number.");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }
예제 #15
0
        public ActionResult Delete(decimal id)
        {
            try
            {
                SupplierBL _bl = new SupplierBL();

                decimal ck = _bl.Delete(id);
                return(Json(new { success = ck }));
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(Json(new { success = "-1" }));
            }
        }
예제 #16
0
        protected override ResultMessage Save_Create()
        {
            var bl    = new SupplierBL();
            int newID = 0;

            var rm = bl.Insert(this.Current, out newID);

            if (rm.Result)
            {
                this.Current.SupplierID = newID;
                this.Original           = CopyEntity(this.Current);
            }

            return(rm);
        }
예제 #17
0
        protected override ResultMessage CheckValid()
        {
            var result  = txtSupplierName.Text == string.Empty;
            var message = string.Format("{0}未填写,不能保存", txtSupplierName.LabelText);

            if (result)
            {
                txtSupplierName.Focus();
                Utility.ShowError(message, this);
                return(new ResultMessage(result, message));
            }

            var bl = new SupplierBL();

            return(bl.CheckValid(this.Current));
        }
예제 #18
0
 public ActionResult Register(SupplierInfo supplierinfo)
 {
     try
     {
         SupplierBL _bl = new SupplierBL();
         supplierinfo.Created_by   = "";
         supplierinfo.Created_date = DateTime.Now;
         decimal ck = _bl.Insert(supplierinfo);
         return(Json(new { success = ck }));
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(Json(new { success = "-1" }));
     }
 }
예제 #19
0
파일: DataMemory.cs 프로젝트: dangtq72/ATT
        public static List <SupplierInfo> Get_All_Supplier()
        {
            List <SupplierInfo> list = new List <SupplierInfo>();

            try
            {
                SupplierBL _BL = new SupplierBL();
                list = _BL.GetAll();
                return(list);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(new List <SupplierInfo>());
            }
        }
예제 #20
0
        public ActionResult Contract_Insert()
        {
            var supplyBl = new SupplierBL();
            List <SupplierInfo> lstSuppliers = new List <SupplierInfo>();

            try
            {
                lstSuppliers          = supplyBl.GetAll();
                ViewBag.ListSuppliers = lstSuppliers;
            }
            catch (Exception ex)
            {
                Common.log.Error(ex.ToString());
            }
            return(View("~/Areas/ModuleImport/Views/Contract/Contract_Insert.cshtml"));
        }
예제 #21
0
        // GET: RawMaterialOrder
        // URL : RawMaterialOrder/Create
        public async System.Threading.Tasks.Task <ActionResult> Create()
        {
            RawMaterialBL      rawMaterialBL = new RawMaterialBL();
            SupplierBL         supplierBL    = new SupplierBL();
            List <RawMaterial> rawMaterials  = await rawMaterialBL.GetAllRawMaterialsBL();

            List <Supplier> suppliers = await supplierBL.GetAllSuppliersBL();

            ViewBag.list1 = new SelectList(rawMaterials, "RawMaterialID", "RawMaterialName");
            ViewBag.list2 = new SelectList(suppliers, "SupplierID", "SupplierName");
            //Creating and initializing viewmodel object
            RawMaterialOrderViewModel rawMaterialOrderViewModel = new RawMaterialOrderViewModel();

            //Calling view and passing viewmodel object to view
            return(View(rawMaterialOrderViewModel));
        }
        // GET: api/Unit/5
        public ServerResponse Get(string id)
        {
            var res = new ServerResponse();

            using (SupplierBL SupplierBL = new SupplierBL())
            {
                try
                {
                    res.Data = SupplierBL.GetSupplier(id);
                }
                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
        // POST: api/Unit
        public ServerResponse Post([FromBody] Supplier Supplier)
        {
            var res = new ServerResponse();

            using (SupplierBL SupplierBL = new SupplierBL())
            {
                try
                {
                    res.Data = SupplierBL.SaveSupplier(Supplier);
                }
                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
예제 #24
0
        public ActionResult EditView(decimal id)
        {
            SupplierInfo _obj = new SupplierInfo();

            try
            {
                SupplierBL _bl = new SupplierBL();
                _obj = _bl.GetbyId(id);
            }
            catch (Exception ex)
            {
                _obj = new SupplierInfo();
                NaviCommon.Common.log.Error(ex.ToString());
            }
            ViewBag.Supplier = _obj;
            return(PartialView("~/Areas/ModuleBaseData/Views/Supplier/_Partial_Edit_Supplier.cshtml"));
        }
예제 #25
0
 public HttpResponseMessage GetSuppliers(string query)
 {
     try
     {
         var cmd        = JsonConvert.DeserializeObject <PaginationDTO>(query);
         int pagesCount = 0;
         var data       = new SupplierBL().GetSuppliers(cmd, ref pagesCount);
         var result     = Request.CreateResponse(HttpStatusCode.OK, data);
         result.Headers.Add(Consts.PAGES_COUNT, pagesCount.ToString());
         return(result);
     }
     catch (Exception ex)
     {
         LogManager.Instance.Error(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError));
     }
 }
예제 #26
0
        private void btnSupplierSearch_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            frmSupplier     frm = new frmSupplier("View");

            frm.ShowDialog();
            _SupplierId = frm._SupplierId;
            if (_SupplierId == null)
            {
                return;
            }

            SupplierBL  objSupplierBL  = new SupplierBL();
            supplierDto objSupplierDto = new supplierDto();

            objSupplierDto   = objSupplierBL.GetSupplier(ref objOperationResult, _SupplierId);
            txtSupplier.Text = objSupplierDto.v_Name;
        }
예제 #27
0
        public AjaxResult GetSuppliers()
        {
            var ajaxResult = new AjaxResult();

            try
            {
                using (SupplierBL supplierBL = new SupplierBL())
                {
                    ajaxResult.Data    = supplierBL.GetAllSupplierViewModel();
                    ajaxResult.Success = true;
                }
            }
            catch (Exception)
            {
                ajaxResult.Success   = false;
                ajaxResult.Messenger = "Có lỗi xảy ra khi lấy danh sách các nhà cung cấp để đổ dữ liệu xuống client. Vui lòng liên hệ MISA!";
            }
            return(ajaxResult);
        }
예제 #28
0
        public AjaxResult Get()
        {
            var ajaxresult = new AjaxResult();

            try
            {
                using (SupplierBL supplierBL = new SupplierBL()) {
                    ajaxresult.Data    = supplierBL.GetAllSupplier();
                    ajaxresult.Success = true;
                }
            }
            catch (Exception ex)
            {
                ajaxresult.Success = false;
                ajaxresult.Data    = ex;
                ajaxresult.Message = Resources.ErrorGetSupplier;
            }
            return(ajaxresult);
        }
예제 #29
0
        public async System.Threading.Tasks.Task <ActionResult> Index()
        {
            //Creating object of PersonsBL
            RawMaterialOrderBL rawMaterialOrderBL = new RawMaterialOrderBL();
            SupplierBL         supplierBL         = new SupplierBL();


            RawMaterialBL      rawMaterialBL = new RawMaterialBL();
            List <RawMaterial> rawMaterials  = await rawMaterialBL.GetAllRawMaterialsBL();

            ViewBag.list1 = new SelectList(rawMaterials, "RawMaterialName");

            //Getting list of persons from PersonsBL
            List <Rawmaterialorder1> rawMaterialOrders = await rawMaterialOrderBL.GetAllRawMaterialOrdersBL();

            //Create an empty collection of PersonViewModel
            List <RawMaterialOrderViewModel> rawMaterialOrderViewModel = new List <RawMaterialOrderViewModel>();

            //ServiceReference1.RawMaterialOrderServiceClient personsServiceClient = new ServiceReference1.RawMaterialOrderServiceClient();
            //ServiceReference1.RawMaterialOrderDataContract[] rawMaterialOrderDataContracts = personsServiceClient.GetAllRawMaterialOrder();
            ////Migrate (copy) data from EntityModel collection to ViewModel collection
            foreach (var item in rawMaterialOrders)
            {
                Supplier suppl = await supplierBL.GetSupplierBySupplierIDBL(item.SupplierID);

                RawMaterialOrderViewModel rawMaterialOrderVM = new RawMaterialOrderViewModel()
                {
                    //RawMaterialOrderID = item.RawMaterialOrderID,
                    //SupplierID = Convert.ToString(item.SupplierID),

                    RawMaterialOrderID = item.RawMaterialOrderID,

                    SupplierName             = suppl.SupplierName,
                    RawMaterialTotalPrice    = Convert.ToDouble(item.RawMaterialTotalPrice),
                    RawMaterialTotalQuantity = Convert.ToDouble(item.RawMaterialTotalQuantity)
                };
                rawMaterialOrderViewModel.Add(rawMaterialOrderVM);
            }

            //Call view & pass personVM collection to view
            return(View(rawMaterialOrderViewModel));
        }
예제 #30
0
        protected void btnAddAttributeValue_Click(object sender, EventArgs e)
        {
            switch (lblType.Value)
            {
            case "attribute":
            {
                AttributeBL attributeBL = new AttributeBL();
                attributeBL.SaveAttributeValue(new AttributeValue(-1, txtAttributeValue.Text, int.Parse(lblAttributeID.Value), 0, string.Empty, 0), false);

                foreach (object control in pnlAttributes.Controls)
                {
                    if (control is customControls.AttributeControl)
                    {
                        if (((customControls.AttributeControl)control).ID == lblAttributeName.Value)
                        {
                            ((customControls.AttributeControl)control).setValues();
                        }
                    }
                }
                break;
            }

            case "supplier":
            {
                SupplierBL supplierBL = new SupplierBL();
                supplierBL.SaveSupplier(new Supplier(-1, txtAttributeValue.Text));
                loadSupplier();
                break;
            }

            case "brand":
            {
                BrandBL brandBL = new BrandBL();
                brandBL.SaveBrand(new Brand(-1, txtAttributeValue.Text));
                loadBrands();
                break;
            }
            }
            txtAttributeValue.Text = string.Empty;
        }