Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)

        {
            try
            {
                //GridPosed.DataSource = GetPPR();
                //GridPosed.DataBind();
                btnSubmit.Visible = false;
                DataTable dtt = new DataTable();
                dtt = GetPPR();
                if (dtt.Rows.Count > 0)
                {
                    for (int i = 0; i < dtt.Rows.Count; i++)
                    {
                        dtt.Rows[i]["PPR"] = HttpUtility.HtmlDecode(dtt.Rows[i]["PPR"].ToString());
                    }
                }
                ddlPPRID.DataSource     = dtt;
                ddlPPRID.DataTextField  = "PPR";
                ddlPPRID.DataValueField = "PPRId";
                ddlPPRID.DataBind();
                ddlPPRID.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select ---", ""));
                GridPosedDetails.DataSource = GetPPRDetails();
                GridPosedDetails.DataBind();
                if (Request.QueryString["pPoseID"] != null && dtt.Rows.Count > 0)
                {
                    ddlPPRID.SelectedValue = Request.QueryString["pPoseID"].ToString();
                    ddlPPRID_SelectedIndexChanged(this, e);
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
    }
Exemplo n.º 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable   dt           = new DataTable();
            MailUtility objm         = new MailUtility();
            string      Errmessage   = string.Empty;
            string      Succmessage  = string.Empty;
            int         countercheck = 0;


            for (int i = 0; i < GridPosed.Rows.Count; i++)
            {
                using (SqlConnection conn = new SqlConnection())
                {
                    conn.ConnectionString = ConfigurationManager.ConnectionStrings["PPRSqlConnection"].ConnectionString;

                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.CommandText = "USP_UpdatePPRforPosing";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@PPRId", (GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value);
                        cmd.Parameters.AddWithValue("@Date", CommonUtility.getmmddyyyy((GridPosed.Rows[i].FindControl("txtMeetingDate") as TextBox).Text));
                        cmd.Parameters.AddWithValue("@PosedMDBID", (GridPosed.Rows[i].FindControl("ddlMDB") as DropDownList).SelectedValue);
                        cmd.Parameters.AddWithValue("@LoanPosedID", (GridPosed.Rows[i].FindControl("ddlLoanPosed") as DropDownList).SelectedValue);
                        cmd.Parameters.AddWithValue("@PosedBy", Session["UserId"] != null ? Session["UserId"].ToString():"0");
                        string folderPath = Server.MapPath("~/writedata/PosedDocument/");
                        string filename   = Session["UserId"] != null ? Session["UserId"].ToString() : "";
                        string ToMailId   = string.Empty;
                        filename = "PosedDoc_" + filename + HttpUtility.HtmlEncode((GridPosed.Rows[i].FindControl("ddlMDB") as DropDownList).SelectedValue + ((GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value) + CommonUtility.GetDate(DateTime.Now));
                        cmd.Parameters.AddWithValue("@PosedDocName", filename);
                        FileUpload fileu = (GridPosed.Rows[i].FindControl("fluPosedDoc") as FileUpload);
                        cmd.Connection = conn;
                        conn.Open();
                        if (ValidatePDF(fileu))
                        {
                            if (fileu.HasFile == true)
                            {
                                fileu.PostedFile.SaveAs(folderPath + "\\" + filename + ".pdf");
                            }
                            cmd.ExecuteNonQuery();
                            conn.Close();
                            Succmessage = Succmessage != "" ? Succmessage + ", " + (GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value : (GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value;
                            DataSet ds = new DataSet();
                            ds = getMailDetails((GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value, (GridPosed.Rows[i].FindControl("ddlMDB") as DropDownList).SelectedValue);
                            for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                            {
                                ToMailId = ToMailId + ds.Tables[0].Rows[j]["N_Email"].ToString() + ",";
                            }
                            //SaveNotification(Session["LoginId"] != null ? Session["LoginId"].ToString() : "0", "message", dte.Rows[i]["UserId"].ToString(), (GridPosed.Rows[i].FindControl("hdnPPRId") as HiddenField).Value), "4", "~/Authenticate/posing/acknowledgement.aspx", "~/Authenticate/LinMin/MeetingNotice.aspx", "0");
                            objm.SendPosedPPRmail(ToMailId, HttpUtility.HtmlDecode((GridPosed.Rows[i].FindControl("lblPPRID") as Label).Text), folderPath + filename + ".pdf", (GridPosed.Rows[i].FindControl("txtMeetingDate") as TextBox).Text, (GridPosed.Rows[i].FindControl("ddlMDB") as DropDownList).SelectedItem.ToString());
                        }
                        else
                        {
                            Alert.show(lblMessage.Text);
                            return;
                        }
                    }
                }
            }
            Alert.show("PPR ID" + Succmessage + " is posed successfully");
            lblMessage.Text             = "PPR ID" + Succmessage + " is posed successfully";
            GridPosedDetails.DataSource = GetPPRDetails();
            GridPosedDetails.DataBind();
            ddlPPRID.DataSource     = GetPPR();
            ddlPPRID.DataTextField  = "PPR";
            ddlPPRID.DataValueField = "PPRId";
            ddlPPRID.DataBind();
            ddlPPRID.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select ---", ""));
            GridPosed.DataSource = null;
            GridPosed.DataBind();
            btnSubmit.Visible = false;
        }
        catch (Exception ex)
        {
            LogError(ex);
        }
    }