Example #1
0
    protected IEnumerable <PanCard> GetAllPanCardDetails()
    {
        var query = ConfigurationManager.AppSettings["qryGetAllPanCardDetails"];

        if (CurrentUser.UserRole.Role.ToLower() != "admin")
        {
            query = SqlHandler.AddConditionToQuery(query, new List <string> {
                "p.CreatedById=" + CurrentUser.Id + " OR clientId=" + CurrentUser.Id
            });
        }
        return(PanCardRepository.GetAllPanCards(query, ConfigurationManager.AppSettings["rmapGetAllPanCardDetails"]));
    }
Example #2
0
    protected IEnumerable <PanCard> GetPanCardDetailsBySearchTerms()
    {
        var query      = ConfigurationManager.AppSettings["qryGetAllPanCardDetails"];
        var conditions = new List <string> ();

        if (chkApplicationNumber.Checked && txtApplicationNumber.Text.Trim() != "")
        {
            conditions.Add("ApplicationNumber='" + txtApplicationNumber.Text + "'");
        }
        if (chkName.Checked && txtName.Text.Trim() != "")
        {
            conditions.Add("CustomerName like '%" + txtName.Text + "%'");
        }
        if (chkDateOfBirth.Checked && dtDateOfBirth.Text.Trim() != "")
        {
            var dateOfBirth = DateTime.ParseExact(dtDateOfBirth.Text.Trim(), "dd/mm/yyyy", CultureInfo.InvariantCulture);
            conditions.Add("DateOfBirth=#" + dateOfBirth.ToString("yyyy/mm/dd") + "#");
        }
        if (chkFatherName.Checked && txtFatherName.Text.Trim() != "")
        {
            conditions.Add("FatherName like '%" + txtFatherName.Text + "%'");
        }
        if (chkPanEntryDate.Checked && dtPanEntryDate.Text.Trim() != "")
        {
            var panEntryDate = DateTime.ParseExact(dtPanEntryDate.Text.Trim(), "dd/mm/yyyy", CultureInfo.InvariantCulture);
            conditions.Add("datevalue(PanEntryDate)=#" + panEntryDate.ToString("yyyy/mm/dd") + "#");
        }
        if (CurrentUser.UserRole.Role.ToLower() == "admin" && chkClient.Checked)
        {
            conditions.Add("p.ClientId=" + ddlClient.SelectedItem.Value);
        }
        if (CurrentUser.UserRole.Role.ToLower() != "admin")
        {
            conditions.Add("(p.CreatedById=" + CurrentUser.Id + "OR clientId=" + CurrentUser.Id + ")");
        }
        query = SqlHandler.AddConditionToQuery(query, conditions);
        return(PanCardRepository.GetAllPanCards(query, ConfigurationManager.AppSettings["rmapGetAllPanCardDetails"]));
    }