public ActionResult UpdateWareHouse(ResponseAdminWareHouseList item1, RequestAdminWareHouse item2, ResponseAdminWareHouseDetail item3, ResponseAdminWareHouse item4) { if (ModelState.IsValid) { LogicAdminWareHouse adm = new LogicAdminWareHouse(); ResponseAdminWareHouse response = new ResponseAdminWareHouse(); item2.flag = 'M'; item2.dateUpdate = DateTime.Now; item2.userUpdate = Session["user"].ToString(); item2.userRegister = ""; response = adm.setWareHouse(item2); if (response.code == 50000) { Session.Add("msgOk", response.message); } else { Session.Add("msgEr", response.message); } } return(RedirectToAction("WareHouse")); }
public ActionResult addWareHouse(ResponseAdminWareHouseList item1, RequestAdminWareHouse item2, ResponseAdminWareHouseDetail item3, ResponseAdminWareHouse item4) { // Método para agregar opciones de catálogo if (ModelState.IsValid) { LogicAdminWareHouse adm = new LogicAdminWareHouse(); item2.stateRecord = true; item2.flag = 'N'; item2.dateRegister = DateTime.Now; item2.userRegister = Session["user"].ToString(); item2.dateUpdate = DateTime.Now; item2.userUpdate = Session["user"].ToString(); item4 = adm.setWareHouse(item2); if (item4.code == 50000) { Session.Add("msgOk", item4.message); } else { Session.Add("msgEr", item4.message); } } Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse> response = new Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse>(item1, item2, item3, item4); return(RedirectToAction("WareHouse")); }
public DataTable adminWareHouse(RequestAdminWareHouse request) { try { DataTable response = new DataTable(); SqlParameter[] param = new SqlParameter[10]; DataBase db = new DataBase(); param[0] = new SqlParameter("@id", request.id); param[1] = new SqlParameter("@idCompany", request.idCompany); param[3] = new SqlParameter("@description", request.description); param[2] = new SqlParameter("@responsable", request.responsable); param[4] = new SqlParameter("@stateRecord", request.stateRecord); param[5] = new SqlParameter("@userRegister", request.userRegister); param[6] = new SqlParameter("@dateRegister", request.dateRegister); param[7] = new SqlParameter("@userUpdate", request.userUpdate); param[8] = new SqlParameter("@dateUpdate", request.dateUpdate); param[9] = new SqlParameter("@flag", request.flag); response = db.executeDataTable("spAdminWareHouse", param); return(response); } catch (Exception ex) { throw ex; } }
public ActionResult WareHouse() { // Obtener el listado de sedes RequestAdminWareHouse req = new RequestAdminWareHouse(); ResponseAdminWareHouseList res = new ResponseAdminWareHouseList(); LogicAdminWareHouse logic = new LogicAdminWareHouse(); req.id = 0; res = logic.getWareHouseList(req); req.stateRecord = true; Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse> response = new Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse>(res, null, null, null); return(View(response)); }
public ResponseAdminWareHouse adminWareHouse(RequestAdminWareHouse request) { try { DataTable dt = new DataTable(); DataAdminWareHouse datRole = new DataAdminWareHouse(); ResponseAdminWareHouse response = new ResponseAdminWareHouse(); dt = datRole.adminWareHouse(request); if (dt != null) { if (dt.Rows.Count > 0) { response.code = int.Parse(dt.Rows[0]["code"].ToString()); response.message = dt.Rows[0]["message"].ToString(); response.status = int.Parse(dt.Rows[0]["state"].ToString()); } } return(response); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado throw exSql; } catch (Exception ex) { // Registrar el error real DataLogError datError = new DataLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "adminWareHouse"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); datError.newError(error); // Modificar la excepción Exception exResult = new Exception("Error no controlado, favor consultar con el administrador del sistema."); throw exResult; } }
public ResponseAdminWareHouseList getWareHouseList(RequestAdminWareHouse req) { ResponseAdminWareHouseList response = new ResponseAdminWareHouseList(); try { LogicCommon com = new LogicCommon(); string json = com.HttpPost("WareHouse/getAdminWareHouse", req); response = JsonConvert.DeserializeObject <ResponseAdminWareHouseList>(json); // Obtener el listado de sedes RequestAdminCompany reqCompany = new RequestAdminCompany(); ResponseAdminCompanyList resCompany = new ResponseAdminCompanyList(); LogicAdminCompany logicCompany = new LogicAdminCompany(); List <SelectListItem> lstTmpCompany = new List <SelectListItem>(); // Obtener el listado completo de sedes reqCompany.id = 0; resCompany = logicCompany.getCompanyList(reqCompany); // Llenar el listado de sedes foreach (ResponseAdminCompanyDetail r in resCompany.lst) { lstTmpCompany.Add(new SelectListItem { Text = r.name, Value = r.id.ToString(), Selected = r.id == req.idCompany ? true : false }); } // Agregar el listado de sede response.lstCompany = lstTmpCompany; return(response); } catch (Exception ex) { response.code = -1; response.message = ex.Message; } return(response); }
public DataTable getAdminWareHouse(RequestAdminWareHouse request) { try { DataTable response = new DataTable(); SqlParameter[] param = new SqlParameter[1]; DataBase db = new DataBase(); param[0] = new SqlParameter("@id", request.id); response = db.executeDataTable("spGetAdminWareHouse", param); return(response); } catch (Exception ex) { throw ex; } }
public ResponseAdminWareHouse setWareHouse(RequestAdminWareHouse req) { ResponseAdminWareHouse response = new ResponseAdminWareHouse(); try { LogicCommon com = new LogicCommon(); string json = com.HttpPost("WareHouse/adminWareHouse", req); response = JsonConvert.DeserializeObject <ResponseAdminWareHouse>(json); return(response); } catch (Exception ex) { response.code = -1; response.message = ex.Message; } return(response); }
public ActionResult ShowWareHouse(string id) { // Cargar los datos de la sede RequestAdminWareHouse req = new RequestAdminWareHouse(); ResponseAdminWareHouseList res = new ResponseAdminWareHouseList(); LogicAdminWareHouse logic = new LogicAdminWareHouse(); req.id = int.Parse(id); res = logic.getWareHouseList(req); req.description = res.lst[0].description; req.idCompany = res.lst[0].idCompany; req.responsable = res.lst[0].responsable; req.stateRecord = res.lst[0].stateRecord; Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse> response = new Tuple <ResponseAdminWareHouseList, RequestAdminWareHouse, ResponseAdminWareHouseDetail, ResponseAdminWareHouse>(res, req, null, null); return(View(response)); }
public ResponseAdminWareHouse adminWareHouse(RequestAdminWareHouse request) { ResponseAdminWareHouse response = new ResponseAdminWareHouse(); try { LogicAdminWareHouse logic = new LogicAdminWareHouse(); request.dateRegister = System.DateTime.Now; request.dateUpdate = System.DateTime.Now; response = logic.adminWareHouse(request); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado response.code = exSql.ErrorCode; response.message = exSql.Message; response.status = exSql.State; } catch (Exception ex) { // Registrar el error real LogicLogError logicError = new LogicLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "adminWareHouse"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); logicError.newError(error); response.code = -1; response.message = "Error no controlado, favor consultar con el administrador del sistema."; } return(response); }
public ResponseAdminWareHouseList getAdminWareHouseList(RequestAdminWareHouse request) { try { DataTable dt = new DataTable(); DataAdminWareHouse dat = new DataAdminWareHouse(); ResponseAdminWareHouseDetail admin; ResponseAdminWareHouseList response = new ResponseAdminWareHouseList(); dt = dat.getAdminWareHouse(request); if (dt != null) { if (dt.Rows.Count > 0) { response.code = 1; response.message = "Se encontraron registros"; response.status = 1; response.lst = new List <ResponseAdminWareHouseDetail>(); foreach (DataRow dr in dt.Rows) { admin = new ResponseAdminWareHouseDetail(); admin.id = int.Parse(dr["id"].ToString()); admin.idCompany = int.Parse(dr["idCompany"].ToString()); admin.responsable = dr["responsable"].ToString(); admin.description = dr["description"].ToString(); admin.stateRecord = bool.Parse(dr["stateRecord"].ToString()); admin.userRegister = dr["userRegister"].ToString(); admin.dateRegister = DateTime.Parse(dr["dateRegister"].ToString()); admin.userUpdate = dr["userUpdate"].ToString(); admin.dateUpdate = DateTime.Parse(dr["dateUpdate"].ToString()); response.lst.Add(admin); } } else { response.code = 0; response.message = "No se encontraron registros"; response.status = 0; } } else { response.code = 0; response.message = "No se encontraron registros"; response.status = 0; } return(response); } catch (System.Data.SqlClient.SqlException exSql) { // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado throw exSql; } catch (Exception ex) { // Registrar el error real DataLogError datError = new DataLogError(); LogError error = new LogError(); error.module = "ADMIN"; error.method = "getAdminWareHouseList"; error.errorMessage = ex.Message; error.moreInfo = request.id.ToString(); datError.newError(error); // Modificar la excepción Exception exResult = new Exception("Error no controlado, favor consultar con el administrador del sistema."); throw exResult; } }