protected void btnGenerateBarCode_Click(object sender, EventArgs e)
    {
        txtDOTPlant.Attributes.Add("prevValue", txtDOTPlant.Text);
        txtDOTSize.Attributes.Add("prevValue", txtDOTSize.Text);
        txtDOTBrand.Attributes.Add("prevValue", txtDOTBrand.Text);
        txtDOTWeek.Attributes.Add("prevValue", txtDOTWeek.Text);
        txtDOTYear.Attributes.Add("prevValue", txtDOTYear.Text);

        if (ValidateDotCode())
        {
            BarCode br = new BarCode();
            br.DateCreated = DateTime.Now.ToShortDateString();
            br.OrganizationID = UserOrganizationId;
            br.BarCodeNumber = GenerateLotSerialNumber();

            string str = br.BarCodeNumber.ToString().Replace("-", "");


            // Guid g = Guid.NewGuid();
            if (br.GenerateLotBarCodeImage(str))
            {
                hdnBarCodeImageFileName.Value = str + ".gif";
                imgBarCode.ImageUrl = String.Format("/Images/temp/{0}.Gif", str);
                imgBarCode.Visible = true;
                txtBrand.Focus();
            }
            else
            {
                if (hdnBarCodeImageFileName.Value != "")
                {
                    if (System.IO.File.Exists(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value))))
                    {
                        System.IO.File.Delete(Server.MapPath(String.Format("/Images/temp/{0}", hdnBarCodeImageFileName.Value)));
                    }
                    hdnBarCodeImageFileName.Value = "";
                }
                imgBarCode.Visible = false;
            }
        }
        //ScriptManager.RegisterStartupScript(this, this.GetType(), "SetRecycleStatebtnGenerateBarCode_Click", String.Format("ShowInventoryForm();SetRecycleState({0});", ddlTireState.SelectedValue), true);
    }
    private void GenerateBarCodeForProduct()
    {
        BarCode br = new BarCode();
        br.DateCreated = DateTime.Now.ToShortDateString();
        br.OrganizationID = UserOrganizationId;
        br.BarCodeNumber = GenerateLotSerialNumber();

        string str = br.BarCodeNumber.ToString().Replace("-", "");

        if (br.GenerateLotBarCodeImage(str))
        {
            hdnBarCodeImageFileName.Value = str + ".gif";
        }
    }
    private void AddNewLOT()
    {
        try
        {

            //  if (string.IsNullOrEmpty(txtLotNmber.Text))
            if (string.IsNullOrEmpty(hidLotId.Value))
            {
                if (txtLotNmber.Text == "Create New Lot")
                {
                    txtLotNmber.Text = string.Empty;
                }
                int id = 0;
                Lots lot = new Lots();
                string lotNum = Guid.NewGuid().ToString().Substring(0, 6);
                lblLotNumber.Text = "Lot# " + lotNum;
                lot.LotNumber = lotNum;//txtLotNmber.Text;
                lot.Quantity = string.IsNullOrEmpty(txtQuantity.Text) ? 0 : Convert.ToInt32(txtQuantity.Text);
                lot.OrganizationId = UserOrganizationId;// Convert.ToInt32(ddlStakeholder.SelectedValue);
                lot.DateCreated = DateTime.Now;//DateTime.Parse(txtdate.Text.ToString());
                lot.IsActive = true;
                lot.SpaceId = 1;
                lot.UserID = LoginMemberId;// currentUserInfo.UserId;
                lot.RoleID = UserOrganizationRoleId;// currentUserInfo.RoleId;
                lot.IsCompleted = false;
                lot.ProductCategoryId = CatId;


                BarCode br = new BarCode();
                br.DateCreated = DateTime.Now.ToShortDateString();
                br.OrganizationID = UserOrganizationId;
                br.BarCodeNumber = GenerateLotSerialNumber();
                // Guid g = Guid.NewGuid();
                string str = br.BarCodeNumber.ToString().Replace("-", "");
                if (br.GenerateLotBarCodeImage(str))
                {
                    hdnLotBarCodeImageFileName.Value = str + ".gif";
                    imgLotBarcode.ImageUrl = String.Format("/Images/temp/{0}.Gif", str);
                    imgLotBarcode.Visible = true;
                    imgProductLot.ImageUrl = String.Format("/Images/temp/{0}.Gif", str);
                    imgProductLot.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);

                if (chkSublot.Checked)
                    lot.SubLot = true;
                else
                    lot.SubLot = false;
                string serialNumber = Lots.insertLot(lot, out id, str);
                hidLotId.Value = id.ToString();
                imgLotBarcode.Visible = true;
                imgLotBarcode.ImageUrl = "/Handlers/GetBarcodeImage.ashx?LotID=" + id;
                imgProductLot.Visible = true;
                imgProductLot.ImageUrl = "/Handlers/GetBarcodeImage.ashx?LotID=" + id;
                // lblLotNumber.Text += " " + txtLotNmber.Text;
                lblLotNumber.Text = "Lot# " + lotNum;
                lblProductLot.Text = "Lot# " + lotNum;
                lnkSingle.Visible = false;
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "", "HideLotSaveLnk();", true);

                if (chkSublot.Checked)
                {
                    Lots.updateSubLotTires(Convert.ToInt32(hidSelectedLot.Value), id, Session["SubLotTireIds"].ToString());
                    Session["SubLotTireIds"] = "";
                    Response.Redirect("lotinfo");
                }
                else
                {
                    lnkContinue.Visible = true;
                }

            }
            else
            {
                if (!string.IsNullOrEmpty(hidSelectedLot.Value))
                    hidLotId.Value = hidSelectedLot.Value;

                lblLotNumber.Text = "Lot# " + Lots.getLotNumberByLotId(Convert.ToInt32(hidLotId.Value));
                imgLotBarcode.Visible = true;
                imgLotBarcode.ImageUrl = "/Handlers/GetBarcodeImage.ashx?LotID=" + hidLotId.Value;
            }
            //dvLot.Visible = false;
            //dvInventoryAdd.Visible = true;
            gvAllTire.DataSource = Tire.getCompleteTireInfo_ByLotID(Convert.ToInt32(hidLotId.Value));
            gvAllTire.DataBind();

        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "addInventory.lnkLotSave_Click", ex);
        }
    }
    protected void lnkbtnAddCreateLoad_Click(object sender, EventArgs e)
    {


        if (ddlLoadType.SelectedValue == "74")
        {
            dvSearchHauler.Visible = false;
            rfvHaul.Enabled = false;

            lblerrorPONumber.Text = string.Empty;
            lblErrorInvoiceNumber.Text = string.Empty;
            if (txtponumber.Text.Trim().ToString() == txtsealnumber.Text.Trim().ToString())
            {
                if (txtinvoicenumber.Text.Trim().ToString() == txtladingnumber.Text.Trim().ToString())
                {
                    lblerrorPONumber.Text = "PO Number Seal Number are Same. !";
                    //  lblerrorPONumber.Text = string.Empty;
                    lblErrorInvoiceNumber.Text = "Invoice Number Bill Of Lading Number are Same. !";
                }
                else
                {
                    lblerrorPONumber.Text = "PO Number Seal Number are Same. !";
                }


            }
            else
            {
                lblerrorPONumber.Text = string.Empty;

                if (txtinvoicenumber.Text.Trim().ToString() == txtladingnumber.Text.Trim().ToString())
                {
                    lblErrorInvoiceNumber.Text = "Invoice Number Bill Of Lading Number are Same. !";
                }
                else
                {
                    lblErrorInvoiceNumber.Text = string.Empty;

                    BarCode br = new BarCode();
                    br.DateCreated = DateTime.Now.ToShortDateString();
                    br.OrganizationID = UserOrganizationId;
                    br.BarCodeNumber = GenerateLotSerialNumber();

                    // Guid g = Guid.NewGuid();
                    string str = br.BarCodeNumber.ToString().Replace("-", "");
                    if (br.GenerateLotBarCodeImage(str))
                    {
                        hdnLotBarCodeImageFileName.Value = str + ".gif";
                        imgLotBarcode.ImageUrl = String.Format("/images/temp/{0}.Gif", str);
                        imgLotBarcode.Visible = true;
                        //txtBrand.Focus();
                    }
                    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)));

                    }

                    lnkbtnAddCreateLoad.Visible = false;
                    lnkContinue.Visible = true;
                    int barcodeId = BarCode.Insert(br);
                    int loadId = 0;

                    loadId = Loads.InsertRecieveLoad(74, txtponumber.Text, txtinvoicenumber.Text, txtsealnumber.Text, txttrailernumber.Text, txtweight.Text, txtladingnumber.Text, UserOrganizationId, LoginMemberId, barcodeId, str, txtLoadnumber.Text, CatId);
                    Response.Redirect("addInventory?LoadId=" + loadId);



                }
            }

        }
        else if (ddlLoadType.SelectedValue == "73" || ddlLoadType.SelectedValue == "75")
        {
            dvSearchHauler.Visible = true;
            rfvHaul.Enabled = true;
            lblerrorPONumber.Text = string.Empty;
            lblErrorInvoiceNumber.Text = string.Empty;
            if (txtponumber.Text.Trim().ToString() == txtsealnumber.Text.Trim().ToString())
            {
                if (txtinvoicenumber.Text.Trim().ToString() == txtladingnumber.Text.Trim().ToString())
                {
                    lblerrorPONumber.Text = "PO Number Seal Number are Same. !";
                    //  lblerrorPONumber.Text = string.Empty;
                    lblErrorInvoiceNumber.Text = "Invoice Number Bill Of Lading Number are Same. !";
                }
                else
                {
                    lblerrorPONumber.Text = "PO Number Seal Number are Same. !";
                }


            }
            else
            {
                lblerrorPONumber.Text = string.Empty;

                if (txtinvoicenumber.Text.Trim().ToString() == txtladingnumber.Text.Trim().ToString())
                {
                    lblErrorInvoiceNumber.Text = "Invoice Number Bill Of Lading Number are Same. !";
                }
                else
                {
                    lblErrorInvoiceNumber.Text = string.Empty;

                    BarCode br = new BarCode();
                    br.DateCreated = DateTime.Now.ToShortDateString();
                    br.OrganizationID = UserOrganizationId;
                    br.BarCodeNumber = GenerateLotSerialNumber();

                    // Guid g = Guid.NewGuid();
                    string str = br.BarCodeNumber.ToString().Replace("-", "");
                    if (br.GenerateLotBarCodeImage(str))
                    {
                        hdnLotBarCodeImageFileName.Value = str + ".gif";
                        imgLotBarcode.ImageUrl = String.Format("/images/temp/{0}.Gif", str);
                        imgLotBarcode.Visible = true;
                        //txtBrand.Focus();
                    }
                    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)));

                    }

                    lnkbtnAddCreateLoad.Visible = false;
                    lnkContinue.Visible = true;
                    int barcodeId = BarCode.Insert(br);
                    int loadId = 0;

                    if (ddlLoadType.SelectedItem.Text.ToLower().Contains("transfer"))
                    {
                        string loadname = Guid.NewGuid().ToString().Substring(0, 6);

                        loadId = Loads.InsertLoad(Conversion.ParseInt(ddlLoadType.SelectedValue), string.Empty, string.Empty, string.Empty, string.Empty, 0, string.Empty, string.Empty, UserOrganizationId, barcodeId, str, loadname, LoginMemberId, CatId, Conversion.ParseInt(ddlLot.SelectedValue), Conversion.ParseInt(ddlSpace.SelectedValue), Conversion.ParseInt(ddlLane.SelectedValue));
                    }
                    else
                        loadId = Loads.InsertLoad(Conversion.ParseInt(ddlLoadType.SelectedValue), txtponumber.Text.Trim(), txtinvoicenumber.Text.Trim(), txtsealnumber.Text.Trim(), txttrailernumber.Text.Trim(), Conversion.ParseInt(hidOrgID.Value), txtweight.Text.Trim(), txtladingnumber.Text.Trim(), UserOrganizationId, barcodeId, str, txtLoadnumber.Text.Trim(), LoginMemberId, CatId);




                    Session["loadId"] = loadId.ToString(); // success messages are dispaleyed here lblerrorPONumber.Text = "PO Number Seal Number are Same. !";
                }
            }


            // if (txtinvoicenumber.Text.Trim().ToString() == txtladingnumber.Text.Trim().ToString())
            //{
            //    lblerrorPONumber.Text = string.Empty;
            //    lblErrorInvoiceNumber.Text = "Invoice Number Bill Of Lading Number are Same. !";

            //}
            //else
            //{



            //}
        }
        else
        {

            BarCode br = new BarCode();
            br.DateCreated = DateTime.Now.ToShortDateString();
            br.OrganizationID = UserOrganizationId;
            br.BarCodeNumber = GenerateLotSerialNumber();

            // Guid g = Guid.NewGuid();
            string str = br.BarCodeNumber.ToString().Replace("-", "");
            if (br.GenerateLotBarCodeImage(str))
            {
                hdnLotBarCodeImageFileName.Value = str + ".gif";
                imgLoadBarCodeTransfer.ImageUrl = String.Format("/images/temp/{0}.Gif", str);
                imgLoadBarCodeTransfer.Visible = true;


                //txtBrand.Focus();
            }
            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)));

            }

            lnkbtnAddCreateLoad.Visible = false;
            lnkContinue.Visible = true;
            int barcodeId = BarCode.Insert(br);
            int loadId = 0;


            if (ddlLoadType.SelectedItem.Text.ToLower().Contains("transfer"))
            {
                string loadname = Guid.NewGuid().ToString().Substring(0, 6);
                loadId = Loads.InsertLoad(Conversion.ParseInt(ddlLoadType.SelectedValue), string.Empty, string.Empty, string.Empty, string.Empty, 0, string.Empty, string.Empty, UserOrganizationId, barcodeId, str, loadname, LoginMemberId, CatId, Conversion.ParseInt(ddlLot.SelectedValue), Conversion.ParseInt(ddlSpace.SelectedValue), Conversion.ParseInt(ddlLane.SelectedValue));
            }
            else
                loadId = Loads.InsertLoad(Conversion.ParseInt(ddlLoadType.SelectedValue), txtponumber.Text.Trim(), txtinvoicenumber.Text.Trim(), txtsealnumber.Text.Trim(), txttrailernumber.Text.Trim(), Conversion.ParseInt(hidOrgID.Value), txtweight.Text.Trim(), txtladingnumber.Text.Trim(), UserOrganizationId, barcodeId, str, txtLoadnumber.Text.Trim(), LoginMemberId, CatId);
            Session["loadId"] = loadId.ToString();
        }        /* lot.BarCodeId*/
        //int id = BarCode.Insert(br);



    }
Example #5
0
    /// <summary>
    /// Storage Lot InfO Next button
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>

    protected void lbkNextLot_Click(object sender, EventArgs e)
    {
        try
        {
            
            if( Lots.getAllLotStatusByOrganizationIdAndLotNumber(UserOrganizationId,Conversion.ParseInt(hndfacilityId.Value),txtParkingLot.Text.Trim())>0)
            {
                lblErrorLot.Text = "Storage Lot Already Exist!";
                lblErrorLot.Visible = true;
                lblErrorLot.CssClass = "alert-danger custom-absolute-alert";
                ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                return;


            }



            lblErrorLane.Text = string.Empty;
            lblErrorLot.Text = string.Empty;
            lblErrorSpace.Text = string.Empty;



            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 = br.BarCodeNumber.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;
            lot.ProductCategoryId = CatId;
            string serialNumber;
            if (Request.QueryString["fid"] != null)
            {

                int facilityid = Convert.ToInt32(Request.QueryString["fid"]);



                serialNumber = Lots.insertLot(lot, out id, str, facilityid);
                LoadLots(1, facilityid);
                hidLotId.Value = id.ToString();
                dvLotRecord.Visible = true;
                if (id > 0)
                {
                    lblErrorLot.Text = "Storage Lot added successfully!";
                    lblErrorLot.Visible = true;
                    lblErrorLot.CssClass = "alert-success custom-absolute-alert";
                    ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                    txtParkingLot.Text = string.Empty;


                }


            }
            else if (Request.QueryString["fids"] != null)
            {

                int facilityid = Convert.ToInt32(Request.QueryString["fids"]);



                serialNumber = Lots.insertLot(lot, out id, str, facilityid);
                LoadLots(1, facilityid);
                hidLotId.Value = id.ToString();
                dvLotRecord.Visible = true;
                if (id > 0)
                {
                    lblErrorLot.Text = "Storage Lot added successfully!";
                    lblErrorLot.CssClass = "alert-success custom-absolute-alert";
                    lblErrorLot.Visible = true;
                    ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                    txtParkingLot.Text = string.Empty;


                }


            }
            else
            {
                serialNumber = Lots.insertLot(lot, out id, str, 0);
                hidLotId.Value = id.ToString();
                dvLotRecord.Visible = true;
                if (id > 0)
                {
                    lblErrorLot.Text = "Storage Lot added successfully!";
                    ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                    
                    lblErrorLot.CssClass = "alert-success custom-absolute-alert";
                    lblErrorLot.Visible = true;
                    txtParkingLot.Text = string.Empty;

                }
                LoadLots(1);
            }
            // Response.Redirect("lots");
            //dvSpaceRecord.Visible = true;
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "addInventory.lnkLotSave_Click", ex);
        }
    }
Example #6
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);

        }

    }