//fungsi: Handle Ketika akan insert database protected void dsLaporanPengesahan_Inserting(object sender, SqlDataSourceCommandEventArgs e) { try { if (gvLaporanPengesahan.Rows.Count > 0) { DropDownList ddlCol0Footer = (DropDownList)gvLaporanPengesahan.FooterRow.Cells[0].FindControl("ddlCol0Footer"); DropDownList ddlCol1Footer = (DropDownList)gvLaporanPengesahan.FooterRow.Cells[1].FindControl("ddlCol1Footer"); TextBox txtCol2Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[2].FindControl("txtCol2Footer"); TextBox txtCol3Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[3].FindControl("txtCol3Footer"); TextBox txtCol4Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[4].FindControl("txtCol4Footer"); TextBox txtCol5Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[5].FindControl("txtCol5Footer"); TextBox txtCol6Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[6].FindControl("txtCol6Footer"); TextBox txtCol7Footer = (TextBox)gvLaporanPengesahan.FooterRow.Cells[7].FindControl("txtCol7Footer"); e.Command.Parameters["@KODE_LAPORAN"].Value = ddlCol0Footer.SelectedValue; e.Command.Parameters["@KODE_CABANG"].Value = ddlCol1Footer.SelectedValue; e.Command.Parameters["@TTD1_HEADER"].Value = txtCol2Footer.Text; e.Command.Parameters["@TTD1"].Value = txtCol3Footer.Text; e.Command.Parameters["@TTD2_HEADER"].Value = txtCol4Footer.Text; e.Command.Parameters["@TTD2"].Value = txtCol5Footer.Text; e.Command.Parameters["@TTD3_HEADER"].Value = txtCol6Footer.Text; e.Command.Parameters["@TTD3"].Value = txtCol7Footer.Text; } } catch (Exception ex) { ExceptionDetails.Text = ex.Message; } }
protected void SdsIcerik_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; } }
protected void dsEmployeeDetails_Updating(object sender, SqlDataSourceCommandEventArgs e) { //find the upload contrul FileUpload fuEmp = (FileUpload)dvEmployees.FindControl("fuEmp"); if (fuEmp.HasFile) { //get the filename string fileName = fuEmp.FileName; //get the extension string ext = fileName.Substring(fileName.LastIndexOf(".")); //generate a new file name string newImageName = Guid.NewGuid().ToString(); //plug the extension back in newImageName += ext; //save the photo to the images folder fuEmp.SaveAs(Server.MapPath("~/screenImages/" + newImageName)); //save the photo name to the DB e.Command.Parameters["@EmpPhotoUrl"].Value = newImageName; } else { TSTEntities ctx = new TSTEntities(); string currentImage = (from x in ctx.C3TEmployees where x.EmployeeId == (int)gvEmployees.SelectedValue select x.EmpPhotoUrl).Single(); } }
protected void sqlDSUserDupes_Selecting(object sender, SqlDataSourceCommandEventArgs e) { if (e != null) { e.Command.CommandTimeout = 600; // give up to 10 minutes - this can be slow. } }
protected void dsSelectedEmployee_Updating(object sender, SqlDataSourceCommandEventArgs e) { //to update existing employee image: //locate the control and assign it to a new variable FileUpload eeImageUpload = (FileUpload)dvSelectedEmployee.FindControl("FileUpload1"); //...then see if there is anything there if (eeImageUpload.HasFile) { //if there is, get the name of the file then grab the extension string img = eeImageUpload.FileName; string ext = img.Substring(img.LastIndexOf(".")); //create a new, unique filename with a guid and add ack the ext string imgNewname = Guid.NewGuid().ToString(); imgNewname += ext; //save the file to the webserver and the url path to the database eeImageUpload.SaveAs(Server.MapPath("~/EmployeeImages/" + imgNewname)); e.Command.Parameters["@EmployeeImage"].Value = imgNewname; } //if there wasn't anything there, we'll use the current image else { TSTEntities ctx = new TSTEntities(); string img = (from i in ctx.TSTEmployees where i.EmployeeID == (int)gvEmployees.SelectedValue select i.EmployeeImage).Single(); e.Command.Parameters["@EmployeeImage"].Value = img; } }
protected void dsSelectedEmployee_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //to add employee image: locate the control and assign it to a new variable FileUpload eeImageUpload = (FileUpload)dvSelectedEmployee.FindControl("FileUpload1"); //...then see if there is anything there if (eeImageUpload.HasFile) { //if there is, get the name of the file then grab the extension string img = eeImageUpload.FileName; string ext = img.Substring(img.LastIndexOf(".")); //create a new, unique filename with a guid and add ack the ext string imgNewname = Guid.NewGuid().ToString(); imgNewname += ext; //save the file to the webserver and the url path to the database eeImageUpload.SaveAs(Server.MapPath("~/EmployeeImages/" + imgNewname)); e.Command.Parameters["@EmployeeImage"].Value = imgNewname; } //if there wasn't anything there, we'll use the default else { e.Command.Parameters["@EmployeeImage"].Value = "~/EmployeeImages/NoImage.jpg"; } }
protected void StudentsDS_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@Id"].Value = Guid.Parse(Membership.GetUser(st_UsernameTB.Text).ProviderUserKey.ToString()); e.Command.Parameters["@FirstName"].Value = st_FirstNameTB.Text; e.Command.Parameters["@LastName"].Value = st_LastNameTB.Text; e.Command.Parameters["@GroupId"].Value = Guid.Parse(st_GroupDDL.SelectedValue); }
protected void Sdsicerikler_Deleting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Delete")) { e.Cancel = true; } }
protected void SqlDataSourceEgenEvent_Deleting(object sender, SqlDataSourceCommandEventArgs e) { // Hent Id på valgt avatar fra gridviewet og slet filer int Id = (int)GridViewEgneEvents.SelectedValue; SletFiler(Id); }
//---------------------------------------Slet bruger #region Slet bruger protected void SqlDataSourceBrugerDetaljer_Deleting(object sender, SqlDataSourceCommandEventArgs e) { // Hent Id på valgt avatar fra gridviewet og slet filer int Id = (int)GridViewBrugere.SelectedValue; SletFiler(Id); }
protected void SdsUrun_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } if (e.Command.Parameters["@Detay"].Value != null && e.Command.Parameters["@Detay"].Value.ToString().Length > Snlg_ConfigValues.maxCharacterLimit) { e.Cancel = true; Snlg_Hata.ziyaretci.HataGosterHatali("Ürün Detayı 100.000 karakterden daha uzun olamaz. Girmiş olduğunuz içeriğin uzunluğu : " + e.Command.Parameters["@Detay"].Value.ToString().Length.ToString() + " karakterdir.", false); return; } //seçilen kategorilerr için sql hazrılanıyor string ktgSql = ""; ListBox lb = (ListBox)FVDetay.FindControl("ListKtg"); foreach (ListItem item in lb.Items) if (item.Selected) ktgSql += string.Format("INSERT INTO snlg_V1.TblUrun_Kategori (UrunId, KtgId) VALUES (@UrunId, {0}); ", item.Value); e.Command.Parameters["@KtgSql"].Value = ktgSql; }
protected void SqlDataSource7_Deleting(object sender, SqlDataSourceCommandEventArgs e) { if (this.gridCRs.FocusedRowIndex != -1) { object ID = this.gridCRs.GetRowValues(this.gridCRs.FocusedRowIndex, "id"); int id = Convert.ToInt32(ID); SqlConnection conn; SqlCommand comm; string _query; try { _query = @"delete from tblCrUser where idCr=@idCr"; using (conn = new SqlConnection(strcon)) { using (comm = new SqlCommand()) { comm.Connection = conn; comm.CommandText = _query; comm.Parameters.AddWithValue("@idCr", id); conn.Open(); comm.ExecuteNonQuery(); } } } catch (Exception ex) { } } }
protected void SqlDataSource_Updating(object sender, SqlDataSourceCommandEventArgs e) { foreach (GridViewRow row in NoteGrid.Rows) { Response.Write(sender.ToString()); } }
protected void sourceEmployees_Updating(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@First"].Value = e.Command.Parameters["@FirstName"].Value; e.Command.Parameters["@Last"].Value = e.Command.Parameters["@LastName"].Value; e.Command.Parameters.Remove(e.Command.Parameters["@FirstName"]); e.Command.Parameters.Remove(e.Command.Parameters["@LastName"]); }
protected void SDSMak_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } if (e.Command.Parameters["@Icerik"].Value != null && e.Command.Parameters["@Icerik"].Value.ToString().Length > Snlg_ConfigValues.maxCharacterLimit) { e.Cancel = true; Snlg_Hata.ziyaretci.HataGosterHatali("Makale içeriği " + Snlg_ConfigValues.maxCharacterLimit + " karakterden daha uzun olamaz. Girmiş olduğunuz içeriğin uzunluğu : " + e.Command.Parameters["@Icerik"].Value.ToString().Length.ToString() + " karakterdir.", false); return; } //seçilen kategorilerr için sql hazrılanıyor string ktgSql = ""; ListBox lb = (ListBox)FVIcerik.FindControl("ListKtg"); foreach (ListItem item in lb.Items) { if (item.Selected) { ktgSql += string.Format("INSERT INTO snlg_V1.TblMakale_Kategori (MakId, KtgId) VALUES (@MakId, {0}); ", item.Value); } } e.Command.Parameters["@KtgSql"].Value = ktgSql; }
public void OnInserting(Object source, SqlDataSourceCommandEventArgs eventArgs) { FileUpload fileUpload = (FileUpload) BulletinDataGrid.FindControl("bulletinPdf"); DateTime pubDate = (DateTime) eventArgs.Command.Parameters["@pubDate"].Value; if (fileUpload != null && pubDate != null && fileUpload.PostedFile != null && fileUpload.PostedFile.ContentLength > 0) { String filename = System.IO.Path.GetFileName(fileUpload.PostedFile.FileName); filename = pubDate.ToString("yyyy-MM-dd") + ".pdf"; String saveLocation = Server.MapPath("~\\bulletins") + "\\" + filename; try { fileUpload.PostedFile.SaveAs(saveLocation); status.InnerHtml = "Uploaded Succesfully"; status.Style.Add(HtmlTextWriterStyle.Color, "Red"); } catch (Exception exception) { status.InnerHtml = "Error: " + exception; status.Style.Add(HtmlTextWriterStyle.Color, "Red"); } } else { status.InnerHtml = "Please select a file to upload."; status.Style.Add(HtmlTextWriterStyle.Color, "Red"); } }
protected void AccessDataSource1_Deleting(object sender, SqlDataSourceCommandEventArgs e) { // Delete the image files // Get the image file name string picture1FileName; using (OleDbConnection connection = ExamplesHelper.GetNewOpenDbConnection()) { using (OleDbCommand command = connection.CreateCommand()) { command.CommandText = "SELECT [Picture1_FileName_thumbnail] FROM [Ex_A_507] WHERE [ID]=@Id"; command.Parameters.AddWithValue("@Id", e.Command.Parameters["Id"].Value); picture1FileName = Convert.ToString(command.ExecuteScalar()); } } if (!string.IsNullOrEmpty(picture1FileName)) { // Delete the main image string picture1FilePath_main = System.IO.Path.Combine(Server.MapPath("~/repository/store/ex_A_507/picture1/main/"), picture1FileName); if (System.IO.File.Exists(picture1FilePath_main)) { System.IO.File.Delete(picture1FilePath_main); } // Delete the thumbnail string picture1FilePath_thumbnail = System.IO.Path.Combine(Server.MapPath("~/repository/store/ex_A_507/picture1/thumbnail/"), picture1FileName); if (System.IO.File.Exists(picture1FilePath_thumbnail)) { System.IO.File.Delete(picture1FilePath_thumbnail); } } }
protected void DSData_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (Session["attach"] != null) { e.Command.Parameters["link"].Value = Session["attach"].ToString(); } }
protected void ds_ProductSeries_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //byte[] imageData = Session["SeriesImage"] as byte[]; //System.Data.SqlClient.SqlParameter uploadData = new System.Data.SqlClient.SqlParameter("@SeriesImage", System.Data.SqlDbType.Image); //uploadData.Value = imageData; //e.Command.Parameters.Add(uploadData); }
protected void SdsIcerik_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; return; } try { if (e.Command.Parameters["@Icerik"].Value != null && e.Command.Parameters["@Icerik"].Value.ToString().Length > Snlg_ConfigValues.maxCharacterLimit) { e.Cancel = true; Snlg_Hata.ziyaretci.HataGosterHatali("Bilgiler kaydedilmedi! İçerik 100.000 karakterden daha uzun olamaz. Girmiş olduğunuz içeriğin uzunluğu : " + e.Command.Parameters["@Icerik"].Value.ToString().Length.ToString() + " karakter.", false); return; } DropDownList DDLCont = (DropDownList)FVIcerik.FindControl("DDLCont"); ListBox list1 = (ListBox)FVIcerik.FindControl("List1"); string sorgu = ""; if (!string.IsNullOrEmpty(DDLCont.SelectedValue)) { foreach (ListItem li in list1.Items) { if (li.Selected && !string.IsNullOrEmpty(li.Value)) { sorgu += "INSERT INTO snlg_V1.TblDesignSablonIcerik (SablonId,ContainerId,UCId,Sira)"; sorgu += string.Format("VALUES ({0}, @ContainerId, @UCId, @Sira); ", li.Value); } } e.Command.Parameters["@GosterilecekSablonlarSql"].Value = sorgu; } } catch { } }
protected void AccessDataSource1_Deleting(object sender, SqlDataSourceCommandEventArgs e) { // Delete the image files // Get the image file name string picture1FileName; using (OleDbConnection connection = ExamplesHelper.GetNewOpenDbConnection()) { using (OleDbCommand command = connection.CreateCommand()) { command.CommandText = "SELECT [Picture1_FileName_thumbnail] FROM [Ex_A_507] WHERE [ID]=@Id"; command.Parameters.AddWithValue("@Id", e.Command.Parameters["Id"].Value); picture1FileName = Convert.ToString(command.ExecuteScalar()); } } if (!string.IsNullOrEmpty(picture1FileName)) { // Delete the main image string picture1FilePath_main = System.IO.Path.Combine(Server.MapPath("~/repository/store/ex_A_507/picture1/main/"), picture1FileName); if (System.IO.File.Exists(picture1FilePath_main)) { System.IO.File.Delete(picture1FilePath_main); } // Delete the thumbnail string picture1FilePath_thumbnail = System.IO.Path.Combine(Server.MapPath("~/repository/store/ex_A_507/picture1/thumbnail/"), picture1FileName); if (System.IO.File.Exists(picture1FilePath_thumbnail)) { System.IO.File.Delete(picture1FilePath_thumbnail); } } }
protected void materialDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@name"].Value = (materialTable.FooterRow.FindControl("nameBox") as TextBox).Text; e.Command.Parameters["@price"].Value = Int16.Parse((materialTable.FooterRow.FindControl("priceTextBox") as TextBox).Text); e.Command.Parameters["@amount"].Value = Int16.Parse((materialTable.FooterRow.FindControl("amountTextBox") as TextBox).Text); e.Command.Parameters["@startTime"].Value = DateTime.Parse((materialTable.FooterRow.FindControl("sinceTimeBox") as TextBox).Text); }
protected void dsVariable_Updating(object sender, SqlDataSourceCommandEventArgs e) { try { TextBox TutupPeriode = (TextBox)FvVariable.FindControl("txtCol1Item1"); TextBox DefLimitAwal = (TextBox)FvVariable.FindControl("txtCol1Item2"); TextBox DefLimitAkhir = (TextBox)FvVariable.FindControl("txtCol1Item3"); TextBox BatasMasukUlang = (TextBox)FvVariable.FindControl("txtCol1Item4"); if (TutupPeriode.Text.Trim() != "") { e.Command.Parameters["@TUTUP_PERIODE"].Value = DateTime.Parse(TutupPeriode.Text); } if (DefLimitAwal.Text.Trim() != "") { e.Command.Parameters["@DEF_LIMIT_AWAL"].Value = DateTime.Parse("1/1/1900 " + DefLimitAwal.Text + ":00"); } if (DefLimitAkhir.Text.Trim() != "") { e.Command.Parameters["@DEF_LIMIT_AKHIR"].Value = DateTime.Parse("1/1/1900 " + DefLimitAkhir.Text + ":00"); } if (BatasMasukUlang.Text.Trim() != "") { e.Command.Parameters["@BATAS_MASUK_ULANG"].Value = DateTime.Parse("1/1/1900 " + BatasMasukUlang.Text + ":00"); } } catch (Exception ex) { ExceptionDetails.Text = lblConfigNotUpdated.Text + " (" + ex.Message + ")"; e.Cancel = true; } }
protected void GroupsDS_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@Id"].Value = Guid.NewGuid(); e.Command.Parameters["@TypeId"].Value = Guid.Parse(gp_GroupTypesDDL.SelectedValue); e.Command.Parameters["@Name"].Value = gp_GroupNameTB.Text; e.Command.Parameters["@Description"].Value = gp_GroupDescriptionTB.Text; }
protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) { try { int id = Convert.ToInt32(e.Command.Parameters["@NewProductID"].Value); // int id = (int)e.Command.Parameters["@idD"].Value; insertToDeviceIO("RFID", id); insertToDeviceIO("InternalTemp", id); insertToDeviceIO("SDCard", id); insertToDeviceIO("A1", id); insertToDeviceIO("A2", id); insertToDeviceIO("A3", id); insertToDeviceIO("A4", id); insertToDeviceIO("D1", id); insertToDeviceIO("D2", id); insertToDeviceIO("D3", id); insertToDeviceIO("D4", id); insertToDeviceIO("D5", id); insertToDeviceIO("D6", id); insertToDeviceIO("D7", id); insertToDeviceIO("D8", id); insertToDeviceIO("D9", id); insertToDeviceIO("D10", id); insertToDeviceIO("D11", id); insertToDeviceIO("D12", id); insertToDeviceIO("D13", id); insertToDeviceIO("D14", id); insertToDeviceIO("D15", id); insertToDeviceIO("D16", id); insertToDeviceIO("D17", id); insertToDeviceIO("D18", id); insertToDeviceIO("D19", id); insertToDeviceIO("D20", id); insertToDeviceIO("D21", id); insertToDeviceIO("D22", id); insertToDeviceIO("D23", id); insertToDeviceIO("D24", id); insertTotblOutput("1", id, "1o", "1f"); insertTotblOutput("2", id, "2o", "2f"); insertTotblOutput("3", id, "3o", "3f"); insertTotblOutput("4", id, "4o", "4f"); insertTotbltblAnalogMinMax(id, "A1", -1, 100); insertTotbltblAnalogMinMax(id, "A2", -1, 100); insertTotbltblAnalogMinMax(id, "A3", -1, 100); insertTotbltblAnalogMinMax(id, "A4", -1, 100); insertTotbltblAnalogMinMax(id, "InternalTemp", -1, 100); insertTotblLastData(id); } catch (SqlException ex) { } }
protected void SqlDataSourceFormViewEgenBrugerDetaljer_Deleting(object sender, SqlDataSourceCommandEventArgs e) { // Hent Id på valgt avatar fra gridviewet og slet filer int Id = (int)Session["Id"]; SletFiler(Id); }
protected void SdsIcerik_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; return; } try { if (e.Command.Parameters["@Icerik"].Value != null && e.Command.Parameters["@Icerik"].Value.ToString().Length > Snlg_ConfigValues.maxCharacterLimit) { e.Cancel = true; Snlg_Hata.ziyaretci.HataGosterHatali("Bilgiler kaydedilmedi! İçerik 100.000 karakterden daha uzun olamaz. Girmiş olduğunuz içeriğin uzunluğu : " + e.Command.Parameters["@Icerik"].Value.ToString().Length.ToString() + " karakter.", false); return; } DropDownList DDLCont = (DropDownList)FVIcerik.FindControl("DDLCont"); ListBox list1 = (ListBox)FVIcerik.FindControl("List1"); string sorgu = ""; if (!string.IsNullOrEmpty(DDLCont.SelectedValue)) { foreach (ListItem li in list1.Items) { if (li.Selected && !string.IsNullOrEmpty(li.Value)) { sorgu += "INSERT INTO snlg_V1.TblDesignSablonIcerik (SablonId,ContainerId,UCId,Sira)"; sorgu += string.Format("VALUES ({0}, @ContainerId, @UCId, @Sira); ", li.Value); } } e.Command.Parameters["@GosterilecekSablonlarSql"].Value = sorgu; } } catch { } }
protected void StudentReadingAnswerSqlDataSource_Updating(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@StudentExamId"].Value = StudentExamId; e.Command.Parameters["@QuestionId"].Value = QuestionId; e.Command.Parameters["@QuestionOrder"].Value = QuestionOrder; e.Command.Parameters["@StudentAnswer"].Value = StudentAnswer; }
protected void dsCurrencies_Deleting(object sender, SqlDataSourceCommandEventArgs e) { if (e.Command.Parameters["@Deletable"] != null) { e.Command.Parameters.RemoveAt("@Deletable"); } }
protected void dsEmployeeDetails_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //find the upload control FileUpload fuEmp = (FileUpload)dvEmployees.FindControl("fuEmp"); //make sure there is a file if (fuEmp.HasFile) { //get the filename string fileName = fuEmp.FileName; //get the extension string ext = fileName.Substring(fileName.LastIndexOf(".")); //generate a new file name string newImageName = Guid.NewGuid().ToString(); //plug the extension back in newImageName += ext; //save the photo to the images folder fuEmp.SaveAs(Server.MapPath("~/screenImages/" + newImageName)); //save the photo name to the DB e.Command.Parameters["@EmpPhotoUrl"].Value = newImageName; } else { e.Command.Parameters["@EmpPhotoUrl"].Value = "no_image.jpg"; //no file uploaded } }
protected void setTimeout(object sender, SqlDataSourceCommandEventArgs e) { if (e != null) { e.Command.CommandTimeout = 90; } }
protected void dsCategories_Deleting(object sender, SqlDataSourceCommandEventArgs e) { if (e.Command.Parameters["@CategoryCount"] != null) { e.Command.Parameters.RemoveAt("@CategoryCount"); } }
protected void dsLocations_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (e.Command.Parameters["@LocationCount"] != null) { e.Command.Parameters.RemoveAt("@LocationCount"); } }
protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) { FileUpload FileUploadSlika = (FileUpload)this.DetailsViewDodajSlike.FindControl("FileUploadSlika"); if (FileUploadSlika.HasFile) { FileUploadSlika.SaveAs(MapPath("~/uploads/images/" + FileUploadSlika.FileName)); System.Drawing.Image img1 = System.Drawing.Image.FromFile(MapPath("~/uploads/images/") + FileUploadSlika.FileName); System.Drawing.Image bmp1 = img1.GetThumbnailImage(160, 210, null, IntPtr.Zero); bmp1.Save(MapPath("~/uploads/images/") + "thumb_" + FileUploadSlika.FileName); } TextBox TextBoxNaziv = (TextBox)this.DetailsViewDodajSlike.FindControl("TextBoxNaziv"); e.Command.Parameters["@Naziv"].Value = TextBoxNaziv.Text; e.Command.Parameters["@MalaUrl"].Value = "/uploads/images/" + "thumb_" + FileUploadSlika.FileName; e.Command.Parameters["@VelikaUrl"].Value = "/uploads/images/" + FileUploadSlika.FileName; CheckBox CheckBoxGlavna = (CheckBox)this.DetailsViewDodajSlike.FindControl("CheckBoxGlavna"); e.Command.Parameters["@Glavna"].Value = CheckBoxGlavna.Checked; //HiddenField HiddenFieldIdProizvoda = (HiddenField)this.DetailsViewDodajSlike.FindControl("HiddenFieldIdProizvoda"); //e.Command.Parameters["@IdProizvoda"].Value = HiddenFieldIdProizvoda.Value; }
protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) { TextBox TextBoxNaziv = (TextBox)this.DetailsViewProizvodi.FindControl("TextBoxNaziv"); e.Command.Parameters["@Naziv"].Value = TextBoxNaziv.Text; DropDownList DropDownListKategorija = (DropDownList)this.DetailsViewProizvodi.FindControl("DropDownListKategorija"); e.Command.Parameters["@IdKategorija"].Value = Int32.Parse(DropDownListKategorija.SelectedValue); DropDownList DropDownListBrend = (DropDownList)this.DetailsViewProizvodi.FindControl("DropDownListBrend"); e.Command.Parameters["@IdBrend"].Value = Int32.Parse(DropDownListBrend.SelectedValue); TextBox TextBoxOpis = (TextBox)this.DetailsViewProizvodi.FindControl("TextBoxOpis"); e.Command.Parameters["@Opis"].Value = TextBoxOpis.Text; TextBox TextBoxCena = (TextBox)this.DetailsViewProizvodi.FindControl("TextBoxCena"); e.Command.Parameters["@Cena"].Value = Int32.Parse(TextBoxCena.Text); DateTime DatumDodavanja = DateTime.Now; DateTime DatumIzmene = DatumDodavanja; e.Command.Parameters["@DatumDodavanja"].Value = DatumDodavanja; e.Command.Parameters["@DatumIzmene"].Value = DatumIzmene; }
protected void DSData_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (Convert.ToBoolean(e.Command.Parameters["tsfeat"].Value) == false && Convert.ToBoolean(e.Command.Parameters["winner"].Value) == true) { GVEditor.JSProperties["cpShowPopup"] = "لا يمكن تحديد الفائز بدون تصفيات"; e.Cancel = true; } }
protected void sourceEmployees_Updating(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@First"].Value = e.Command.Parameters["@FirstName"].Value; e.Command.Parameters["@Last"].Value = e.Command.Parameters["@LastName"].Value; e.Command.Parameters.Remove(e.Command.Parameters["@FirstName"]); e.Command.Parameters.Remove(e.Command.Parameters["@LastName"]); }
protected void SDSSyflar_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; return; } }
protected void SDSResim_Deleting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Delete")) { e.Cancel = true; return; } }
protected void OnClubMemberDataSourceModifying(object sender, SqlDataSourceCommandEventArgs e) { if(DemoSettings.IsSiteMode) { rpReadOnlyError.Controls.Add(new LiteralControl(DemoSettings.ReadOnlyErrorMessage)); rpReadOnlyError.Visible = true; e.Cancel = true; } }
protected void SDSYorum_Updating(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["@CevapYazan"].Value = Snlg_MemberInfo.s_UserName; if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } }
protected void SDSUye_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; return; } e.Command.Parameters["@Sifre"].Value = Snlg_ConfigValues.MD5Olustur(e.Command.Parameters["@Sifre"].Value.ToString()); }
protected void SDSUye_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } if (!string.IsNullOrEmpty(((TextBox)FVUye.FindControl("TSifre")).Text)) e.Command.Parameters["@Sifre"].Value = Snlg_ConfigValues.MD5Olustur(((TextBox)FVUye.FindControl("TSifre")).Text); }
protected void DSData_Inserting(object sender, SqlDataSourceCommandEventArgs e) { string NewID = string.Empty; OleDbDataAdapter da = new OleDbDataAdapter(@"Select Max(servisetypeid) From servisetype", ConnectionStr("faservice.mdb")); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 0) NewID = "1"; else NewID = (Convert.ToInt16(dt.Rows[0][0].ToString()) + 1).ToString(); e.Command.Parameters["servisetypeid"].Value = NewID; }
protected void SDSPrj_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) e.Cancel = true; //seçilen kategorilerr için sql hazrılanıyor string ktgSql = ""; ListBox lb = (ListBox)FVIcerik.FindControl("ListKtg"); foreach (ListItem item in lb.Items) if (item.Selected) ktgSql += string.Format("INSERT INTO snlg_V1.TblProje_Kategori (ProjeId, KtgId) VALUES (@ProjeId, {0}); ", item.Value); e.Command.Parameters["@KtgSql"].Value = ktgSql; }
protected void SDSDyr_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } if (e.Command.Parameters["@Duyuru"].Value != null && e.Command.Parameters["@Duyuru"].Value.ToString().Length > Snlg_ConfigValues.maxCharacterLimit) { e.Cancel = true; Snlg_Hata.ziyaretci.HataGosterHatali("Duyuru içeriği 100.000 karakterden daha uzun olamaz. Girmiş olduğunuz içeriğin uzunluğu : " + e.Command.Parameters["@Duyuru"].Value.ToString().Length.ToString() + " karakterdir.", false); return; } }
protected void SdsUrlkeysGroup_Inserting(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Insert")) { e.Cancel = true; } }
protected void DSData_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["UserID"].Value = MCTEFollowUp.GetNewID("FollowupUsers", "UserID"); }
protected void DSData_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //Get new ID to insert at //e.Command.Parameters["TraineeID"].Value = DB.GetNewID(DB.DBTablesNames.TBLTrainee); }
protected void dsSelectedCompany_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //right before this really does get inserted, we need to make sure the //appropriate pictureURL value is included. //check to see if the image is in session and if it is use it for pictureURL if (Session["newImage"] != null) { //use uploaded image name string imageName = Session["newImage"].ToString(); //add the value to the insert command (available thru event args) e.Command.Parameters["@CompanyLogo"].Value = imageName; //remove the image from session variable Session["newImage"] = null;//removing the newImage from Session } else { //use our noImage image e.Command.Parameters["@CompanyLogo"].Value = "NoPhoto.jpg"; } }
protected void DSData_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["picpath"].Value = Session["attach"].ToString(); }
protected void sdsEliminarAjuste_Updating(object sender, SqlDataSourceCommandEventArgs e) { //utiles.debugClass.muestra(e.Command,Server.MapPath("log.txt")); }
protected void sdsDocumentosDeSolicitud_Updating(object sender, SqlDataSourceCommandEventArgs e) { utiles.debugClass.muestra(e.Command, Server.MapPath("documentos.txt")); }
protected void DSData_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //e.Command.Parameters["dataid"].Value = MCcontact.GetNewID("alldata", "dataid"); }
protected void customerSqlDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //SqlParameter insertedKey = new SqlParameter("@PK_New", SqlDbType.Int); //insertedKey.Direction = ParameterDirection.Output; //e.Command.Parameters.Add(new SqlParameter("@PK_New", SqlDbType.Int)); }
protected void dsSelectedCompany_Updating(object sender, SqlDataSourceCommandEventArgs e) { //check to see if the image is in session and if it is use it for pictureURL if (Session["newImage"] != null) { //use uploaded image name string imageName = Session["newImage"].ToString(); //add the value to the insert command (available thru event args) e.Command.Parameters["@CompanyLogo"].Value = imageName; //remove the image from session variable Session["newImage"] = null;//removing the newImage from Session }//end if else { //if there was an image uploaded on this editing of the record //then we used the same if as we did w inserting a record, but //in this case while editing the record if you wind up in this else //they have no uploaded a new image. We can assume they had a pictureURL //value before. //If we skip this step, then the "empty string" will be passed. //So if we want to let them keep their old pic, we need to find //that value and reset it. //grab what is currently being used and re-use it DataClassesDataContext ctx = new DataClassesDataContext(); string currentImage = (from co in ctx.JFCompanies where co.CompanyID.ToString() == gvCompanies.SelectedValue.ToString() select co.CompanyLogo).Single(); //assign back to the pictureURL //@ calls on the parametes of the command. we are calling on the update command e.Command.Parameters["@CompanyLogo"].Value = currentImage; } }
protected void SqlDataSource1_Inserting1(object sender, SqlDataSourceCommandEventArgs e) { utiles.debugClass.muestra(e.Command,Server.MapPath("log2.txt")); }
protected void DataSourceBrokerList_Inserting(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters.Clear(); foreach (SqlParameter p in InsertParameters) e.Command.Parameters.Add(p); }
protected void SDSYorum_Updating(object sender, SqlDataSourceCommandEventArgs e) { if (!YetkiKontrol(pageName + "-Update")) { e.Cancel = true; return; } }
protected void sdsDocumentos_Inserting(object sender, SqlDataSourceCommandEventArgs e) { //utiles.debugClass.muestra(e.Command,Server.MapPath("documentos.txt")); }