예제 #1
0
 public void fillgrid()
 {
     objda.nid      = "";
     objda.filecode = Request.QueryString["fileid"].ToString();
     objda.action   = "select";
     ds             = objda.ManageEmailFileShare();
     if (ds.Tables[0].Rows.Count > 0)
     {
         repfile.DataSource = ds.Tables[1];
         repfile.DataBind();
     }
     else
     {
     }
 }
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            if (Session["email_empid"] == null || Session["email_empname"] == null || Session["email_sendername"] == null || Session["email_senderemail"] == null)
            {
                Response.Redirect("sessionexpired.html");
            }
            else
            {
                string datetime = DateTime.Now.ToFileTimeUtc().ToString();
                string fileid   = "";

                if (Session["file"] != null)
                {
                    tblfile = (DataTable)Session["file"];
                    if (tblfile.Rows.Count > 0)
                    {
                        try
                        {
                            objfile.action  = "saveFile";
                            objfile.dob     = GeneralMethod.getLocalDateTime();
                            objfile.nid     = "";
                            objfile.name    = Session["email_sendername"].ToString();
                            objfile.emailid = Session["email_senderemail"].ToString();
                            objfile.sentto  = Session["email_empid"].ToString();
                            ds = objfile.ManageEmailFileShare();
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                objfile.nid = ds.Tables[0].Rows[0]["nid"].ToString();
                                fileid      = ds.Tables[0].Rows[0]["filecode"].ToString();
                                for (int i = 0; i < tblfile.Rows.Count; i++)
                                {
                                    objfile.originalfile = tblfile.Rows[i]["originalname"].ToString();
                                    objfile.savedfile    = tblfile.Rows[i]["savename"].ToString();
                                    ds = objfile.ManageEmailFileShare();
                                }

                                hidcurfilesize.Value = "0";
                            }


                            if (sendemail(tblfile.Rows.Count, fileid))
                            {
                                Session["file"]    = null;
                                divfile.Visible    = false;
                                divmessage.Visible = true;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Error in Sending!');</script>", false);
                            }
                        }
                        catch
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Error in Sending!');</script>", false);
                            return;
                        }
                    }
                    else
                    {
                        Session["file"] = null;
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                        return;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                    return;
                }
            }
        }