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

        if (_allotte != null)
        {
            decimal charge = 0;
            decimal.TryParse(txtDamageCharge.Text, out charge);
            tbquarterDamage quarterDamage = new tbquarterDamage();
            quarterDamage.AAN           = _allotte.AAN;
            quarterDamage.DamageCharges = charge;
            quarterDamage.Assementdate  = Convert.ToDateTime(txtMonth.Text);
            quarterDamage.Quarternumber = _allotte.tblQuarter.QuarterNumber;
            quarterDamage.Remarks       = txtRemarks.Text;
            Quarters.AddQuarterDamage(quarterDamage);
            lblmessage.Text    = "Information saved sucessfully!";
            lblmessage.Visible = true;
            empty();
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Licence fee";
            _userhistory.description = _user.Username + " has added quarter damage charges for quarter " + _allotte.tblQuarter.QuarterNumber;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
        else
        {
            lblmessage.Text    = "This quarter is not allotted to anyone yet";
            lblmessage.Visible = true;
        }
    }
Beispiel #2
0
    private void possession()
    {
        long id;

        Int64.TryParse(hdnSelected.Value, out id);
        AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        tbAllotmentApplication app      = AllotementApplications.GetApplication(id);
        tblAllottee            _allotte = Allottee.getAllotteByApplicationid(id);

        if (_allotte != null)
        {
            DateTime _dateofPossession;
            DateTime.TryParse(txtDateOfPossession.Text, out _dateofPossession);
            _allotte.Status           = (int)AllotementStatus.Possessed;
            _allotte.DateOfPossession = _dateofPossession;
            Allottee.Update(_allotte);
        }

        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action      = "Possession";
        _userhistory.description = _user.Username + " has marked possesed application with " + id;
        _userhistory.time        = DateTime.Now;
        _userhistory.useraan     = _user.AAN;
        userHistory.Save(_userhistory);
    }
Beispiel #3
0
 public void grdAllotte_command(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "vacant")
     {
         long id = Convert.ToInt64(e.CommandArgument);
         hdnselected.Value = id.ToString();
         //Allottee.VacantAllottement(id);
         //BindData();
         //tbluserhistory _userhistory = new tbluserhistory();
         //_userhistory.Action = "Allotement";
         //_userhistory.description = _user.Username + " has marked vacant with id " + id;
         //_userhistory.time = DateTime.Now;
         //_userhistory.useraan = _user.AAN;
         //userHistory.Save(_userhistory);
         tblAllottee _allotte = Allottee.GetAllottee(Convert.ToInt64(e.CommandArgument));
         txtName.Text          = AllotementApplications.GetApplication(_allotte.ApplicationId.Value).tblUser.fullName;
         txtQuarternumber.Text = _allotte.QuarterNumber;
         popVacant.Show();
     }
     else if (e.CommandName == "Retention")
     {
         long        id       = Convert.ToInt64(e.CommandArgument);
         tblAllottee _allotte = Allottee.GetAllottee(Convert.ToInt64(e.CommandArgument));
         txtRetName.Text                  = AllotementApplications.GetApplication(_allotte.ApplicationId.Value).tblUser.fullName;
         txtRetQuarerNumber.Text          = _allotte.QuarterNumber;
         txtDateOfRetension.Text          = string.Empty;
         txtdateofretensionupto.Text      = string.Empty;
         txtRemarks.Text                  = string.Empty;
         ddlRetentionPeriod.SelectedIndex = -1;
         ddlRetentionRule.SelectedIndex   = -1;
         hdnselected.Value                = id.ToString();
         ModalPopupExtender1.Show();
     }
 }
    private void BindData()
    {
        tblAllottee quarter = Allottee.GetAllottee(id);

        if (quarter != null)
        {
            //
            //drpDesignation.SelectedValue = quarter.Designation.ToString();
            tblUser user = Users.getUserByAAN(quarter.AAN);
            drpQuarterCatergory.SelectedValue = quarter.tblQuarter.Category.ToString();
            drpOffice.SelectedValue           = user.BaseOfficeId.ToString();
            txtAllotteeName.Text = user.AAN;
            if (user.DateOfRetirement.HasValue)
            {
                txtDor.Text = user.DateOfRetirement.Value.ToShortDateString();
            }
            if (user.DateOfJoining.HasValue)
            {
                txtDoj.Text = user.DateOfJoining.Value.ToShortDateString();
            }
            bindQuarter();
            drpQuarter.SelectedValue    = quarter.QuarterNumber;
            drpQuarterCatergory.Enabled = false;
            drpOffice.Enabled           = false;
            drpDesignation.Enabled      = false;
        }
    }
