Ejemplo n.º 1
0
    protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            string Bunkering_Date = "";
            string AirwayBill     = "";

            int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[0].ToString());

            if (e.NewValues["Bunkering_Date"] != null)
            {
                Bunkering_Date = e.NewValues["Bunkering_Date"].ToString();
            }

            int PortID            = UDFLib.ConvertToInteger(e.NewValues["Bunkering_Port"].ToString());
            int Bunker_SupplierID = UDFLib.ConvertToInteger(e.NewValues["Bunker_SupplierID"].ToString());
            int LabID             = UDFLib.ConvertToInteger(e.NewValues["LabID"].ToString());
            int VesselID          = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[1].ToString());

            if (e.NewValues["AirwayBill"] != null)
            {
                AirwayBill = e.NewValues["AirwayBill"].ToString();
            }
            int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString());


            DataSet ds = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysis(ID, VesselID, Bunkering_Date, PortID, Bunker_SupplierID, LabID, AirwayBill, Status, GetSessionUserID());

            if (ds.Tables.Count > 0)
            {
                if (Status == 2)
                {
                    if (ds.Tables.Count > 1)
                    {
                        foreach (DataRow item in ds.Tables[ds.Tables.Count - 1].Rows)
                        {
                            if (File.Exists(Server.MapPath("~/Uploads/BunkerAnalysis/") + item["File_Name"].ToString()))
                            {
                                if (!File.Exists(Server.MapPath("~/Uploads/Technical/") + item["File_Name"].ToString()))
                                {
                                    File.Copy(Server.MapPath("~/Uploads/BunkerAnalysis/") + item["File_Name"].ToString(), Server.MapPath("~/Uploads/Technical/") + item["File_Name"].ToString());
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                string js = "alert('Not Updated !!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true);
            }

            GridView_Bunker.EditIndex = -1;
            Load_BunkerSampleAnalysis();
        }
        catch { }
    }
Ejemplo n.º 2
0
    protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridViewRow row            = (GridViewRow)GridView_Bunker.Rows[e.RowIndex];
            string      Bunkering_Date = "";
            string      AirwayBill     = "";

            int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[0].ToString());

            if (e.NewValues["Bunkering_Date"] != null)
            {
                Bunkering_Date = e.NewValues["Bunkering_Date"].ToString();
            }

            int PortID = UDFLib.ConvertToInteger(e.NewValues["Bunkering_Port"].ToString());
            // int Bunker_SupplierID = UDFLib.ConvertToInteger(e.NewValues["Bunker_SupplierID"].ToString());
            // int LabID = UDFLib.ConvertToInteger(e.NewValues["LabID"].ToString());
            int Bunker_SupplierID = Convert.ToInt32(((DropDownList)row.FindControl("ddlBunkerSupplier")).SelectedValue);
            int LabID             = Convert.ToInt32(((DropDownList)row.FindControl("ddlLabName")).SelectedValue);

            int VesselID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[1].ToString());



            if (e.NewValues["AirwayBill"] != null)
            {
                AirwayBill = e.NewValues["AirwayBill"].ToString();
            }
            int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString());


            DataSet ds = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysis(ID, VesselID, Bunkering_Date, PortID, Bunker_SupplierID, LabID, AirwayBill, Status, GetSessionUserID());

            if (ds.Tables.Count == 0)
            {
                string js = "alert('Not Updated !!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true);
            }

            GridView_Bunker.EditIndex = -1;
            Load_BunkerSampleAnalysis();
        }
        catch { }
    }