Hello,
i want add other option to print, so is there chance to print then store?
While insert user data i want first print then store then store use data
I am using store data then print from GridView
//add report from Table_vacation
protected void Insert(object sender, EventArgs e)
{
string IpassAstringfrompage1 = Convert.ToString(Session["Name"]);
string filename = Path.GetFileName(FileUpload2.PostedFile.FileName);
string contentType = FileUpload2.PostedFile.ContentType;
using (Stream fs = FileUpload2.PostedFile.InputStream)
{
using (BinaryReader br = new BinaryReader(fs))
{
byte[] bytes = br.ReadBytes((Int32)fs.Length);
string constr = ConfigurationManager.ConnectionStrings["kankonConnectionString"].ConnectionString;
SqlConnection con;
SqlCommand cmd;
using (con = new SqlConnection(constr))
{
string query = "insert into Table_vacation (idnamev,jop,eldarajah,el3malv,datesp10,idcivilv,datestart,dateend,vacationdata,totalva,infovacation,namevacation,iPAddress,dataaddtime,edit,Name,ContentType,backupmyfile) VALUES (@idnamev,@jop,@eldarajah,@el3malv,@datesp10,@idcivilv,@datestart,@dateend,@vacationdata,@totalva,@infovacation,@namevacation,@iPAddress,@dataaddtime,@edit,@Name,@ContentType,@backupmyfile)";
using (cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Name", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@backupmyfile", bytes);
cmd.Parameters.AddWithValue("@idnamev", txtUsername.Text);
cmd.Parameters.AddWithValue("@jop", joptitel.Text);
cmd.Parameters.AddWithValue("@eldarajah", eldarajah.Text);
cmd.Parameters.AddWithValue("@el3malv", markazel3mel.Text);
cmd.Parameters.AddWithValue("@datesp10", filenumber.Text);
cmd.Parameters.AddWithValue("@idcivilv", civilid.Text);
cmd.Parameters.AddWithValue("@datestart", txtBoxDate.Text);
cmd.Parameters.AddWithValue("@dateend", txtBoxDate2.Text);
cmd.Parameters.AddWithValue("@vacationdata", txtBoxDate4.Text);
cmd.Parameters.AddWithValue("@totalva", lblLabel1.Text);
cmd.Parameters.AddWithValue("@infovacation", VacationList1.Text);
cmd.Parameters.AddWithValue("@namevacation", "اجازة دورية");
cmd.Parameters.AddWithValue("@iPAddress", IpassAstringfrompage1);
cmd.Parameters.AddWithValue("@dataaddtime", Convert.ToDateTime(DateTime.Now.ToLongTimeString()));
cmd.Parameters.AddWithValue("@edit", "(جديد)");
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
//insert date vacation into user data start date vacation to end date vacation
using (con = new SqlConnection(constr))
{
string query = "UPDATE Table_infoname SET DateTimePicker1 = @DateTimePicker1,DateTimePicker2 = @DateTimePicker2 WHERE civilid = @Civilid";
using (cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@civilid", civilid.Text.ToString());
cmd.Parameters.AddWithValue("@DateTimePicker1", txtBoxDate.Text.ToString());
cmd.Parameters.AddWithValue("@DateTimePicker2", txtBoxDate2.Text.ToString());
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
}
}
code c# print
Session["name"] = txtUsername.Text;
Session["jop"] = joptitel.Text;
Session["markazel3mel"] = markazel3mel.Text;
Session["eldarajah"] = eldarajah.Text;
Session["filenumber"] = filenumber.Text;
Session["civilid"] = civilid.Text;
Session["txtBoxDate"] = txtBoxDate.Text;
Session["txtBoxDate2"] = txtBoxDate2.Text;
Session["txtBoxDate4"] = txtBoxDate4.Text;
Session["VacationList1"] = VacationList1.Text;
string url = "/Admin/vication.aspx";
string s = "window.open('" + url + "', 'popup_window', 'width=800,height=950,resizable=no');";
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);