Beispiel #5
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text);

        if (_allotte != null)
        {
            tbQuarterLicenceFee fee = new tbQuarterLicenceFee();
            fee.AAN       = _allotte.AAN;
            fee.ActualFee = 0;
            fee.Fee       = Convert.ToDecimal(txtLicenceFee.Text);
            fee.Month     = Convert.ToDateTime(txtMonth.Text);
            fee.QuarterId = _allotte.tblQuarter.Id;
            fee.ActualFee = LicenceFee.GetLicenceFeebyCategory(_allotte.tblQuarter.Category);
            fee.Remarks   = txtRemarks.Text;
            LicenceFee.SaveMonthLicencefee(fee);
            lblmessage.Text    = "Information saved sucessfully!";
            lblmessage.Visible = true;
            empty();
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Licence fee";
            _userhistory.description = _user.Username + " has added Licence fee for quarter " + _allotte.tblQuarter.QuarterNumber;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
        else
        {
            lblmessage.Text    = "This quarter is not allotted to anyone yet";
            lblmessage.Visible = true;
        }
    }
Beispiel #6
0
    public void btnSaveRetension_click(object sender, EventArgs e)
    {
        long        id       = Convert.ToInt64(hdnselected.Value);
        tblAllottee _allotte = Allottee.GetAllottee(id);

        if (_allotte != null)
        {
            DateTime dateofRetension;
            DateTime.TryParse(txtDateOfRetension.Text, out dateofRetension);
            DateTime dateofRetensionupto;
            DateTime.TryParse(txtdateofretensionupto.Text, out dateofRetensionupto);
            _allotte.DateOfRetensionUpto = dateofRetensionupto;

            _allotte.Status          = (int)AllotementStatus.Retension;
            _allotte.DateOfRetension = dateofRetension;
            _allotte.RetentionReason = ddlRetentionRule.SelectedValue;
            Allottee.Update(_allotte);
            BindData();
            Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant);
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Allotement";
            _userhistory.description = _user.Username + " has marked vacant with id " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
    }
Beispiel #7
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;
        }
    }
Beispiel #8
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);

            var gridRow = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;


            HiddenField hidApplicationId = gridRow.FindControl("hidApplicationId") as HiddenField;

            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);
            Response.Redirect("~/admin/Allottee.aspx?appid=" + hidApplicationId.Value + "&ChangeRequestID=" + id + "&returnurl=admin/ViewChangeRequest.aspx");
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            DataClassesDataContext dataContext = new DataClassesDataContext();
            var requests = from request in dataContext.tblChangeRequests where request.Id == id select request;
            tblChangeRequest tblreject = requests.FirstOrDefault();
            if (tblreject != null)
            {
                //Added on January 24,2017
                tblAllottee allottee = Allottee.GetAllotteeByAAN(tblreject.AAN);
                Quarters.UpdateQuarterStatus(allottee.QuarterNumber, QuarterStatus.Vacant);

                //update allottee
                //Reset the quarter to previous one at the time of change request
                allottee.QuarterNumber = tblreject.QuarterNumber;
                Allottee.Update(allottee);
                //Added on January 24,2017 end

                dataContext.tblChangeRequests.DeleteOnSubmit(tblreject);
                dataContext.SubmitChanges();
            }
            BindGrid();
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.rejected);
            //Quarters.UpdateQuarterStatus(tblreject.QuarterNumber, QuarterStatus.Vacant); //Commented on Dec 12,2016 purposely
        }
        else if (e.CommandName == "Possesed")
        {
            var        gridRow    = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;
            LinkButton lnkAllotte = gridRow.FindControl("lnkAllotte") as LinkButton;
            hdnChangeRequestId.Value = lnkAllotte.CommandArgument;

            hdnSelected.Value = e.CommandArgument.ToString();
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(Convert.ToInt64(e.CommandArgument));
            txtName.Text = AllotementApplications.GetApplication(Convert.ToInt64(e.CommandArgument)).tblUser.fullName;
            if (_allotte != null)
            {
                txtQuarternumber.Text = _allotte.QuarterNumber;
            }

            pop.Show();
        }
    }
