Ejemplo n.º 1
0
        public PRO_tblStallDRO DeleteStall(string Username, string LanguageID, string StallIDList)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    string temp = "";
                    var db = scope.Resolve<IPRO_tblStallDAO>();
                    if (StallIDList.Contains("$"))
                        temp = db.DeleteStallList(StallIDList, Username, LanguageID);
                    else temp = db.DeleteStall(StallIDList, Username, LanguageID);

                    result.ResponseItem = new DCO.ResponseItem
                    {
                        Result = string.IsNullOrEmpty(temp) ? true : false,
                        Status = string.IsNullOrEmpty(temp) ? DCO.ResponseStatus.Success : DCO.ResponseStatus.Failure,
                        Message = string.IsNullOrEmpty(temp) ? string.Empty : temp,
                        RequestUser = Username,
                        TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0
                    };
                }
            }
            catch (Exception ex)
            {
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Delete stall failed because: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 2
0
        public PRO_tblStallDRO GetStallByID(string Username, string LanguageID, string StallID)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    var db = scope.Resolve<IPRO_tblStallDAO>();
                    var temp = db.GetDataByID(Username, LanguageID, StallID);
                    if (temp != null)
                    {
                        result.StallItem = Mapper.Map<PRO_tblStallDCO>(temp);
                        result.ResponseItem = new DCO.ResponseItem
                        {
                            Result = true,
                            Status = DCO.ResponseStatus.Success,
                            Message = "",
                            RequestUser = Username,
                            TotalItemCount = 1
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result.StallItem = Mapper.Map<PRO_tblStallDCO>(new PRO_tblStallDTO());
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Load stall item failed: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 3
0
        public PRO_tblStallDRO InsertUpdateStall(PRO_tblStallDCO stall)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    string temp = "";
                    var db = scope.Resolve<IPRO_tblStallDAO>();
                    var data = Mapper.Map<PRO_tblStallDTO>(stall);
                    if (stall.Activity.Equals(BaseConstant.COMMAND_INSERT_EN))
                        temp = db.InsertStall(data);
                    else temp = db.UpdateStall(data);

                    result.ResponseItem = new DCO.ResponseItem
                    {
                        Result = string.IsNullOrEmpty(temp) ? true : false,
                        Status = string.IsNullOrEmpty(temp) ? DCO.ResponseStatus.Success : DCO.ResponseStatus.Failure,
                        Message = string.IsNullOrEmpty(temp) ? string.Empty : temp,
                        RequestUser = stall.UserID,
                        TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0
                    };
                }
            }
            catch (Exception ex)
            {
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Insert new stall failed because: " + ex.Message,
                    RequestUser = stall.UserID,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 4
0
        public PRO_tblStallDRO GetAllStalls(string Username, string LanguageID, string StoreID, string WarehouseID, bool GetCombobox)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    List<PRO_tblStallDTO> temp = new List<PRO_tblStallDTO>();
                    var db = scope.Resolve<IPRO_tblStallDAO>();
                    if (!GetCombobox)
                        temp = db.LoadAllData(Username, LanguageID, StoreID, WarehouseID);
                    else temp = db.GetDataCombobox(Username, LanguageID, WarehouseID);
                    if (temp != null)
                    {
                        result.StallList = Mapper.Map<List<PRO_tblStallDCO>>(temp);
                        result.ResponseItem = new DCO.ResponseItem
                        {
                            Result = true,
                            Status = DCO.ResponseStatus.Success,
                            Message = "",
                            RequestUser = Username,
                            TotalItemCount = temp.Count
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result.StallList = Mapper.Map<List<PRO_tblStallDCO>>(new List<PRO_tblStallDTO>());
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Load stall list failed: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }