public bookRoomMasterModel master(bookRoomModel value) { bookRoomMasterModel result = new bookRoomMasterModel(); try { using (var context = new StandardCanEntities()) { if (String.IsNullOrEmpty(value.user_id)) { throw new Exception("Unauthorized Access"); } var userId = JwtHelper.GetUserIdFromToken(value.user_id); if (String.IsNullOrEmpty(userId)) { throw new Exception("Unauthorized Access"); } string sql = "select convert(nvarchar(5), MRM_ID) code "; sql += " , MRM_CODE [text] "; sql += " from MAS_ROOM "; sql += " order by MRM_CODE "; result.room = context.Database.SqlQuery <dropdown>(sql).ToList(); sql = " select convert(nvarchar(5), MAS_ID) code, mas_name [text] "; sql += " from MAS_APPROVE_STATUS "; sql += " where MAS_ID != 0 "; sql += " order by mas_orderby "; result.status = context.Database.SqlQuery <dropdown>(sql).ToList(); } //if (myOutputParamInt.Value != null) //{ // int r_id = Convert.ToInt32(myOutputParamInt.Value); // result.status = "S"; // result.message = ""; // result.value = r_id.ToString(); //} //else //{ // result.status = "E"; // result.message = ""; //} } catch (Exception ex) { throw new Exception(ex.Message); } return(result); }
public bookRoomMasterModel master(bookRoomModel value) { try { bookRoomMasterModel result = new bookRoomMasterModel(); using (var context = new StandardCanEntities()) { if (String.IsNullOrEmpty(value.user_id)) { throw new Exception("Unauthorized Access"); } var userId = JwtHelper.GetUserIdFromToken(value.user_id); if (String.IsNullOrEmpty(userId)) { throw new Exception("Unauthorized Access"); } string sql = "select convert(nvarchar(5), mrm_id) code "; sql += " , mrm_name [text] "; sql += " from MAS_ROOM "; sql += " order by mrm_name "; result.room = context.Database.SqlQuery <dropdown>(sql).ToList(); sql = " select convert(nvarchar(5), MAS_ID) code, mas_name [text] "; sql += " from MAS_APPROVE_STATUS "; sql += " where MAS_ID != 0 "; sql += " order by mas_orderby "; result.status = context.Database.SqlQuery <dropdown>(sql).ToList(); } return(result); } catch (Exception ex) { //result.status = "E"; //result.message = ex.Message.ToString(); throw new Exception(ex.Message); } }