Beispiel #9
0
    private void possession()
    {
        long id;

        Int64.TryParse(hdnSelected.Value, out id);

        long changeRequestId;

        Int64.TryParse(hdnChangeRequestId.Value, out changeRequestId);


        AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        tbAllotmentApplication app      = AllotementApplications.GetApplication(id);
        tblAllottee            _allotte = Allottee.getAllotteByApplicationid(id);

        if (_allotte != null)
        {
            DateTime _dateofPossession;
            DateTime.TryParse(txtDateOfPossession.Text, out _dateofPossession);
            _allotte.Status           = (int)AllotementStatus.Possessed;
            _allotte.DateOfPossession = _dateofPossession;
            Allottee.Update(_allotte);
        }

        if (id > 0)
        {
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        }

        DataClassesDataContext dataContext = new DataClassesDataContext();
        var requests = from request in dataContext.tblChangeRequests where request.Id == changeRequestId select request;

        /*tblChangeRequest tblDelete = requests.FirstOrDefault();
         * if (tblDelete != null)
         * {
         *  dataContext.tblChangeRequests.DeleteOnSubmit(tblDelete);
         *  dataContext.SubmitChanges();
         * } //Finally deleting the change request changed on 02-06-2016*/

        tblChangeRequest tblUpdate = requests.FirstOrDefault();

        if (tblUpdate != null)
        {
            tblUpdate.Status = (int)ChangeRequestStatus.Approved;
            dataContext.SubmitChanges(); //Updating the status of request to approved
        }

        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action      = "Possession";
        _userhistory.description = _user.Username + " has marked possesed application with " + id;
        _userhistory.time        = DateTime.Now;
        _userhistory.useraan     = _user.AAN;
        userHistory.Save(_userhistory);
    }
    protected void  btnadd_Click(object sender, EventArgs e)
    {
        tblQuarter _quarter = Quarters.GetQuarter(txtQuarterNumber.Text);

        if (_quarter != null)
        {
            pnl.Visible = true;
            drpQuarterCatergory.SelectedValue = _quarter.tblQuarterCategory.Id.ToString();
            grdLicenceFee.DataSource          = LicenceFee.GetLicencefee(txtQuarterNumber.Text);
            grdLicenceFee.DataBind();
        }
        else
        {
            lblmessage.Text    = "Invalid quarter";
            lblmessage.Visible = true;
            return;
        }
        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();
            }

            txtAllotteName.Text = _user.fullName;
            txtAllotteeAAN.Text = _allotte.AAN;
            if (_allotte.DateOfPossession.HasValue)
            {
                txtDateOfPossession.Text = _allotte.DateOfPossession.Value.ToShortDateString();
            }
            if (_allotte.DateOfVacation.HasValue)
            {
                txtActualDateOfVacation.Text = _allotte.DateOfVacation.Value.ToShortDateString();
            }
            if (_allotte.DateOfRetension.HasValue)
            {
                txtDueDateOfVacation.Text = _allotte.DateOfRetension.Value.AddMonths(8).ToShortDateString();
            }
            txtRetentionPeriod.Text = "8";
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Licence fee";
            _userhistory.description = _user.Username + " has added Licence fee for quarter " + _allotte.tblQuarter.QuarterNumber;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
    }
Beispiel #11
0
    private static void update(tblAllottee allotte)
    {
        DataClassesDataContext datacontext = new DataClassesDataContext();

        tblAllottee allotteeToUpdate = datacontext.tblAllottees.Where(x => x.Id == allotte.Id).SingleOrDefault();

        allotteeToUpdate.AAN              = allotte.AAN;
        allotteeToUpdate.QuarterNumber    = allotte.QuarterNumber;
        allotteeToUpdate.ApplicationId    = allotte.ApplicationId;
        allotteeToUpdate.Status           = allotte.Status;
        allotteeToUpdate.DateOfAllotement = allotte.DateOfAllotement;

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

        if (_allotte != null)
        {
            tblUser _user = Users.getUserByAAN(_allotte.AAN);
            txtAllotteeAAN.Text = _allotte.AAN;
        }
        else
        {
            lblmessage.Text      = "This quarter is not allotted to anyone yet";
            lblmessage.Visible   = true;
            btnAddUpdate.Enabled = false;
        }
    }
