Esempio n. 1
0
    protected void AddNewAllotment(int CrewID, int VoyageID, int Vessel_ID, int BankAccID, decimal Amount, string PBill_Date, int UserID, int IsSpecialAllot)
    {
        string js = "";

        if (VoyageID == 0)
        {
            js = "alert('Allotment can not be saved without voyage');";
        }
        else if (BankAccID == 0)
        {
            js = "alert('Allotment can not be saved without bank account');";
        }
        else if (PBill_Date == "")
        {
            js = "alert('Allotment can not be saved without portagebill date');";
        }


        if (js.Length > 0)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true);
        }
        else
        {
            int Res = BLL_PB_PortageBill.AddNew_Allotment(CrewID, VoyageID, Vessel_ID, BankAccID, Amount, PBill_Date, UserID, IsSpecialAllot);
            if (Res == 1)
            {
                js = "alert('New allotment added');parent.ReloadAllotment();";
            }
            else if (Res == -1)
            {
                js = "alert('Allotment for the same month already exists for the staff.');parent.ReloadAllotment();";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true);
        }
    }