public PRO_tblProductGroupLevel3DRO DeleteLevel3(string Username, string LanguageID, string Level3IDList) { PRO_tblProductGroupLevel3DRO result = new PRO_tblProductGroupLevel3DRO(); try { using (var scope = Container.BeginLifetimeScope()) { string temp = ""; var db = scope.Resolve<IPRO_tblProductGroupLevel3DAO>(); if (Level3IDList.Contains("$")) temp = db.DeleteLevel3List(Username, LanguageID, Level3IDList); else temp = db.DeleteLevel3(Username, LanguageID, Level3IDList); 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 level3 failed because: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblProductGroupLevel3DRO GetLevel3ByID(string Username, string LanguageID, string Level3ID) { PRO_tblProductGroupLevel3DRO result = new PRO_tblProductGroupLevel3DRO(); try { using (var scope = Container.BeginLifetimeScope()) { var db = scope.Resolve<IPRO_tblProductGroupLevel3DAO>(); var temp = db.GetDataByID(Username, LanguageID, Level3ID); if (temp != null) { result.Level3Item = Mapper.Map<PRO_tblProductGroupLevel3DCO>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = 1 }; } } } catch (Exception ex) { result.Level3Item = Mapper.Map<PRO_tblProductGroupLevel3DCO>(new PRO_tblProductGroupLevel3DTO()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Load level3 item failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblProductGroupLevel3DRO InsertUpdateLevel3(PRO_tblProductGroupLevel3DCO level3) { PRO_tblProductGroupLevel3DRO result = new PRO_tblProductGroupLevel3DRO(); try { using (var scope = Container.BeginLifetimeScope()) { string temp = ""; var db = scope.Resolve<IPRO_tblProductGroupLevel3DAO>(); var data = Mapper.Map<PRO_tblProductGroupLevel3DTO>(level3); if (level3.Activity.Equals(BaseConstant.COMMAND_INSERT_EN)) temp = db.InsertLevel3(data); else temp = db.UpdateLevel3(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 = level3.UserID, TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0 }; } } catch (Exception ex) { result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Insert new level3 failed because: " + ex.Message, RequestUser = level3.UserID, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public PRO_tblProductGroupLevel3DRO GetAllLevel3(string Username, string LanguageID, string Level1ID, string Level2ID, bool GetCombobox) { PRO_tblProductGroupLevel3DRO result = new PRO_tblProductGroupLevel3DRO(); try { using (var scope = Container.BeginLifetimeScope()) { List<PRO_tblProductGroupLevel3DTO> temp = new List<PRO_tblProductGroupLevel3DTO>(); var db = scope.Resolve<IPRO_tblProductGroupLevel3DAO>(); if (!GetCombobox) temp = db.LoadAllData(Username, LanguageID, Level1ID, Level2ID); else temp = db.GetDataCombobox(Username, LanguageID, Level1ID, Level2ID); if (temp != null) { result.Level3List = Mapper.Map<List<PRO_tblProductGroupLevel3DCO>>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = temp.Count }; } } } catch (Exception ex) { result.Level3List = Mapper.Map<List<PRO_tblProductGroupLevel3DCO>>(new List<PRO_tblProductGroupLevel3DTO>()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Load level3 list failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }