Ejemplo n.º 1
0
            /// <summary>
            /// Return Affected Row Or Error If Exist
            /// </summary>
            /// <param name="request">ConditionProduct Information</param>
            /// <returns>Affected Row Or Error If Exist</returns>
            public static GetConditionProductResponse ConditionProduct(GetConditionProductResponse request)
            {
                GetConditionProductResponse response = new GetConditionProductResponse();

                response.Error = new Handler.ErrorObject();
                try
                {
                    tblConditionProduct CellarArea = new tblConditionProduct()
                    {
                        id         = request.ConditionProduct.id,
                        name       = request.ConditionProduct.name,
                        detail     = request.ConditionProduct.detail,
                        createDate = request.ConditionProduct.createDate,
                        upDateDate = DateTime.Now,
                        deleteDate = null,
                        state      = "Active"
                    };

                    var result = ConditionProductData.Update.ConditionProduct(CellarArea);
                    if (result.Item1.Error)
                    {
                        response.Error.InfoError(result.Item1);
                    }
                    else
                    {
                        response.Message = result.Item2;
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Return ConditionProduct Information
            /// </summary>
            /// <param name="request">ConditionProduct ID</param>
            /// <returns>ConditionProduct Information</returns>
            public static GetConditionProductResponse GetConditionProduct(GetConditionProductRequest request)
            {
                GetConditionProductResponse response = new GetConditionProductResponse();

                response.Error            = new Handler.ErrorObject();
                response.ConditionProduct = new ConditionProduct();
                try
                {
                    var GetCellarArea = ConditionProductData.Select.GetConditionProduct(request.ConditionProductID);
                    if (!GetCellarArea.Item1.Error)
                    {
                        response.ConditionProduct = new ConditionProduct()
                        {
                            id         = GetCellarArea.Item2.id,
                            name       = GetCellarArea.Item2.name,
                            detail     = GetCellarArea.Item2.detail,
                            createDate = GetCellarArea.Item2.createDate,
                            upDateDate = GetCellarArea.Item2.upDateDate,
                            deleteDate = GetCellarArea.Item2.deleteDate,
                            state      = GetCellarArea.Item2.state
                        };
                    }
                    else
                    {
                        response.Error.InfoError(GetCellarArea.Item1);
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }
Ejemplo n.º 3
0
            /// <summary>
            /// Return Affected Row Or Error If Exist
            /// </summary>
            /// <param name="ConditionProductID">Cellar Area ID</param>
            /// <param name="state">State</param>
            /// <returns>Affected Row Or Error If Exist</returns>
            public static GetConditionProductResponse ConditionProductDisable(int ConditionProductID, string state)
            {
                GetConditionProductResponse response = new GetConditionProductResponse();

                try
                {
                    var result = ConditionProductData.Delete.ConditionProductDisable(ConditionProductID, state);
                    if (result.Item1.Error)
                    {
                        response.Error.InfoError(result.Item1);
                    }
                    else
                    {
                        response.Message = result.Item2;
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }
                return(response);
            }
Ejemplo n.º 4
0
            /// <summary>
            /// Return ConditionProduct List
            /// </summary>
            /// <returns>ConditionProduct List</returns>
            public static GetConditionProductResponse GetConditionProductList()
            {
                GetConditionProductResponse response = new GetConditionProductResponse();

                response.ConditionProductList = new List <ConditionProduct>();
                response.Error = new Handler.ErrorObject();

                try
                {
                    var GetCellarArea = ConditionProductData.Select.GetConditionProductList();
                    if (!GetCellarArea.Item1.Error)
                    {
                        foreach (var item in GetCellarArea.Item2)
                        {
                            response.ConditionProductList.Add(new ConditionProduct()
                            {
                                id         = item.id,
                                name       = item.name,
                                detail     = item.detail,
                                createDate = item.createDate,
                                upDateDate = item.upDateDate,
                                deleteDate = item.deleteDate,
                                state      = item.state
                            });
                        }
                    }
                    else
                    {
                        response.Error.InfoError(GetCellarArea.Item1);
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }
                return(response);
            }