Ejemplo n.º 1
0
    protected void gvLot_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "RowInfobyLotIdPopUp")
        {
            //lblErrorLane.Text = String.Empty;
            lblErrorLot.Text = String.Empty;
            //lblErrorSpace.Text = String.Empty;


            pnlLot.Visible = false;

            hidLotId.Value = Convert.ToString(e.CommandArgument);

            GridViewRow gvr      = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            HiddenField lbl      = (HiddenField)gvLot.Rows[RemoveAt].FindControl("hdGVLotNumber");
            LotRowControl.loadFacilityandLotName(hdnfacilityname.Value, lbl.Value, hdnidfaclityid.Value);
            LotRowControl.loadLotRows(Convert.ToInt32(e.CommandArgument));
            //dvpopupfacilityinfo.Visible = true;
            //lblFacilityForSpace.Text = lblfacilityname.Text;
            //loadGridAndHeaderText();
        }

        if (e.CommandName == "AddLotSpace")
        {
            //lblErrorLane.Text = String.Empty;
            lblErrorLot.Text = String.Empty;
            //lblErrorSpace.Text = String.Empty;


            pnlLot.Visible = false;
            //pnlSpace.Visible = true;
            hidLotId.Value = Convert.ToString(e.CommandArgument);

            GridViewRow gvr      = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            LinkButton  lbl      = (LinkButton)gvLot.Rows[RemoveAt].FindControl("lnkbtnlotinfopop");
            //lblLotNumberSpace.Text = lbl.Text;
            //lblFacilityForSpace.Text = lblfacilityname.Text;
            //loadGridAndHeaderText();
        }



        else if (e.CommandName == "Edit")
        {
            hidLotId.Value = Convert.ToString(e.CommandArgument);
        }

        else if (e.CommandName == "Delete")
        {
            Lots.deleteLot(Convert.ToInt32(e.CommandArgument));
            LoadLots("1");
        }

        else if (e.CommandName == "Cancel")
        {
            gvLot.EditIndex = -1;
            LoadLots("1");
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// End GridView Space Info Funcations
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>



    /////star of Stroage lots Info Grids Funcations////////////////


    protected void gvLot_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AddMore")
        {
            LinkButton lnkbtnAddMoreSetting = gvLot.FooterRow.FindControl("lnkbtnAddMore") as LinkButton;
            LinkButton lnkbtnAddSetting     = gvLot.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton;
            LinkButton lnkbtnCancelSetting  = gvLot.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton;


            lnkbtnAddSetting.Visible     = true;
            lnkbtnAddMoreSetting.Visible = false;
            lnkbtnCancelSetting.Visible  = true;

            TextBox txtLotFooter = gvLot.FooterRow.FindControl("txtLotfooter") as TextBox;
            //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox;
            txtLotFooter.Visible = true;
        }

        if (e.CommandName == "AddLotSpace")
        {
            lblErrorLane.Text  = String.Empty;
            lblErrorLot.Text   = String.Empty;
            lblErrorSpace.Text = String.Empty;


            pnlLot.Visible   = false;
            pnlSpace.Visible = true;
            hidLotId.Value   = Convert.ToString(e.CommandArgument);

            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            Label       lbl      = (Label)gvLot.Rows[RemoveAt].FindControl("lbllotnumber");
            lblLotNumberSpace.Text   = lbl.Text;
            lblFacilityForSpace.Text = lblfacilityname.Text;
            LoadRows(1);
        }


        if (e.CommandName == "Insert")
        {
            try
            {
                TextBox txtParkingLot = (TextBox)((GridView)sender).FooterRow.FindControl("txtLotfooter");

                int  id  = 0;
                Lots lot = new Lots();
                lot.LotNumber      = txtParkingLot.Text.Trim(); //Guid.NewGuid().ToString().Substring(0, 6);
                lot.Quantity       = 0;
                lot.OrganizationId = UserOrganizationId;        // Convert.ToInt32(ddlStakeholder.SelectedValue);
                lot.DateCreated    = DateTime.Now;
                lot.IsActive       = true;
                lot.SpaceId        = 0;
                lot.UserID         = LoginMemberId;          // currentUserInfo.UserId;
                lot.RoleID         = UserOrganizationRoleId; // currentUserInfo.RoleId;
                lot.IsCompleted    = true;


                BarCode br = new BarCode();
                br.DateCreated    = DateTime.Now.ToString();
                br.OrganizationID = UserOrganizationId;
                br.BarCodeNumber  = GenerateLotSerialNumber();
                Guid   g   = Guid.NewGuid();
                string str = g.ToString().Replace("-", "");
                if (br.GenerateLotBarCodeImage(str))
                {
                    hdnLotBarCodeImageFileName.Value = str + ".gif";
                    //imgLotBarcode.ImageUrl = String.Format("/images/temp/{0}.Gif", str);
                    //imgLotBarcode.Visible = true;
                }
                if (System.IO.File.Exists(Server.MapPath(String.Format("/images/temp/{0}", hdnLotBarCodeImageFileName.Value))))
                {
                    br.Image = System.IO.File.ReadAllBytes(Server.MapPath(String.Format("/images/temp/{0}", hdnLotBarCodeImageFileName.Value)));
                }
                lot.BarCodeId = BarCode.Insert(br);

                lot.SubLot    = false;
                lot.Permanent = true;
                string serialNumber = Lots.insertLot(lot, out id, str);
                hidLotId.Value = id.ToString();
                //lbkSaveLot.Visible = false;
                dvLotRecord.Visible = true;
                LoadLots(1);
                //dvSpaceRecord.Visible = true;
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "addInventory.lnkLotSave_Click", ex);
            }
        }

        else if (e.CommandName == "Edit")
        {
            hidLotId.Value   = Convert.ToString(e.CommandArgument);
            lblErrorLot.Text = string.Empty;
        }

        else if (e.CommandName == "Delete")
        {
            int lotId = Convert.ToInt32(e.CommandArgument);
            if (!lothaveTire(lotId))
            {
                Lots.deleteLot(lotId);
                lblErrorLot.Text = string.Empty;
                LoadLots(1);
                lblErrorLane.Text  = string.Empty;
                lblErrorLot.Text   = string.Empty;
                lblErrorSpace.Text = string.Empty;
            }
        }
        else if (e.CommandName == "RowInfoPopUp")
        {
            LotRowControl.Visible = true;

            lblErrorLot.Text = String.Empty;
            //lblErrorSpace.Text = String.Empty;

            dvpopupfacilityinfo.Visible = true;
            //pnlLot.Visible = false;


            hidLotId.Value = Convert.ToString(e.CommandArgument);
            Lots objLots = new Lots(Conversion.ParseInt(hidLotId.Value));

            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            HiddenField lbl      = (HiddenField)gvLot.Rows[RemoveAt].FindControl("hdGVLotNumber");
            hdnlotname.Value = lbl.Value;
            LotRowControl.loadFacilityandLotName(objLots.FacilityName, lbl.Value, hndfacilityId.Value);
            LotRowControl.loadLotRows(Convert.ToInt32(e.CommandArgument));
        }

        else if (e.CommandName == "Cancel")
        {
            gvLot.EditIndex = -1;
            LoadLots(1);
        }
    }