hello,
How to add 3 conditions in sweet alert.
My code is print then same to table.
So i want add also when i press the button the data has been add.
Next do you want also print? My code behind with 2 condition sweet alert.
protected void BtnUser_Click(object sender, EventArgs e)
{
//search data
if (Uname.Text == String.Empty)
{
ClientScript.RegisterStartupScript(this.GetType(), "randomtext", " alertmecheck()", true);
}
else
{
/// =========== print
//user unfo
Session["Uname"] = Uname.Text;
Session["Ucivilid"] = Ucivilid.Text;
Session["Ufileid"] = Ufileid.Text;
//user locations
Session["ddlCountries"] = ddlCountries.SelectedItem.Text;
Session["ddlStates"] = ddlStates.SelectedItem.Text;
Session["ddlCities"] = ddlCities.SelectedItem.Text;
//PC
Session["ddlPC"] = ddlPC.SelectedValue.ToString();
Session["txtmodelPC"] = txtmodelPC.SelectedValue.ToString();
Session["serialPC"] = serialPC.Text;
//Printer
Session["ddlPrint"] = ddlPrint.Text;
Session["txtmodelPrint"] = txtmodelPrint.Text;
Session["serialPrint"] = serialPrint.Text;
//Scanner
Session["ddlscan"] = ddlscan.Text;
Session["txtmodelScan"] = txtmodelScan.Text;
Session["serialScan"] = serialScan.Text;
//IP Phone
Session["ddlPhone"] = ddlPhone.Text;
Session["txtmodelphone"] = txtmodelphone.Text;
Session["serialPhone"] = serialPhone.Text;
//VDI
Session["ddlVID"] = ddlVDI.Text;
Session["txtModelVDI"] = txtModelVDI.Text;
Session["seriaVDI"] = seriaVDI.Text;
string url = "/Users/PCReportUser.aspx";
string s = "window.open('" + url + "', 'popup_window', 'width=830,height=1000,left=100,top=100,resizable=yes');";
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
//=============== save data into table
string constr = ConfigurationManager.ConnectionStrings["cmConnectionString"].ConnectionString;
SqlConnection con;
SqlCommand cmd;
using (con = new SqlConnection(constr))
{
string UserHostName = HttpContext.Current.Request.UserHostName;
string UserHostip = System.Net.Dns.GetHostName();
string usernamemove = this.Page.User.Identity.Name;
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string contentType = FileUpload1.PostedFile.ContentType;
using (Stream fs = FileUpload1.PostedFile.InputStream)
{
using (BinaryReader br = new BinaryReader(fs))
{
byte[] bytes = br.ReadBytes((Int32)fs.Length);
string query = "insert into Table_PC_Register (NameFile,ContentType,backupmyfile,Uname,Ucivilid,Ufileid,ddlCountries,ddlStates,ddlCities,ddlPC,txtmodelPC,serialPC,ddlPrint,txtmodelPrint,serialPrint,ddlscan,txtmodelScan,serialScan,ddlPhone,txtmodelphone,serialPhone,ddlVDI,txtModelVDI,seriaVDI,UserOP,civilid,timepage,CountryId,edit,machineName,localIP,timeadd) VALUES " +
"(@NameFile,@ContentType,@backupmyfile,@Uname,@Ucivilid,@Ufileid,@ddlCountries,@ddlStates,@ddlCities,@ddlPC,@txtmodelPC,@serialPC,@ddlPrint,@txtmodelPrint,@serialPrint,@ddlscan,@txtmodelScan,@serialScan,@ddlPhone,@txtmodelphone,@serialPhone,@ddlVDI,@txtModelVDI,@seriaVDI,@UserOP,@civilid,@timepage,@CountryId,@edit,@machineName,@localIP,@timeadd)";
using (cmd = new SqlCommand(query))
{
cmd.Connection = con;
// upload files
cmd.Parameters.AddWithValue("@NameFile", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@backupmyfile", bytes);
// info users
cmd.Parameters.AddWithValue("@Uname", Uname.Text);
cmd.Parameters.AddWithValue("@Ucivilid", Ucivilid.Text);
cmd.Parameters.AddWithValue("@Ufileid", Ufileid.Text);
cmd.Parameters.AddWithValue("@ddlCountries", ddlCountries.SelectedItem.Text);
cmd.Parameters.AddWithValue("@ddlStates", ddlStates.SelectedItem.Text);
cmd.Parameters.AddWithValue("@ddlCities", ddlCities.SelectedItem.Text);
//========== order
cmd.Parameters.AddWithValue("@ddlPC", ddlPC.Text);
cmd.Parameters.AddWithValue("@txtmodelPC", txtmodelPC.Text);
cmd.Parameters.AddWithValue("@serialPC", serialPC.Text);
cmd.Parameters.AddWithValue("@ddlPrint", ddlPrint.Text);
cmd.Parameters.AddWithValue("@txtmodelPrint", txtmodelPrint.Text);
cmd.Parameters.AddWithValue("@serialPrint", serialPrint.Text);
cmd.Parameters.AddWithValue("@ddlscan", ddlscan.Text);
cmd.Parameters.AddWithValue("@txtmodelScan", txtmodelScan.Text);
cmd.Parameters.AddWithValue("@serialScan", serialScan.Text);
cmd.Parameters.AddWithValue("@ddlPhone", ddlPhone.Text);
cmd.Parameters.AddWithValue("@txtmodelphone", txtmodelphone.Text);
cmd.Parameters.AddWithValue("@serialPhone", serialPhone.Text);
cmd.Parameters.AddWithValue("@ddlVDI", ddlVDI.Text);
cmd.Parameters.AddWithValue("@txtModelVDI", txtModelVDI.Text);
cmd.Parameters.AddWithValue("@seriaVDI", seriaVDI.Text);
//============================= infoop
cmd.Parameters.AddWithValue("@UserOP", usernamemove);
cmd.Parameters.AddWithValue("@civilid", civilid.Text);
cmd.Parameters.AddWithValue("@timepage", SqlDbType.DateTime).Value = DateTime.Now;
cmd.Parameters.AddWithValue("@CountryId", "Cancelled");
cmd.Parameters.AddWithValue("@edit", "(إضافة عهدة شخصية)");
//===== info address
cmd.Parameters.AddWithValue("@machineName", UserHostName);
cmd.Parameters.AddWithValue("@localIP", UserHostip);
cmd.Parameters.AddWithValue("@timeadd", SqlDbType.DateTime).Value = DateTime.Now;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
}
}
}