Ejemplo n.º 1
0
    void UpdatePanCard()
    {
        var panCardId = GetPanCardIdFromQueryString();

        if (string.IsNullOrEmpty(panCardId))
        {
            return;
        }
        var query = ConfigurationManager.AppSettings["qryUpdatePanCardDetails"];

        query = SqlHandler.AddConditionToQuery(query, new List <string> {
            "ID=" + panCardId
        });
        var panCard = GetPanCardValuesFromControls();

        panCard.ClientId = CurrentUser.UserRole.Role.ToLower() == "admin" ? Convert.ToInt32(ddlClient.SelectedValue) : GetPancardDetailsById().ClientId;
        var result = PanCardRepository.UpdatePanCard(query, panCard);

        divMessage.Visible = true;
        if (result != 0)
        {
            divMessage.Attributes["class"] = "bg-success";
            divMessage.InnerHtml           = "Updated!";
            hlPanImage.Text        = panCard.FilePath;
            hlPanImage.NavigateUrl = "PanCardImages/" + panCard.FilePath;
        }
        else
        {
            divMessage.Attributes["class"] = "bg-warning";
            divMessage.InnerHtml           = "Updated failed";
        }
    }
Ejemplo n.º 2
0
    protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        var index = e.RowIndex;
        var row   = grvPanDetails.Rows[index];
        var label = row.FindControl("lblId") as Label;

        if (label != null)
        {
            var id         = Convert.ToInt32(label.Text);
            var query      = ConfigurationManager.AppSettings["qryDeletePanCardDetails"];
            var conditions = new List <string> {
                "ID=" + id
            };
            query = SqlHandler.AddConditionToQuery(query, conditions);
            PanCardRepository.UpdatePanCard(query, new PanCard {
                UpdatedById = CurrentUser.Id
            });
        }
        grvPanDetails.BindGridView(GetPanCardDetailsBySearchTerms(), PageSize, 0, _columnIndexesToHide);
    }