private void BindGridView() { DataTable table = new RoomStatuses().SelectAll(); grid.DataSource = table; grid.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { try { RoomStatuses room = new RoomStatuses(); room.RoomStatus_EN = txtStatusEn.Text; room.RoomStatus_AR = txtStatusAr.Text; room.Description = txtDesc.Text; if (Session["Prop_Action"] == "U") { room.LastModifiedUser = 1; room.RoomStatus_ID = int.Parse(txtStatusID.Text); room.LastModifiedDate = DateTime.Now; bool retval = room.Update(); } else { room.CreatedUser = 1; bool retval = room.Insert(); } lblMsg.Text = "Data Saved successfully."; lblMsg.ForeColor = Color.Green; } catch (Exception ex) { lblMsg.Text = "Data not Saved ."; lblMsg.ForeColor = Color.Red; } }
public static RoomStatusesModel EntityToModel(this RoomStatuses entity, bool virtualActive = false) { try { RoomStatusesModel model = new RoomStatusesModel() { RoomId=entity.RoomId, StatusId=entity.StatusId, IsActive = entity.IsActive, Id = entity.Id }; if (virtualActive) { model.Status = entity.Status; model.Room = entity.Room; } return model; } catch (Exception) { return new RoomStatusesModel(); } }
protected void btnSave_Click(object sender, EventArgs e) { try { RoomStatuses room = new RoomStatuses(); room.RoomStatus_EN = txtStatusEn.Text; room.RoomStatus_AR = txtStatusEn.Text /*txtStatusAr.Text*/; room.Description = txtDesc.Text; if (Session["Prop_Action"] == "U") { room.LastModifiedUser = Utility.GetIntUserIdFromUserName(HttpContext.Current.User.Identity.Name); room.RoomStatus_ID = int.Parse(txtStatusId.Value); room.LastModifiedDate = DateTime.Now; bool retval = room.Update(); } else { room.CreatedUser = Utility.GetIntUserIdFromUserName(HttpContext.Current.User.Identity.Name); bool retval = room.Insert(); } lblMsg.Text = "Data Saved successfully."; lblMsg.ForeColor = Color.Green; } catch (Exception ex) { lblMsg.Text = "Data not Saved ."; lblMsg.ForeColor = Color.Red; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // fillRoomTypes(); //fillProperties(); int roomID = 0; Session["Prop_Action"] = "I"; if (Request.QueryString["RoomStatus_ID"] != null) { roomID = Convert.ToInt32(Request.QueryString["RoomStatus_ID"]); Session["Prop_Action"] = "U"; } if (Session["Prop_Action"] == "U") { // int proID= int.Parse(Session["Pro_ID"].ToString()); RoomStatuses room = new RoomStatuses(); room.RoomStatus_ID = roomID; room.SelectOne(); txtStatusID.Text = room.RoomStatus_ID.ToString(); txtStatusEn.Text = room.RoomStatus_EN; txtStatusAr.Text = room.RoomStatus_AR; txtDesc.Text = room.Description; } } }
private void DeleteRoomStatus(int roomStatusId) { RoomStatuses status = new RoomStatuses(); status.RoomStatus_ID = roomStatusId; status.SelectOne(); status.Delete(); BindGridView(); }
private void BindRoomStatuses() { DataTable table = new RoomStatuses().SelectAll(); drpRoomStatus.DataSource = table; drpRoomStatus.DataTextField = table.Columns["RoomStatus_EN"].ToString(); drpRoomStatus.DataValueField = table.Columns["RoomStatus_ID"].ToString(); drpRoomStatus.DataBind(); }
private void BindRoomStatuses() { DataTable table = new RoomStatuses().SelectAll(); drpRoomStatus.DataSource = table; drpRoomStatus.DataTextField = table.Columns["RoomStatus_EN"].ToString(); drpRoomStatus.DataValueField = table.Columns["RoomStatus_ID"].ToString(); drpRoomStatus.DataBind(); drpRoomStatus.Items.Insert(0, new ListItem("Select a Room Status...", "-1")); }
public RoomAvailability( Guid roomId, string campus, string building, string floor, string room, RoomStatuses status) { RoomId = roomId; Campus = campus; Building = building; Floor = floor; Room = room; Status = status; }
protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { string strRoomID = grid.Rows[e.RowIndex].Cells[0].Text; RoomStatuses room = new RoomStatuses(); room.RoomStatus_ID = int.Parse(strRoomID); room.SelectOne(); room.Delete(); // bool retval=new Rooms().Delete(room.Room_ID) BindGridView(); } catch (Exception ex) { } }
public ActionResult RoomEdit(RoomsModel room, int[] StatusList) { Rooms rooms = room.ModelToEnity(); rooms.IsActive = true; _serviceRooms.Update(rooms); foreach (var item in StatusList) { RoomStatuses rs = new RoomStatuses(); rs.RoomId = rooms.Id; rs.StatusId = item; _serviceRoomStatuses.Insert(rs); } return(RedirectToAction("RoomList")); }
public static RoomStatuses ModelToEnity(this RoomStatusesModel model, bool virtualActive = false) { RoomStatuses entity = new RoomStatuses() { RoomId=model.RoomId, StatusId=model.StatusId, Id = model.Id, IsActive = model.IsActive }; if (virtualActive) { entity.Room = model.Room; entity.Status = model.Status; } return entity; }
public ActionResult RoomInsert(RoomsModel roomModel, int[] StatusList) { Rooms room = roomModel.ModelToEnity(); room.IsActive = true; _serviceRooms.Insert(room); RoomStatuses roomstatus = new RoomStatuses(); foreach (var item in StatusList) { roomstatus.RoomId = room.Id; roomstatus.IsActive = true; roomstatus.StatusId = item; _serviceRoomStatuses.Insert(roomstatus); } return(RedirectToAction("RoomList")); }
public ActionResult RoomInsert(RoomsModel roomModel, int[] StatusList) { Rooms room = roomModel.ModelToEnity(); room.IsActive = true; _serviceRooms.Insert(room); RoomStatuses roomstatus = new RoomStatuses(); foreach (var item in StatusList) { roomstatus.RoomId = room.Id; roomstatus.IsActive = true; roomstatus.StatusId = item; _serviceRoomStatuses.Insert(roomstatus); } return RedirectToAction("RoomList"); }
private DataTable GetRoomStatuses() { DataTable table = new RoomStatuses().SelectAll(); return(table); }
public ActionResult RoomEdit(RoomsModel room, int[] StatusList) { Rooms rooms = room.ModelToEnity(); rooms.IsActive = true; _serviceRooms.Update(rooms); foreach (var item in StatusList) { RoomStatuses rs = new RoomStatuses(); rs.RoomId = rooms.Id; rs.StatusId = item; _serviceRoomStatuses.Insert(rs); } return RedirectToAction("RoomList"); }