Beispiel #1
0
    protected void QuarterNumber_change(object sender, EventArgs e)
    {
        tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text);

        if (_allotte != null)
        {
            tblUser _user = Users.getUserByAAN(_allotte.AAN);
            if (_user.designation.HasValue)
            {
                drpDesignation.SelectedValue = _user.designation.Value.ToString();
            }
            if (_user.BaseOfficeId.HasValue)
            {
                drpOffice.SelectedValue = _user.BaseOfficeId.Value.ToString();
            }
            txtAllotteeAAN.Text = _allotte.AAN;
            txtUserName.Text    = _user.fullName;
            drpQuarterCatergory.SelectedValue = _allotte.tblQuarter.tblQuarterCategory.Id.ToString();
            tblQuarterCategoryFee fee = LicenceFee.GetQuarterCategeryFee(_allotte.tblQuarter.tblQuarterCategory.Id);
            if (fee != null && fee.LicenceFee.HasValue)
            {
                txtLicenceFee.Text = fee.LicenceFee.Value.ToString();
            }
        }
        else
        {
            lblmessage.Text      = "This quarter is not allotted to anyone yet";
            lblmessage.Visible   = true;
            btnAddUpdate.Enabled = false;
        }
    }
    protected void QuarterCategory_selectedindex(object sender, EventArgs e)
    {
        tblQuarterCategoryFee o = LicenceFee.GetQuarterCategeryFee(Convert.ToInt64(drpQuarterCat.SelectedValue));

        if (o != null)
        {
            if (o.LicenceFee.HasValue)
            {
                txtLicenceFee.Text = o.LicenceFee.Value.ToString();
            }
        }
    }
Beispiel #3
0
    public static decimal GetLicenceFeebyCategory(long category)
    {
        DataClassesDataContext dataContext = new DataClassesDataContext();
        var varlicFee             = from iLicenceFee in dataContext.tblQuarterCategoryFees where iLicenceFee.QuarterCategoryId == category select iLicenceFee;
        tblQuarterCategoryFee val = varlicFee.FirstOrDefault();

        if (val != null && val.LicenceFee.HasValue)
        {
            return(Convert.ToDecimal(val.LicenceFee));
        }
        return(0);
    }
Beispiel #4
0
    public static void Save(tblQuarterCategoryFee licFee)
    {
        DataClassesDataContext dataContext = new DataClassesDataContext();
        var varlicFee = from iLicenceFee in dataContext.tblQuarterCategoryFees where iLicenceFee.QuarterCategoryId == licFee.QuarterCategoryId select iLicenceFee;
        tblQuarterCategoryFee oLicenceFee = varlicFee.FirstOrDefault();

        if (oLicenceFee != null)
        {
            oLicenceFee.EffectiveDate     = licFee.EffectiveDate;
            oLicenceFee.QuarterCategoryId = licFee.QuarterCategoryId;
            //oLicenceFee.Month = licFee.Month;
            oLicenceFee.LicenceFee = licFee.LicenceFee;
            //oLicenceFee.LastUpdatedBy = licFee.LastUpdatedBy;
            //oLicenceFee.LastUpdatedDate = DateTime.Now;
        }
        if (oLicenceFee == null)
        {
            dataContext.tblQuarterCategoryFees.InsertOnSubmit(licFee);
        }

        dataContext.SubmitChanges();
    }
    protected void btnadd_Click(object sender, EventArgs e)
    {
        tblQuarterCategoryFee categoryfee = new tblQuarterCategoryFee();

        //categoryfee.LastUpdatedBy = 1;
        //categoryfee.Month = Convert.ToDateTime(txtmonth.Text);
        categoryfee.QuarterCategoryId = Convert.ToInt32(drpQuarterCat.SelectedValue);
        categoryfee.LicenceFee        = Convert.ToDouble(txtLicenceFee.Text);
        categoryfee.EffectiveDate     = Convert.ToDateTime(txtEffectiveDate.Text);
        LicenceFee.Save(categoryfee);
        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action = "Licence fee";
        //_userhistory.description = _user.Username + " has added Licence fee for quarter category " + categoryfee.tblQuarterCategory.Name;

        // Quartercategory name is selected from the drop down, not from database table..
        _userhistory.description = _user.Username + " has added Licence fee for quarter category " + drpQuarterCat.SelectedItem.Text;

        _userhistory.time    = DateTime.Now;
        _userhistory.useraan = _user.AAN;
        userHistory.Save(_userhistory);
        lblmessage.Visible = true;
        lblmessage.Text    = "Information saved successfully!";
    }