Beispiel #13
0
    private static void insert(tblAllottee allotte)
    {
        //string query = "insert into tblAllottee(aan,quarternumber,ApplicationId,Status,DateOfAllottement)values('" + allotte.AAN + "','" + allotte.QuarterNumber + "'," + allotte.ApplicationId + "," + allotte.Status + ","+allotte.DateOfAllotement+")";
        DataClassesDataContext datacontext = new DataClassesDataContext();
        //datacontext.ExecuteCommand(query, "");

        tblAllottee tblAlottee = new tblAllottee();

        tblAlottee.AAN              = allotte.AAN;
        tblAlottee.QuarterNumber    = allotte.QuarterNumber;
        tblAlottee.ApplicationId    = allotte.ApplicationId;
        tblAlottee.Status           = allotte.Status;
        tblAlottee.DateOfAllotement = allotte.DateOfAllotement;

        datacontext.tblAllottees.InsertOnSubmit(tblAlottee);
        datacontext.SubmitChanges();
    }
Beispiel #14
0
    public static void Update(tblAllottee allottee)
    {
        DataClassesDataContext datacontext = new DataClassesDataContext();
        var         varQuarters            = from quarterInfo in datacontext.tblAllottees where quarterInfo.Id == allottee.Id select quarterInfo;
        tblAllottee quaterValue            = datacontext.tblAllottees.Where(x => x.Id == allottee.Id).FirstOrDefault();

        if (quaterValue != null)
        {
            if (allottee.DateOfAllotement.HasValue)
            {
                quaterValue.DateOfAllotement = allottee.DateOfAllotement;
            }
            if (allottee.DateOfPossession.HasValue)
            {
                quaterValue.DateOfPossession = allottee.DateOfPossession;
            }
            if (allottee.DateOfRetension.HasValue)
            {
                quaterValue.DateOfRetension = allottee.DateOfRetension.Value;
            }
            if (allottee.DateOfVacation.HasValue)
            {
                quaterValue.DateOfVacation = allottee.DateOfVacation;
            }
            if (allottee.DateOfRetensionUpto.HasValue)
            {
                quaterValue.DateOfRetensionUpto = allottee.DateOfRetensionUpto;
            }
            if (!string.IsNullOrEmpty(allottee.Remarks))
            {
                quaterValue.Remarks = allottee.Remarks;
            }
            if (!string.IsNullOrEmpty(allottee.RetentionReason))
            {
                quaterValue.RetentionReason = allottee.RetentionReason;
            }
            if (!string.IsNullOrEmpty(allottee.QuarterNumber))
            {
                quaterValue.QuarterNumber = allottee.QuarterNumber;
            }

            quaterValue.Status = allottee.Status.Value;
            datacontext.SubmitChanges();
        }
    }
Beispiel #15
0
    public static void Save(tblAllottee allottee)
    {
        DataClassesDataContext datacontext = new DataClassesDataContext();
        var         varQuarters            = from quarterInfo in datacontext.tblAllottees where quarterInfo.Id == allottee.Id select quarterInfo;
        tblAllottee quaterValue            = varQuarters.FirstOrDefault();

        if (quaterValue == null)
        {
            //datacontext.tblAllottees.InsertOnSubmit(allottee);
            insert(allottee);
        }
        else
        {
            update(allottee);
            //quaterValue.DateOfJoining = allottee.DateOfJoining;
            //quaterValue.DateOfRetirement = allottee.DateOfRetirement;
            //quaterValue.Designation = allottee.Designation;
            //quaterValue.Name = allottee.Name;
            //quaterValue.OfficeId = allottee.OfficeId;
        }
        datacontext.SubmitChanges();
    }
