public void llenaempleados() { try { String bd = Session["BD"].ToString(); var registroPROVEE = Controlasql.ctraeEmpleado(bd); if (registroPROVEE.Tables[0].Rows.Count > 0) { DataTable dt = registroPROVEE.Tables[0]; Select1.Items.Clear(); foreach (DataRow row in dt.Rows) { Select1.Items.Add(Convert.ToString(row["Proveedor"])); Select1.DataBind(); } } else { Select1.DataSource = null; Select1.DataBind(); } } catch (Exception) { } }
/// <summary> /// 新增和更新的重填 /// </summary> private void OverWrite() { if (EDITSTATUS) { txtUserid.Disabled = true; string strUserid = Request["sid"]; DataSet ds = subject.GetsubjectByUserid(strUserid); DataRow dr = ds.Tables[0].Rows[0]; txtUserid.Value = dr["sid"].ToString(); txtName.Value = dr["name"].ToString(); Select1.DataTextField = "sortname"; Select1.DataValueField = "sortid"; Select1.DataSource = Sort.GetSort(); Select1.DataBind(); Select1.Value = dr["sortid"].ToString(); //Select1.Value=t } else { Select1.DataTextField = "sortname"; Select1.DataValueField = "sortid"; Select1.DataSource = Sort.GetSort(); Select1.DataBind(); div1.Visible = false; txtUserid.Value = ""; txtName.Value = ""; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /*查询空间类型信息*/ string strsql = "select * from PType where parentId = 0"; SqlCommand mycmd = new SqlCommand(strsql, conn); conn.Open(); SqlDataReader mydr = mycmd.ExecuteReader(); Select1.DataSource = mydr; Select1.DataTextField = "category_name"; Select1.DataValueField = "category_ID"; Select1.DataBind(); mydr.Close(); conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); string query = "select id, display from Categories"; SqlDataAdapter sda = new SqlDataAdapter(query, conn); DataSet ds = new DataSet(); sda.Fill(ds, "Categories"); Select1.DataSource = ds; Select1.DataTextField = "display"; Select1.DataValueField = "Id"; Select1.DataBind(); } }
//protected void Page_PreRender(object sender, EventArgs e) //{ // if (!this.IsPostBack) // { // } //} protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.DataSource = arackayit.getPlaka(); DropDownList1.DataBind(); DropDownList2.DataSource = dbarac2.getMarkaListe(); DropDownList2.DataBind(); string findtext = DropDownList2.Items[0].ToString(); var query1 = db.aracmarkas.ToList() .Where(x => x.marka == findtext) .Select(x => x.markaID).Single(); int maid = query1; DropDownList3.DataSource = arackayit.getSpesificModel(maid); DropDownList3.DataBind(); //DropDownList3.DataSource = dbarac2.getModel(); //DropDownList3.DataBind(); Select1.DataSource = musterikayit.getMusteri(); Select1.DataBind(); //DropDownList4.DataSource = musterikayit.getMusteri(); //DropDownList4.DataBind(); int year = DateTime.Now.Year; for (int i = year - 30; i <= year + 1; i++) { ListItem li = new ListItem(i.ToString()); DropDownList5.Items.Add(li); } DropDownList5.Items.FindByText(year.ToString()).Selected = true; } }
protected void CreaMOdelo_Click(object sender, EventArgs e) { try { var registros = Controlasql.CcreaModelo(Textmodelo.Value.ToUpper(), Session["USUARIO"].ToString(), Session["BD"].ToString()); if (registros > 0) { Nuevomodelo.Visible = false; llenamodelos(); Select1.Focus(); } else { serialcantidad.Value = txtserial.Value.ToUpper(); alerta.Visible = true; } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection cn = new SqlConnection(@"Data Source=DESKTOP-GN1S5UA\SERVER;Initial Catalog=GestionCitas;Integrated Security=SSPI;")) { if (!this.IsPostBack) { { using (SqlCommand cmd = new SqlCommand("SELECT Id,Pais FROM Pais")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select4.DataSource = cmd.ExecuteReader(); Select4.DataTextField = "Pais"; Select4.DataValueField = "Id"; Select4.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Aficcion FROM Aficcion")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select1.DataSource = cmd.ExecuteReader(); Select1.DataTextField = "Aficcion"; Select1.DataValueField = "Id"; Select1.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Educacion FROM Educacion")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select5.DataSource = cmd.ExecuteReader(); Select5.DataTextField = "Educacion"; Select5.DataValueField = "Id"; Select5.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Contextura FROM Contextura")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); editprefixes.DataSource = cmd.ExecuteReader(); editprefixes.DataTextField = "Contextura"; editprefixes.DataValueField = "Id"; editprefixes.DataBind(); cn.Close(); } using (SqlCommand cmd = new SqlCommand("SELECT Id,Sexo FROM Sexo")) { cmd.CommandType = CommandType.Text; cmd.Connection = cn; cn.Open(); Select3.DataSource = cmd.ExecuteReader(); Select3.DataTextField = "Sexo"; Select3.DataValueField = "Id"; Select3.DataBind(); cn.Close(); } } } } }
protected void Page_Load(object sender, EventArgs e) { #region Recupero el user-name-login //ocultar primer item RadioButtonList2.Items[0].Attributes.Add("style", "display:none");; UserName_ey = Request.QueryString["UserName_ey"]; flgadmin = wS.RetornarRol(UserName_ey); Button5.Visible = false; if (flgadmin == 1) { Button5.Visible = true; } Label2.Text = "Hola: " + UserName_ey; TextBox9.Text = UserName_ey; usuario = UserName_ey; #endregion #region Crear Carpeta en cliente //string newFolder = "Digital Tax _ LE"; path_Libros = @"J:\COMMON\" + UserName_ey.Replace(".", "_"); path_Libros = path_Libros.Replace("@", "_"); //path_Libros = System.IO.Path.Combine( // Environment.GetFolderPath(Environment.SpecialFolder.Desktop),newFolder); if (!System.IO.Directory.Exists(path_Libros)) { try { System.IO.Directory.CreateDirectory(path_Libros); } catch (IOException ie) { Console.WriteLine("IO Error: " + ie.Message); } } #endregion // Titulo_registrar_valor.Visible = true; CrearTicketid.Visible = true; BuscarTicketid.Visible = false; Titulo_buscar_valor.Visible = false; Titulo_editarestado_valor.Visible = false; EditarEstadoid.Visible = false; //Subservice line if (!IsPostBack) { /* * SqlConnection conn = new SqlConnection(); * //conn.ConnectionString = "Data Source=10.20.244.25; Initial Catalog=Ticket_DgTAX; Integrated Security=True;"; * conn.ConnectionString = @"Data Source=10.20.103.68,49172;Initial Catalog=Ticket_DgTAX;Integrated Security=True;";//24/09/2019 cambio de Servidor, dado que el anterior esta reservado para ejecutar flujos de modeler * * //string ConnectString = "server=10.20.103.68,49172\\SQLEXPRESS;database=Ticket_DgTAX;integrated security=True"; * //string ConnectString = "Data Source=10.20.103.68,49172 ;Initial Catalog=Ticket_DgTAX; Integrated Security=True"; * //Select distinct Jobs.Subserviceline from usuarios,Jobs,usuarios_job where Jobs.Estado = 1 and usuarios.correo = usuarios_job.correo and usuarios_job.Number_engagement = Jobs.Number_engagement and usuarios.correo = '" + UserName_ey+"'"Select distinct Jobs.Subserviceline from usuarios,Jobs,usuarios_job where Jobs.Estado=1 and usuarios.correo=usuarios_job.correo and usuarios_job.Number_engagement=Jobs.Number_engagement and usuarios.correo='" + UserName_ey + "'"; * string QueryString = "Select top 1 Jobs.Subserviceline from Jobs where Jobs.Estado=1"; * //SqlConnection conn = new SqlConnection(ConnectString); * conn.Open(); * SqlDataAdapter myCommand = new SqlDataAdapter(QueryString, conn); * DataSet ds = new DataSet(); * //myCommand.Fill(ds); * * //Select1.DataSource = ds; * //Select1.DataTextField = "Subserviceline"; * * //Select1.DataValueField = "Subserviceline"; * //Select1.DataBind(); * //--- * SqlCommand command = new SqlCommand(QueryString, conn); * string Subserviceline = Convert.ToString(command.ExecuteScalar()); * * TextBox6.Text = Subserviceline; * * //Jobs dejado sin efecto * /* * QueryString = "Select distinct Jobs.Number_engagement, CONCAT(Jobs.Number_engagement,' - ',Jobs.Client_engagement) as Job_ from usuarios,Jobs,usuarios_job where Jobs.Estado=1 and usuarios.correo=usuarios_job.correo and usuarios_job.Number_engagement=Jobs.Number_engagement and usuarios.correo='" + UserName_ey + "'"; * myCommand = new SqlDataAdapter(QueryString, conn); * ds = new DataSet(); * myCommand.Fill(ds); * * Select2.DataSource = ds; * Select2.DataTextField = "Job_"; * Select2.DataValueField = "Number_engagement"; * Select2.DataBind(); */ //--- //Manager dejado sin efecto /* * QueryString = "Select distinct Jobs.Manager_name from usuarios,Jobs,usuarios_job where Jobs.Estado=1 and usuarios.correo=usuarios_job.correo and usuarios_job.Number_engagement=Jobs.Number_engagement and usuarios.correo='" + UserName_ey + "'"; * myCommand = new SqlDataAdapter(QueryString, conn); * ds = new DataSet(); * myCommand.Fill(ds); * * //Select3.DataSource = ds; * //Select3.DataTextField = "Manager_name"; * //Select3.DataValueField = "Manager_name"; * //Select3.DataBind(); * * //--- * command = new SqlCommand(QueryString, conn); * string Manager_name = Convert.ToString(command.ExecuteScalar()); * * TextBox8.Text = Manager_name; */ TextBox6.Text = "BTC"; ServiceReference1.WSSoapClient wS = new ServiceReference1.WSSoapClient(); DataSet ds = wS.LLenarListaGerente(); //Seleccion de Gerente //QueryString = "Select distinct Manager_name from Jobs where Jobs.Estado=1 "; //myCommand = new SqlDataAdapter(QueryString, conn); //ds = new DataSet(); //myCommand.Fill(ds); Select1.DataSource = ds; Select1.DataTextField = "Manager_name"; Select1.DataValueField = "Manager_name"; Select1.DataBind(); //Senior //conn.Close(); } }
protected void Button3_Click(object sender, EventArgs e) { string tc = TextBox9.Text; string isim = TextBox10.Text; //List<string> ifmusteriexists = db.musteris.ToList() // .Where(x => x.tckn == tc) // .Select(x => x.tckn).ToList(); //if (ifmusteriexists.Count == 0) //{ //} //else //{ // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('Bu TC Kimlik NO'ya sahip müşteri mevcut', 'HATA');", true); //} if (tc == "" || isim == "") { //ShowMessageBox(Page, "TCKN veya isim girmeyi unuttunuz, lütfen tekrar deneyin"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('TCKN veya isim girmeyi unuttunuz, lütfen tekrar deneyin', 'HATALI GİRİŞ');", true); } else if (tc.Length != 11) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('TCKN hatalı girildi', 'HATALI GİRİŞ');", true); } else { int cevap = musterikayit.ekleMusteri(tc, isim); if (cevap == 1) { //ShowMessageBox(Page, "Kayıt Başarıyla Eklendi"); //Label2.Text = "Kayıt Başarıyla Eklendi"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentSuccess('Kayıt Başarıyla Eklendi', 'İşlem Başarılı');", true); TextBox9.Text = ""; TextBox10.Text = ""; } else if (cevap == 2) { //ShowMessageBox(Page, "Girilen TC No'ya ait kayıt zaten mevcut, lütfen listeden seçip tekrar deneyin"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('Girilen TC Noya ait kayıt zaten mevcut, lütfen listeden seçip tekrar deneyin', '');", true); } else { //ShowMessageBox(Page, "Kayıt eklenirken bir hata oluştu"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentError('Kayıt eklenirken beklenmeyen bir sorun oluştu', 'HATA');", true); } //DropDownList4.DataSource = musterikayit.getMusteri(); //DropDownList4.DataBind(); Select1.DataSource = musterikayit.getMusteri(); Select1.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e) { /*TextBox2.Text = DropDownList2.SelectedValue; * TextBox3.Text = DropDownList3.SelectedValue; * TextBox4.Text = DropDownList4.SelectedValue; * TextBox5.Text = DropDownList5.SelectedValue;*/ try { string maid1 = TextBox2.Text; string moid1 = TextBox3.Text; string musid1 = TextBox4.Text; string sene = TextBox5.Text; string plaka = TextBox1.Text; string ruhsatno = TextBox6.Text; string saseno = TextBox7.Text; string motorno = TextBox8.Text; if (maid1 == "" || moid1 == "" || musid1 == "" || sene == "") { //ShowMessageBox(Page, "Marka, model, müşteri ya da yıl seçimini unuttunuz, lütfen tekrar deneyin"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('Marka, model, müşteri ya da yıl seçimini unuttunuz', 'HATALI GİRİŞ');", true); //TextBox1.Text = ""; //TextBox2.Text = ""; //TextBox3.Text = ""; //TextBox4.Text = ""; //TextBox5.Text = ""; //TextBox6.Text = ""; //TextBox7.Text = ""; //TextBox8.Text = ""; } else if (plaka == "" || ruhsatno == "" || saseno == "" || motorno == "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('Plaka, Ruhsat No, Şase No ya da Motor No girmeyi unuttunuz', 'HATALI GİRİŞ');", true); //TextBox1.Text = ""; //TextBox2.Text = ""; //TextBox3.Text = ""; //TextBox4.Text = ""; //TextBox5.Text = ""; //TextBox6.Text = ""; //TextBox7.Text = ""; //TextBox8.Text = ""; } else { var query1 = db.aracmarkas.ToList() .Where(x => x.marka == maid1) .Select(x => x.markaID).Single(); var query2 = db.aracmodels.ToList() .Where(x => x.model == moid1) .Select(x => x.modelID).Single(); var query3 = db.musteris.ToList() .Where(x => x.adSoyad == musid1) .Select(x => x.musteriID).Single(); string pl = TextBox1.Text; int maid = query1; int moid = query2; int musid = query3; int yil = Convert.ToInt32(TextBox5.Text); string ruhsat = TextBox6.Text; string sase = TextBox7.Text; string motor = TextBox8.Text; int cevap = arackayit.ekleArac(pl, maid, moid, musid, yil, ruhsat, sase, motor); if (cevap == 1) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentSuccess('Kayıt Başarıyla Eklendi', 'İşlem Başarılı');", true); //ShowMessageBox(Page, "Kayıt Başarıyla Eklendi"); //Label1.Text = "Kayıt Başarıyla Eklendi"; //TextBox1.Text = ""; //TextBox2.Text = ""; //TextBox3.Text = ""; //TextBox4.Text = ""; //TextBox5.Text = ""; //TextBox6.Text = ""; //TextBox7.Text = ""; //TextBox8.Text = ""; //servisislem.ekleServisKayit() } else if (cevap == 2) { //ShowMessageBox(Page, "Girilen plakaya ait kayıt zaten mevcut, lütfen listeden seçip tekrar deneyin"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentWarning('Girilen plakaya ait kayıt zaten mevcut, lütfen listeden seçip tekrar deneyin', 'HATALI GİRİŞ');", true); } else { //ShowMessageBox(Page, "Kayıt eklenirken bir hata oluştu"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "CallMyFunction", "showContentError('Kayıt eklenirken beklenmeyen bir hata oluştu', 'HATA');", true); } DropDownList1.DataBind(); DropDownList2.DataBind(); DropDownList3.DataBind(); //DropDownList4.DataBind(); Select1.DataBind(); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Hata')", true); } }