示例#1
0
    protected void PPRDetailsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeletePpr")
        {
            //Determine the RowIndex of the Row whose Button was clicked.
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            //Reference the GridView Row.
            GridViewRow row = PPRDetailsGridView.Rows[rowIndex];

            //Fetch value of Name.
            string PPRId = (row.FindControl("lblPPRId") as Label).Text;

            try
            {
                MailUtility objm   = new MailUtility();
                PPRDataBL   obj    = new PPRDataBL();
                DataTable   dt     = new DataTable();
                string      SendTo = string.Empty;
                int         success;
                obj     = new PPRDataBL();
                success = obj.DeletePPrdraftDataBL(PPRId, Session["UserId"] != null ? Session["UserId"].ToString():"0");
                DisplayPPRDetails();
                if (success > 0)
                {
                    //DashBoardDataBL obje = null;
                    //obje = new DashBoardDataBL();
                    //dt = obje.GetWithdrawPprUserEmailBL(PPRId);
                    //if(dt.Rows.Count>0)
                    //{
                    //    for (int i=0; i < dt.Rows.Count; i++)
                    //    {
                    //        SendTo = dt.Rows[i]["N_Email"].ToString();
                    //        SendTo = SendTo + ";" + dt.Rows[i]["N_Email"].ToString();
                    //    }
                    //   // objm.SendMailForPPRWithdraw(SendTo, PPRId);
                    //}
                    Alert.show("PPR has been Withdraw successfully!");
                }
                DisplayPPRDetails();
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
    }
    protected void PPRDraftGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "EditPpr")
        {
            try
            {
                //Determine the RowIndex of the Row whose Button was clicked.
                int rowIndex = Convert.ToInt32(e.CommandArgument);

                //Reference the GridView Row.
                GridViewRow row = DraftGridView.Rows[rowIndex];

                //Fetch value of Name.
                string PPRId = (row.FindControl("hdnpprid") as HiddenField).Value;

                Session["PprEditId"] = PPRId;
                Response.Redirect("PprOneEdit.aspx", false);
                Session["ButtonShow"] = "DraftPpr";
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
        if (e.CommandName == "DeletePpr")
        {
            //Determine the RowIndex of the Row whose Button was clicked.
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            //Reference the GridView Row.
            GridViewRow row = DraftGridView.Rows[rowIndex];

            //Fetch value of Name.
            string PPRId = (row.FindControl("hdnpprid") as HiddenField).Value;

            try
            {
                PPRDataBL obj = new PPRDataBL();
                DataTable dt  = new DataTable();
                int       success;
                obj     = new PPRDataBL();
                success = obj.DeletePPrdraftDataBL(PPRId, Session["UserId"] != null ? Session["UserId"].ToString() : "0");
                DisplayDraftPPRDetails();
                if (success > 0)
                {
                    Alert.show("Record has been deleted successfully!");
                }
                DisplayDraftPPRDetails();
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }

        if (e.CommandName == "ProposalPreview")
        {
            try
            {
                string PprId = e.CommandArgument.ToString();
                string url   = "../LinMin/PprPreview.aspx?PPRID=" + PprId;
                ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>var myPopup = window.open('{0}', 'Cliente','width=1100,height=700,left=200,top=50,resizable=yes', 'true');if(!myPopup)alert('a popup was blocked. please enable pop setting on brower');</script>", url));
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
    }