Beispiel #16
0
    protected void btnVacant_click(object sender, EventArgs e)
    {
        int         id       = Convert.ToInt32(hdnselected.Value);
        tblAllottee _allotte = Allottee.GetAllottee(id);

        if (_allotte != null)
        {
            DateTime dateofVacation;
            DateTime.TryParse(txtDateOfVacation.Text, out dateofVacation);
            _allotte.Status         = (int)AllotementStatus.vacant;
            _allotte.DateOfVacation = dateofVacation;
            Allottee.Update(_allotte);
            BindData();
            Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, (int)QuarterStatus.Vacant, "Quarter marked as vacant.", txtDateOfVacation.Text);
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Allotement";
            _userhistory.description = _user.Username + " has marked vacant with id " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
    }
    protected void btnadd_Click(object sender, EventArgs e)
    {
        tblAllottee _Allottee = null;

        if (id > 0)
        {
            _Allottee = Allottee.GetAllottee(id);
        }
        else
        {
            tblAllottee a = Allottee.GetAllotteeByAAN(txtAllotteeName.Text);
            if (a != null)
            {
                _Allottee = a;
                //lblmessage.Text = "User has already allotted quarter!";
                //lblmessage.Visible = true;
                //return;
            }

            if (a == null)
            {
                _Allottee = new tblAllottee();
            }

            tblQuarter quarter = Quarters.GetQuarter(drpQuarter.SelectedValue);
            if (quarter == null)
            {
                lblmessage.Text    = "Please enter valid number";
                lblmessage.Visible = true;
                return;
            }
            else if (quarter.Status.HasValue && quarter.Status != (int)QuarterStatus.Vacant)
            {
                lblmessage.Text    = "Quarter is not vacant!";
                lblmessage.Visible = true;
                return;
            }
            quarter.DateOfAllottement = DateTime.Now;
            quarter.Status            = (int)QuarterStatus.Alloted;
            Quarters.Save(quarter);

            //_Allottee = new tblAllottee();
        }
        _Allottee.QuarterNumber    = drpQuarter.SelectedValue;
        _Allottee.AAN              = txtAllotteeName.Text;
        _Allottee.ApplicationId    = applicationid;
        _Allottee.Status           = btnAddUpdate.Text == "Add Change Request" ? (int)AllotementStatus.ChangeRequested : (int)AllotementStatus.Possessed;
        _Allottee.DateOfAllotement = DateTime.Now;
        //_Allottee.OfficeId = Convert.ToInt32(drpOffice.SelectedValue);
        //_Allottee.Designation =Convert.ToInt32( drpDesignation.SelectedValue);
        //_Allottee.DateOfJoining = Convert.ToDateTime(txtDoj.Text);
        //_Allottee.DateOfRetirement = Convert.ToDateTime(txtDor.Text);
        //_Allottee.Name = txtAllotteeName.Text;
        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action      = "Allotement";
        _userhistory.description = _user.Username + " has allotted quarter " + _Allottee.QuarterNumber + " to user " + _Allottee.AAN;
        _userhistory.time        = DateTime.Now;
        _userhistory.useraan     = _user.AAN;
        userHistory.Save(_userhistory);

        Allottee.Save(_Allottee);
        if (applicationid > 0)
        {
            AllotementApplications.UpdateApplicationStaus(applicationid, btnAddUpdate.Text == "Add Change Request" ? ApplicationStatus.ChangeRequested : ApplicationStatus.Allotted);
        }
        if (!string.IsNullOrEmpty(Request["returnurl"]))
        {
            Response.Redirect("~/" + Request["returnurl"]);
        }
        else
        {
            Response.Redirect("~/admin/Allottees.aspx");
        }
    }
