public PRO_tblStoreDRO DeleteStore(string Username, string LanguageID, string StoreIDList) { PRO_tblStoreDRO result = new PRO_tblStoreDRO(); try { using (var scope = Container.BeginLifetimeScope()) { string temp = ""; var db = scope.Resolve<IPRO_tblStoreDAO>(); if (StoreIDList.Contains("$")) temp = db.DeleteStoreList(Username, LanguageID, StoreIDList); else temp = db.DeleteStore(Username, LanguageID, StoreIDList); 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 store failed because: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblStoreDRO GetStoreByID(string Username, string LanguageID, string StoreID) { PRO_tblStoreDRO result = new PRO_tblStoreDRO(); try { using (var scope = Container.BeginLifetimeScope()) { var db = scope.Resolve<IPRO_tblStoreDAO>(); var temp = db.GetDataByID(Username, LanguageID, StoreID); if (temp != null) { result.StoreItem = Mapper.Map<PRO_tblStoreDCO>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = 1 }; } } } catch (Exception ex) { result.StoreItem = Mapper.Map<PRO_tblStoreDCO>(new PRO_tblStoreDTO()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Load store item failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblStoreDRO InsertUpdateStore(PRO_tblStoreDCO store) { PRO_tblStoreDRO result = new PRO_tblStoreDRO(); try { using (var scope = Container.BeginLifetimeScope()) { string temp = ""; var db = scope.Resolve<IPRO_tblStoreDAO>(); var data = Mapper.Map<PRO_tblStoreDTO>(store); if (store.Activity.Equals(BaseConstant.COMMAND_INSERT_EN)) temp = db.InsertStore(data); else temp = db.UpdateStore(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 = store.UserID, TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0 }; } } catch (Exception ex) { result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Insert new store failed because: " + ex.Message, RequestUser = store.UserID, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblStoreDRO GetAllStores(string Username, string LanguageID, bool GetCombobox) { PRO_tblStoreDRO result = new PRO_tblStoreDRO(); try { using (var scope = Container.BeginLifetimeScope()) { List<PRO_tblStoreDTO> temp = new List<PRO_tblStoreDTO>(); var db = scope.Resolve<IPRO_tblStoreDAO>(); if (!GetCombobox) temp = db.LoadAllData(Username, LanguageID); else temp = db.GetDataCombobox(Username, LanguageID); if (temp != null) { result.StoreList = Mapper.Map<List<PRO_tblStoreDCO>>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = temp.Count }; } } } catch (Exception ex) { result.StoreList = Mapper.Map<List<PRO_tblStoreDCO>>(new List<PRO_tblStoreDTO>()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Load store list failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }