/// <summary> /// Next Button Click For Row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbkNextRow_Click(object sender, EventArgs e) { lblErrorLane.Text = string.Empty; lblErrorLot.Text = string.Empty; lblErrorSpace.Text = string.Empty; LotRows spc = new LotRows(); spc.SpaceName = txtSpaceheader.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; int id = LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); LoadRows(1); if (id > 0) { lblErrorSpace.Text = "Row added successfully!"; lblErrorSpace.Visible = true; lblErrorSpace.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); txtSpaceheader.Text = string.Empty; LoadLots(1); } }
public void loadLotRows(int lotid) { //int lotid = 90; //string.IsNullOrEmpty(hidLotId.Value) ? 0 : Convert.ToInt32(hidLotId.Value); try { Session["LotId"] = lotid.ToString(); pnlSpace.Visible = true; //int lotid = Convert.ToInt32(hidLotId.Value); hidLotId.Value = lotid.ToString(); DataSet ds = LotRows.getLotSpacesByLotId(1, 10, out totalRows, lotid); gvSetting.DataSource = ds.Tables[0]; gvSetting.DataBind(); } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "Facility/Controls/LotRows.ascx loadLotRows", ex); } }
/// <summary> /// Load Rows Info /// /// </summary> public void LoadRows(int pageNo) { //int lotid = 90; //string.IsNullOrEmpty(hidLotId.Value) ? 0 : Convert.ToInt32(hidLotId.Value); int pageSize = 5; gvSetting.PageSize = pageSize; CurrentPageR = pageNo; try { int count = 0; int lotid = Convert.ToInt32(hidLotId.Value); DataSet ds = LotRows.getLotSpacesByLotId(pageNo, pageSize, out count, lotid); gvSetting.DataSource = ds.Tables[0]; gvSetting.DataBind(); this.TotalItemsR = count; this.pgrRows.DrawPager(pageNo, this.TotalItemsR, pageSize, MaxPagesToShow); } catch (Exception ex) { new SqlLog().InsertSqlLog(0, "lotinfo.aspx loadGridAndHeaderText", ex); } }
protected void gvSetting_RowUpdating(object sender, GridViewUpdateEventArgs e) { //TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //HiddenField lanehdnspace=gvSetting.FooterRow.FindControl("hdnspaceid1") as HiddenField; TextBox txtSpace = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtSpaces"); HiddenField lanehdnspace = (HiddenField)gvSetting.Rows[e.RowIndex].FindControl("hdnspaceid1"); LotRows spc = new LotRows(); spc.SpaceId = Convert.ToInt32(lanehdnspace.Value); spc.SpaceName = txtSpace.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); lblErrorSpace.Text = "Row Name Updated Successfully!"; lblErrorSpace.Visible = true; lblErrorSpace.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); gvSetting.EditIndex = -1; LoadRows(1); }
/// <summary> /// Next Button Click For Row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbkNextRow_Click(object sender, EventArgs e) { lblErrorLane.Text = string.Empty; lblErrorLot.Text = string.Empty; lblErrorSpace.Text = string.Empty; LotRows spc = new LotRows(); spc.SpaceName = txtSpaceheader.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; int id = LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); LoadRows(1); if (id > 0) { lblErrorSpace.Text = "Row added successfully!"; lblErrorSpace.Visible = true; lblErrorSpace.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); txtSpaceheader.Text = string.Empty; LoadLots(1); } }
protected void gvSetting_RowUpdating(object sender, GridViewUpdateEventArgs e) { //TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //HiddenField lanehdnspace=gvSetting.FooterRow.FindControl("hdnspaceid1") as HiddenField; TextBox txtSpace = (TextBox)gvSetting.Rows[e.RowIndex].FindControl("txtSpaces"); HiddenField lanehdnspace = (HiddenField)gvSetting.Rows[e.RowIndex].FindControl("hdnspaceid1"); LotRows spc = new LotRows(); spc.SpaceId = Convert.ToInt32(lanehdnspace.Value); spc.SpaceName = txtSpace.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); lblErrorSpace.Text = "Row Name Updated Successfully!"; lblErrorSpace.Visible = true; lblErrorSpace.CssClass = "alert-success custom-absolute-alert"; ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true); gvSetting.EditIndex = -1; LoadRows(1); }
/// <summary> /// Start of Rows Grid in Rows /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvSetting_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { SpaceId = Convert.ToInt32(e.CommandArgument); } else if (e.CommandName == "Delete") { int spaceId = Convert.ToInt32(e.CommandArgument); if (!rowhaveTire(spaceId)) { SpaceId = Convert.ToInt32(spaceId); lblErrorLot.Text = string.Empty; LotRows.deleteSpaces(SpaceId); LoadRows(1); lblErrorLane.Text = string.Empty; lblErrorLot.Text = string.Empty; lblErrorSpace.Text = string.Empty; } } else if (e.CommandName == "AddMore") { LinkButton lnkbtnAddMoreSetting = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddSetting = gvSetting.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton; LinkButton lnkbtnCancelSetting = gvSetting.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton; lnkbtnAddSetting.Visible = true; lnkbtnAddMoreSetting.Visible = false; lnkbtnCancelSetting.Visible = true; TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox; txtSpaceFooter.Visible = true; //txtSpace.Visible = true; } else if (e.CommandName == "CancelSetting") { gvSetting.EditIndex = -1; LoadRows(1); } else if (e.CommandName == "Insert") { TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //HiddenField hiddenfieldspaceid = this.FindControl("hdnspaceid") as HiddenField; //int index = Convert.ToInt32(e.CommandArgument); //GridViewRow row = gvSetting.Rows[index]; //HiddenField hiddenfieldspaceid = (HiddenField)row.FindControl("hdnspaceid"); LotRows spc = new LotRows(); spc.SpaceName = txtSpaceFooter.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; int temp = LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); ViewState["spaceid"] = temp; //ViewState["spaceid"] = temp; LoadRows(1); } else if (e.CommandName == "SpaceInfoPopUp") { ucFacilitySpaces.Visible=true; ViewState["spaceid"] = e.CommandArgument; lblErrorSpace.Text = String.Empty; dvpopupfacilityinfo.Visible = true; //pnlLot.Visible = false; //pnlSpace.Visible = false; //pnlLane.Visible = true; //PanelLaneValue.Visible = true; //addmoreLane.Visible = false; //gvLane.Visible = true; //lblfacilityForLane.Text = lblfacilityname.Text; //lblLotNumberLane.Text = lblLotNumberSpace.Text; Lots objLots = new Lots(Conversion.ParseInt(hidLotId.Value)); GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int RemoveAt = gvr.RowIndex; Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); ucFacilitySpaces.loadFacilityLotAndRowName(objLots.FacilityName, objLots.LotNumber, lbl.Text, Convert.ToInt32(hidLotId.Value), Conversion.ParseInt(hdnidfaclityid.Value)); ucFacilitySpaces.loadLaneText(Convert.ToInt32(e.CommandArgument)); } else if (e.CommandName == "AddSpaceLane") { ViewState["spaceid"] = e.CommandArgument; lblErrorLane.Text = String.Empty; lblErrorLot.Text = String.Empty; lblErrorSpace.Text = String.Empty; pnlLot.Visible = false; pnlSpace.Visible = false; pnlLane.Visible = true; //PanelLaneValue.Visible = true; //addmoreLane.Visible = false; //gvLane.Visible = true; lblfacilityForLane.Text = lblfacilityname.Text; lblLotNumberLane.Text = lblLotNumberSpace.Text; GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int RemoveAt = gvr.RowIndex; Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); lblSpaceName.Text = lbl.Text; // DataSet ds = Space.GetParkingLotNumberByLotId(Convert.ToInt32(hidLotId.Value)); // Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); LoadSpaces(1,Convert.ToInt32(e.CommandArgument)); } }
/// <summary> /// Start of Rows Grid in Rows /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvSetting_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { SpaceId = Convert.ToInt32(e.CommandArgument); } else if (e.CommandName == "Delete") { int spaceId = Convert.ToInt32(e.CommandArgument); if (!rowhaveTire(spaceId)) { SpaceId = Convert.ToInt32(spaceId); lblErrorLot.Text = string.Empty; LotRows.deleteSpaces(SpaceId); LoadRows(1); lblErrorLane.Text = string.Empty; lblErrorLot.Text = string.Empty; lblErrorSpace.Text = string.Empty; } } else if (e.CommandName == "AddMore") { LinkButton lnkbtnAddMoreSetting = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton; LinkButton lnkbtnAddSetting = gvSetting.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton; LinkButton lnkbtnCancelSetting = gvSetting.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton; lnkbtnAddSetting.Visible = true; lnkbtnAddMoreSetting.Visible = false; lnkbtnCancelSetting.Visible = true; TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox; txtSpaceFooter.Visible = true; //txtSpace.Visible = true; } else if (e.CommandName == "CancelSetting") { gvSetting.EditIndex = -1; LoadRows(1); } else if (e.CommandName == "Insert") { TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox; //HiddenField hiddenfieldspaceid = this.FindControl("hdnspaceid") as HiddenField; //int index = Convert.ToInt32(e.CommandArgument); //GridViewRow row = gvSetting.Rows[index]; //HiddenField hiddenfieldspaceid = (HiddenField)row.FindControl("hdnspaceid"); LotRows spc = new LotRows(); spc.SpaceName = txtSpaceFooter.Text.Trim(); spc.IsActive = true; spc.DateCreated = DateTime.Now; spc.Description = string.Empty; int temp = LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value)); ViewState["spaceid"] = temp; //ViewState["spaceid"] = temp; LoadRows(1); } else if (e.CommandName == "SpaceInfoPopUp") { ucFacilitySpaces.Visible = true; ViewState["spaceid"] = e.CommandArgument; lblErrorSpace.Text = String.Empty; dvpopupfacilityinfo.Visible = true; //pnlLot.Visible = false; //pnlSpace.Visible = false; //pnlLane.Visible = true; //PanelLaneValue.Visible = true; //addmoreLane.Visible = false; //gvLane.Visible = true; //lblfacilityForLane.Text = lblfacilityname.Text; //lblLotNumberLane.Text = lblLotNumberSpace.Text; Lots objLots = new Lots(Conversion.ParseInt(hidLotId.Value)); GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int RemoveAt = gvr.RowIndex; Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); ucFacilitySpaces.loadFacilityLotAndRowName(objLots.FacilityName, objLots.LotNumber, lbl.Text, Convert.ToInt32(hidLotId.Value), Conversion.ParseInt(hdnidfaclityid.Value)); ucFacilitySpaces.loadLaneText(Convert.ToInt32(e.CommandArgument)); } else if (e.CommandName == "AddSpaceLane") { ViewState["spaceid"] = e.CommandArgument; lblErrorLane.Text = String.Empty; lblErrorLot.Text = String.Empty; lblErrorSpace.Text = String.Empty; pnlLot.Visible = false; pnlSpace.Visible = false; pnlLane.Visible = true; //PanelLaneValue.Visible = true; //addmoreLane.Visible = false; //gvLane.Visible = true; lblfacilityForLane.Text = lblfacilityname.Text; lblLotNumberLane.Text = lblLotNumberSpace.Text; GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int RemoveAt = gvr.RowIndex; Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); lblSpaceName.Text = lbl.Text; // DataSet ds = Space.GetParkingLotNumberByLotId(Convert.ToInt32(hidLotId.Value)); // Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename"); LoadSpaces(1, Convert.ToInt32(e.CommandArgument)); } }