Beispiel #18
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            // AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "Possesed")
        {
            hdnSelected.Value = e.CommandArgument.ToString();
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(Convert.ToInt64(e.CommandArgument));
            txtName.Text          = AllotementApplications.GetApplication(Convert.ToInt64(e.CommandArgument)).tblUser.fullName;
            txtQuarternumber.Text = _allotte.QuarterNumber;

            pop.Show();
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Allottee.UpdateAllottementStatus(id, AllotementStatus.withdraw);
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(id);
            if (_allotte != null)
            {
                long quarterid = _allotte.tblQuarter.Id;
                _allotte.Status         = (int)AllotementStatus.withdraw;
                _allotte.DateOfwithdraw = DateTime.Now;
                Allottee.Update(_allotte);

                Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant);
            }
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Withdraw";
            _userhistory.description = _user.Username + " has marked Withdraw application with " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
            // Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "CancelApplication")
        {
            //Move quarter to vacant list
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.rejected);
            Allottee.UpdateAllottementStatus(id, AllotementStatus.vacant);
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(id);
            if (_allotte != null)
            {
                long quarterid = _allotte.tblQuarter.Id;
                _allotte.Status         = (int)AllotementStatus.vacant;
                _allotte.DateOfVacation = DateTime.Now;
                Allottee.Update(_allotte);

                Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant);
            }
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Cancel";
            _userhistory.description = _user.Username + " has marked cancel application with " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
        BindData();
        //DataNavigateUrlFormatString="~/admin/Allottee.aspx?Applicationid={0}&returnurl=admin/Prioritizeapplications.aspx"
    }
Beispiel #19
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long   id;
            string aan           = string.Empty;
            string quarterNumber = string.Empty;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);

            tblAllottee _Allottee = null;
            //if (id > 0)
            //{
            //  _Allottee = Allottee.GetAllottee(id);
            //}
            //else
            //{
            var gridRow = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;

            var hidAAN = gridRow.FindControl("hidAAN") as HiddenField;
            aan = hidAAN.Value;
            tblAllottee a = Allottee.GetAllotteeByAAN(aan);

            if (a != null)
            {
                //lblMessage.Text = "User has already allotted quarter!";
                //lblMessage.Visible = true;
                //return;
                _Allottee = a;
            }
            else
            {
                _Allottee = new tblAllottee();
            }
            Label lblQuarterNumber = gridRow.FindControl("lblQuarterNumber") as Label;
            quarterNumber = lblQuarterNumber.Text;

            tblQuarter quarter = Quarters.GetQuarter(quarterNumber);
            if (quarter == null)
            {
                lblMessage.Text    = "Quarter number selected is not valid";
                lblMessage.Visible = true;
                return;
            }
            else if (quarter.Status.HasValue && quarter.Status != (int)QuarterStatus.Vacant)
            {
                lblMessage.Text    = "Quarter is not vacant!";
                lblMessage.Visible = true;
                return;
            }
            quarter.DateOfAllottement = DateTime.Now;
            quarter.Status            = (int)QuarterStatus.Alloted;
            Quarters.Save(quarter);

            //_Allottee = new tblAllottee();

            //}
            _Allottee.QuarterNumber    = quarterNumber;
            _Allottee.AAN              = aan;
            _Allottee.ApplicationId    = id;
            _Allottee.Status           = (int)AllotementStatus.Allotted;
            _Allottee.DateOfAllotement = DateTime.Now;
            //_Allottee.OfficeId = Convert.ToInt32(drpOffice.SelectedValue);
            //_Allottee.Designation =Convert.ToInt32( drpDesignation.SelectedValue);
            //_Allottee.DateOfJoining = Convert.ToDateTime(txtDoj.Text);
            //_Allottee.DateOfRetirement = Convert.ToDateTime(txtDor.Text);
            //_Allottee.Name = txtAllotteeName.Text;
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Allotement";
            _userhistory.description = _user.Username + " has allotted quarter " + _Allottee.QuarterNumber + " to user " + _Allottee.AAN;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);

            Allottee.Save(_Allottee);
            if (id > 0)
            {
                AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);

                try
                {
                    //SEND SMS
                    new IntegratedMessageSender().SendMessage("QUARTER_ALLOTTED", _Allottee.QuarterNumber, AllotementApplications.GetApplicationByAAN(aan).ContactNumber);
                }
                catch (Exception)
                {
                    throw;
                }
            }

            BindData();

            ///Response.Redirect("~/admin/Allottee.aspx?Applicationid="+id+"&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            BindData();
            // AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        }
        else if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "AllotteManual")
        {
            //Manual allocation
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx?selectedCategory=" + drpQuarterCatergory.SelectedValue);
        }
        //DataNavigateUrlFormatString="~/admin/Allottee.aspx?Applicationid={0}&returnurl=admin/Prioritizeapplications.aspx"
    }