protected void btnSave_Click(object sender, EventArgs e) { HttpPostedFile postedFile = Request.Files["smsFile"]; if (postedFile == null || postedFile.ContentLength <= 0) { Session["ErrorMessage"] = "Please select a file"; return; } var outputFile = FileHelper.SaveFile(postedFile); long tmpId = long.Parse(ddlTemplate.SelectedValue); int userId = CurrentUser.Id(); _SMS_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); bulk_SMS = new tbl_Bulk_SMS { Created_At = DateTime.Now, File_Name = outputFile["FileName"].ToString(), File_Path = outputFile["FilePath"].ToString(), Status = "New", Updated_At = DateTime.Now, Template_Id = tmpId, User_Id = userId }; _SMS_EMAIL_DB_Entities.AddTotbl_Bulk_SMS(bulk_SMS); _SMS_EMAIL_DB_Entities.SaveChanges(); Response.Redirect("Index.aspx"); }
protected void lkBtnErrorDownload_Click(object sender, EventArgs e) { var lkBtn = (LinkButton)sender; var id = long.Parse(lkBtn.CommandArgument.ToString()); _SMS_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); bulk_SMS = _SMS_EMAIL_DB_Entities.tbl_Bulk_SMS.Where(x => x.Id == id).First(); sendFile(bulk_SMS.Error_File_Name, bulk_SMS.Error_File_Path); }