protected void btnUpload_OnClick(object sender, EventArgs e)
    {

        string invids = Session["invids"].ToString();
        string[] arr = invids.Split(',');
        InventoryLogic il = new InventoryLogic();
        RawMaterialLogic rl = new RawMaterialLogic();
        GRNLogic gl = new GRNLogic();
        GRN g = new GRN();
        g.SupplierID = rl.SelectByID(il.SelectByID(Convert.ToInt32(arr[0])).RawMaterialID).SupplierID;
        string path;
        string ticks = DateTime.Now.Ticks.ToString();
        Inventory inv;
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
            path = "Images/" + ticks + FileUpload1.FileName;
            g.GRNPath = path;
            int id =  gl.Insert(g);
            
            for (int i = 0; i < arr.Length; i++)
            {
                inv = il.SelectByID(Convert.ToInt32(arr[i]));
                inv.GRNID = id;
                il.Update(inv);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage" + arr[i], "alert(" + arr[i] + ")", true);
            }

        }
        // Response.Redirect("QuotationList.aspx");
        Response.Redirect("InventoryList.aspx");

    }
Exemplo n.º 2
0
    protected void btnUpload_OnClick(object sender, EventArgs e)
    {
        string invids = Session["invids"].ToString();

        string[]         arr = invids.Split(',');
        InventoryLogic   il  = new InventoryLogic();
        RawMaterialLogic rl  = new RawMaterialLogic();
        GRNLogic         gl  = new GRNLogic();
        GRN g = new GRN();

        g.SupplierID = rl.SelectByID(il.SelectByID(Convert.ToInt32(arr[0])).RawMaterialID).SupplierID;
        string    path;
        string    ticks = DateTime.Now.Ticks.ToString();
        Inventory inv;

        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
            path      = "Images/" + ticks + FileUpload1.FileName;
            g.GRNPath = path;
            int id = gl.Insert(g);

            for (int i = 0; i < arr.Length; i++)
            {
                inv       = il.SelectByID(Convert.ToInt32(arr[i]));
                inv.GRNID = id;
                il.Update(inv);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage" + arr[i], "alert(" + arr[i] + ")", true);
            }
        }
        // Response.Redirect("QuotationList.aspx");
        Response.Redirect("InventoryList.aspx");
    }
 public GRNController()
 {
     _gRNLogic = new GRNLogic();
 }