コード例 #1
0
    protected void gvLot_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtLot = (TextBox)gvLot.Rows[e.RowIndex].FindControl("txtLotNumber");

        if (Lots.getAllLotStatusByOrganizationIdAndLotNumber(UserOrganizationId, Conversion.ParseInt(hndfacilityId.Value), txtLot.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;
        }


        HiddenField lanehdnlot = (HiddenField)gvLot.Rows[e.RowIndex].FindControl("hdnlotid1");
        int         lotid      = Convert.ToInt32(lanehdnlot.Value);
        string      lotnumber  = txtLot.Text.Trim();

        Lots.updateLotByLotId(lotid, lotnumber);
        lblErrorLot.Text     = "Storage Lot Updated successfully!";
        lblErrorLot.Visible  = true;
        lblErrorLot.CssClass = "alert-success custom-absolute-alert";
        ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
        gvLot.EditIndex = -1;
        LoadLots(1);
    }
コード例 #2
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);
        }
    }