コード例 #1
0
		protected internal override IEnumerable ExecuteSelect (
						DataSourceSelectArguments arguments)
		{
			oleCommand = new OleDbCommand (this.SelectCommand, oleConnection);
			SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (oleCommand);
			OnSelecting (cmdEventArgs);
			IEnumerable enums = null; 
			Exception exception = null;
			OleDbDataReader reader = null;
			try {
				System.IO.File.OpenRead (dataSource.DataFile).Close ();
				oleConnection.Open ();
				reader = oleCommand.ExecuteReader ();
			
				//enums = reader.GetEnumerator ();
				throw new NotImplementedException("OleDbDataReader doesnt implements GetEnumerator method yet");
			} catch (Exception e) {
				exception = e;
			}
			SqlDataSourceStatusEventArgs statusEventArgs = 
				new SqlDataSourceStatusEventArgs (oleCommand, reader.RecordsAffected, exception);
			OnSelected (statusEventArgs);
			if (exception !=null)
				throw exception;
			return enums;			
		}						
コード例 #2
0
        protected override int ExecuteInsert(IDictionary values)
        {
            if (!this.CanInsert)
            {
                throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_InsertNotSupported", new object[] { this._owner.ID }));
            }
            DbConnection connection = this._owner.CreateConnection(this._owner.ConnectionString);

            if (connection == null)
            {
                throw new InvalidOperationException(System.Web.SR.GetString("SqlDataSourceView_CouldNotCreateConnection", new object[] { this._owner.ID }));
            }
            DbCommand command = this._owner.CreateCommand(this.InsertCommand, connection);

            this.InitializeParameters(command, this.InsertParameters, null);
            this.AddParameters(command, this.InsertParameters, values, null, null);
            command.CommandType = GetCommandType(this.InsertCommandType);
            SqlDataSourceCommandEventArgs e = new SqlDataSourceCommandEventArgs(command);

            this.OnInserting(e);
            if (e.Cancel)
            {
                return(0);
            }
            this.ReplaceNullValues(command);
            return(this.ExecuteDbCommand(command, DataSourceOperation.Insert));
        }
コード例 #3
0
        //fungsi: Handle Ketika akan insert database
        protected void dsChangeShiftEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                ViewState["TglAwal"]  = ((TextBox)FvChangeShift.FindControl("txtItem2FormView")).Text;
                ViewState["TglAkhir"] = ((TextBox)FvChangeShift.FindControl("txtItem3FormView")).Text;


                string  sNIP;
                TextBox NIP = (TextBox)FvChangeShift.FindControl("txtItem0FormView");
                if (isEntryUseNIP())
                {
                    sNIP = NIP.Text;
                }
                else
                {
                    sNIP = azlib.getNIP(NIP.Text, Application["strCn"].ToString());
                }
                TextBox TGL_AWAL  = (TextBox)FvChangeShift.FindControl("txtItem2FormView");
                TextBox TGL_AKHIR = (TextBox)FvChangeShift.FindControl("txtItem3FormView");
                e.Command.Parameters["@NIP"].Value       = sNIP;
                e.Command.Parameters["@TGL_AWAL"].Value  = DateTime.Parse(TGL_AWAL.Text);
                e.Command.Parameters["@TGL_AKHIR"].Value = DateTime.Parse(TGL_AKHIR.Text);
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblWrongDate.Text;
                e.Cancel = true;
            }
        }
コード例 #4
0
        protected void dsijin_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            if (GvIjin.Rows.Count > 0)
            {
                //mendeklarasikam objek yang berada di grid view
                TextBox      txtCol0Footer  = (TextBox)GvIjin.FooterRow.FindControl("txtCol0Footer");
                TextBox      txtCol1Footer  = (TextBox)GvIjin.FooterRow.FindControl("txtCol1Footer");
                DropDownList ddlCol2Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol2Footer");
                DropDownList ddlCol3Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol3Footer");
                TextBox      txtCol4Footer  = (TextBox)GvIjin.FooterRow.FindControl("txtCol4Footer");
                DropDownList ddlCol5Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol5Footer");
                TextBox      txtCol6Footer  = (TextBox)GvIjin.FooterRow.FindControl("txtCol6Footer");
                DropDownList ddlCol7Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol7Footer");
                DropDownList ddlCol8Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol8Footer");
                DropDownList ddlCol9Footer  = (DropDownList)GvIjin.FooterRow.FindControl("ddlCol9Footer");
                CheckBox     chkCol10Footer = (CheckBox)GvIjin.FooterRow.FindControl("chkCol10Footer");
                CheckBox     chkCol11Footer = (CheckBox)GvIjin.FooterRow.FindControl("chkCol11Footer");
                TextBox      txtCol12Footer = (TextBox)GvIjin.FooterRow.FindControl("txtCol12Footer");

                //menyimpan value pada parameter query
                e.Command.Parameters["@KODE_IJIN"].Value         = txtCol0Footer.Text;
                e.Command.Parameters["@KET_IJIN"].Value          = txtCol1Footer.Text;
                e.Command.Parameters["@PERHITUNGAN"].Value       = ddlCol2Footer.SelectedValue;
                e.Command.Parameters["@KETENTUAN"].Value         = ddlCol3Footer.SelectedValue;
                e.Command.Parameters["@JATAH_IJIN"].Value        = txtCol4Footer.Text;
                e.Command.Parameters["@KREDIT"].Value            = ddlCol5Footer.SelectedValue;
                e.Command.Parameters["@BERLAKU"].Value           = txtCol6Footer.Text;
                e.Command.Parameters["@DASAR"].Value             = ddlCol7Footer.SelectedValue;
                e.Command.Parameters["@PROSES_DI_AWAL"].Value    = ddlCol8Footer.SelectedValue;
                e.Command.Parameters["@KODE_TIDAK_HADIR"].Value  = ddlCol9Footer.SelectedValue;
                e.Command.Parameters["@HITUNG_HARI_KERJA"].Value = chkCol10Footer.Checked;
                e.Command.Parameters["@HITUNG_JAM_KERJA"].Value  = chkCol11Footer.Checked;
                e.Command.Parameters["@POTONGAN_TKK"].Value      = txtCol12Footer.Text;
            }
        }
コード例 #5
0
        //fungsi: Handle Ketika akan insert database
        protected void DsReport_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            //mendeklarasikam objek yang berada di grid view
            TextBox      txtkode           = (TextBox)GvLaporan.FooterRow.FindControl("txtkode");
            TextBox      txtNamaLaporan    = (TextBox)GvLaporan.FooterRow.FindControl("txtNamaLaporan");
            TextBox      txtNamaLaporanEn  = (TextBox)GvLaporan.FooterRow.FindControl("txtNamaLaporanEn");
            TextBox      txtKolom          = (TextBox)GvLaporan.FooterRow.FindControl("txtKolom");
            TextBox      txtKolomGroup     = (TextBox)GvLaporan.FooterRow.FindControl("txtKolomGroup");
            TextBox      txtKolomFilter    = (TextBox)GvLaporan.FooterRow.FindControl("txtKolomFilter");
            TextBox      txtFileLaporan    = (TextBox)GvLaporan.FooterRow.FindControl("txtFileLaporan");
            DropDownList ddlTipeLaporan    = (DropDownList)GvLaporan.FooterRow.FindControl("ddlTipeLaporan");
            DropDownList ddlPeriodeLaporan = (DropDownList)GvLaporan.FooterRow.FindControl("ddlPeriodeLaporan");
            CheckBox     cbLapAdm          = (CheckBox)GvLaporan.FooterRow.FindControl("cbLapAdm");
            CheckBox     cbLapAdm2         = (CheckBox)GvLaporan.FooterRow.FindControl("cbLapAdm2");
            CheckBox     cbLapUser         = (CheckBox)GvLaporan.FooterRow.FindControl("cbLapUser");

            //menyimpan value pada parameter query
            e.Command.Parameters["@KODE_LAPORAN"].Value    = txtkode.Text;
            e.Command.Parameters["@NAMA_LAPORAN"].Value    = txtNamaLaporan.Text;
            e.Command.Parameters["@NAMA_LAPORAN_en"].Value = txtNamaLaporanEn.Text;
            e.Command.Parameters["@KOLOM"].Value           = txtKolom.Text;
            e.Command.Parameters["@KOLOM_GROUP"].Value     = txtKolomGroup.Text;
            e.Command.Parameters["@KOLOM_FILTER"].Value    = txtKolomFilter.Text;
            e.Command.Parameters["@FILE_LAPORAN"].Value    = txtFileLaporan.Text;
            e.Command.Parameters["@TIPE_LAPORAN"].Value    = ddlTipeLaporan.SelectedValue;
            e.Command.Parameters["@PERIODE_LAPORAN"].Value = ddlPeriodeLaporan.SelectedValue;
            e.Command.Parameters["@LAP_ADMIN"].Value       = cbLapAdm.Checked;
            e.Command.Parameters["@LAP_OPERATOR"].Value    = cbLapAdm2.Checked;
            e.Command.Parameters["@LAP_USER"].Value        = cbLapUser.Checked;
        }
コード例 #6
0
        //Method yang dieksekusi sebelum melakukan penambahan pada database
        //Fungsinya untuk mengambil nilai dari kontrol-kontrol lalu di masukan pada Parameter Query
        protected void ds_holiday_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            if (GVHoliday.Rows.Count > 0)
            {
                try
                {
                    //Pengambilan Nilai dari Kontrol-kontrol
                    TextBox Tanggal    = (TextBox)GVHoliday.FooterRow.FindControl("txtCol0Footer");
                    TextBox txtHoliday = (TextBox)GVHoliday.FooterRow.FindControl("txtCol1Footer");

                    //Penginputan nilai ke Parameter DataBase
                    e.Command.Parameters["@TGL_LIBUR"].Value = DateTime.Parse(Tanggal.Text);
                    e.Command.Parameters["@KET_LIBUR"].Value = txtHoliday.Text;
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblNotSaved.Text;
                    e.Cancel = true;
                }
            }
            else
            {
                try
                {
                    //Pengambilan Nilai dari Kontrol-kontrol
                    DateTime Tanggal = DateTime.Parse(((TextBox)FvHoliday.FindControl("txtCol0FormView")).Text);
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblNotSaved.Text;
                    e.Cancel = true;
                }
            }
        }
コード例 #7
0
        protected void dsUsers_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            //jika tambah data dilakukan melalui gridview/data pada gridview tidak kosong,
            //maka parameter-parameter datasource didapat dr control-control yg ada di footerrow
            //jika tambah data dilakukan melalui FormView,
            //maka parameter-parameter datasource didapat secara otomatis
            //dr control-control yang sudah melakukan binding yg terdapat di formView
            TextBox userName;

            if (GvUsers.Rows.Count > 0)
            {
                userName = (TextBox)(GvUsers.FooterRow.FindControl("txtCol0Footer"));
                DropDownList level = (DropDownList)(GvUsers.FooterRow.FindControl("ddlCol1Footer"));
                TextBox      NIP   = (TextBox)(GvUsers.FooterRow.FindControl("txtCol2Footer"));

                e.Command.Parameters["@USERNAME"].Value   = userName.Text;
                e.Command.Parameters["@KODE_LEVEL"].Value = level.SelectedValue;
                e.Command.Parameters["@NIP"].Value        = NIP.Text;
            }
            else
            {
                userName = (TextBox)(FvUsers.FindControl("txtCol0FormView"));
            }

            string pass = common.CreateRandomPassword(8);

            e.Command.Parameters["@PASSW"].Value = common.cekuser(pass);
            ExceptionDetails.Text    = "User Name: " + userName.Text + " Password: " + pass;
            ExceptionDetails.Visible = true;
        }
コード例 #8
0
 protected void SqlDataSource3_Inserting(object sender, SqlDataSourceCommandEventArgs e)
 {
     TextBox txtAttName = (TextBox)attributeFormView.FindControl("attributenameTextBox");
     TextBox txtAttDesc = (TextBox)attributeFormView.FindControl("attributedescTextBox");
     e.Command.Parameters["@attributeName"].Value = txtAttName.Text;
     e.Command.Parameters["@attributedesc"].Value = txtAttDesc.Text;
     e.Command.Parameters["@typeid"].Value = ddlTypes.SelectedItem.Value;
 }
コード例 #9
0
        protected void dsRegistryCORC_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
            string userName = HttpContext.Current.User.Identity.Name.Replace(@"\", "/");
            DirectoryEntry userEntry = new DirectoryEntry("WinNT://" + userName + ",User");
            string fullName = (string)userEntry.Properties["fullname"].Value;

            e.Command.Parameters["@LastModifiedUser"].Value = fullName;
        }
コード例 #10
0
        protected void dbScheduleAdd_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        {
            //get logged in user id
            MembershipUser usr = Membership.GetUser();
            Guid uid = (Guid)usr.ProviderUserKey;

            //set the UserId parameter to current user for DB insert
            e.Command.Parameters["@UserId"].Value = uid;
        }
コード例 #11
0
 protected void dsRangeDetail_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     if (GvTimeCardDetail.Rows.Count > 0)
     {
         e.Command.Parameters["@KODE_RANGE"].Value      = ((DropDownList)(GvTimeCardDetail.FooterRow.FindControl("ddlCol0Footer"))).SelectedValue;
         e.Command.Parameters["@KODE_DEPARTEMEN"].Value = ((DropDownList)(GvTimeCardDetail.FooterRow.FindControl("ddlCol1Footer"))).SelectedValue;
         e.Command.Parameters["@KET_RANGE"].Value       = ((TextBox)(GvTimeCardDetail.FooterRow.FindControl("txtCol2Footer"))).Text;
     }
 }
コード例 #12
0
        protected virtual void OnUpdating(SqlDataSourceCommandEventArgs e)
        {
            SqlDataSourceCommandEventHandler handler = base.Events[EventUpdating] as SqlDataSourceCommandEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #13
0
        // for stored procedure updating, we do parameter transforming
        protected void sourceEmployees3_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"]);

              // and we need to remove the extra 'City' which is filled automatically by the GridView binding
              e.Command.Parameters.Remove(e.Command.Parameters["@City"]);
        }
コード例 #14
0
        //method yang dieksekusi sebelum melakukan penginputan ke database
        //sebelum input mengambil nilai-nilai dari dropdownlist
        //untuk diinputkan ke parameter pada query database
        protected void ds_shift3_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            string  grup    = ((TextBox)(fvInsertHarian.FindControl("TextBox1"))).Text;
            TextBox tanggal = (TextBox)fvInsertHarian.FindControl("ASPxdeTglMulai");

            //format diambil dari dropdownlist2 yang ada
            //string format = drop1.SelectedValue + drop2.SelectedValue + drop3.SelectedValue + drop4.SelectedValue + drop5.SelectedValue + drop6.SelectedValue + drop7.SelectedValue + drop8.SelectedValue + drop9.SelectedValue + drop10.SelectedValue + drop11.SelectedValue + drop12.SelectedValue + drop13.SelectedValue + drop14.SelectedValue + drop15.SelectedValue + drop16.SelectedValue + drop17.SelectedValue + drop18.SelectedValue + drop19.SelectedValue + drop20.SelectedValue + drop21.SelectedValue + drop22.SelectedValue + drop23.SelectedValue + drop24.SelectedValue + drop25.SelectedValue + drop26.SelectedValue + drop27.SelectedValue + drop28.SelectedValue + drop29.SelectedValue + drop30.SelectedValue + drop31.SelectedValue;
            string format = ((DropDownList)fvInsertHarian.FindControl("DropDownlist1")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist2")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist3")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist4")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist5")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist6")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist7")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist8")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist9")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist10")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist11")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist12")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist13")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist14")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist15")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist16")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist17")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist18")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist19")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist20")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist21")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist22")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist23")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist24")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist25")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist26")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist27")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist28")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist29")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist30")).SelectedValue +
                            ((DropDownList)fvInsertHarian.FindControl("DropDownlist31")).SelectedValue;

            //jika format null maka batalkan penginputan
            //jika format tidak sama dengan null maka isikan nilai KODE_SHIFT dan FORMAT
            if (format == "")
            {
                ExceptionDetails.Text    = lblCannotNull.Text;
                ExceptionDetails.Visible = true;
                e.Cancel = true;
                showGridView(true);
            }
            else
            {
                e.Command.Parameters["@KODE_SHIFT"].Value = "N" + grup;
                e.Command.Parameters["@FORMAT"].Value     = format;
                e.Command.Parameters["@TGL_MULAI"].Value  = DateTime.Parse(tanggal.Text);
            }
        }
コード例 #15
0
 //fungsi: Handle Ketika akan insert database
 protected void dsAkumulasiEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         ExceptionDetails.Text = lblWrongDate.Text;
         e.Cancel = true;
     }
 }
コード例 #16
0
        protected void PersonalInfoSource_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
            UpdateSuccessfulMessage.Visible = false;
            // Get a reference to the currently logged on user
            MembershipUser currentUser = Membership.GetUser();

            // Determine the currently logged on user's UserId value
            Guid currentUserId = (Guid)currentUser.ProviderUserKey;

            // Assign the currently logged on user's UserId to the @UserId parameter
            e.Command.Parameters["@UserID"].Value = currentUserId;
        }
コード例 #17
0
        protected virtual void OnUpdating(SqlDataSourceCommandEventArgs e)
        {
            if (!HasEvents())
            {
                return;
            }
            SqlDataSourceCommandEventHandler h = Events [EventUpdating] as SqlDataSourceCommandEventHandler;

            if (h != null)
            {
                h(this, e);
            }
        }
コード例 #18
0
 //fungsi: Handle Ketika akan mengupdate data pada database
 protected void dsChangeShiftEdit_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     try
     {
         TextBox TGL_AKHIR = (TextBox)FvChangeShift.FindControl("txtItem3FormView");
         e.Command.Parameters["@TGL_AKHIR"].Value = DateTime.Parse(TGL_AKHIR.Text);
     }
     catch (Exception ex)
     {
         ExceptionDetails.Text = lblWrongDate.Text;
         e.Cancel = true;
     }
 }
コード例 #19
0
        //method yang dieksekusi sebelum melakukan penginputan ke database
        //sebelum input mengambil nilai-nilai dari dropdownlist
        //untuk diinputkan ke parameter pada query database
        protected void ds_shift2_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            TextBox      txtGroup   = (TextBox)fvInsertMingguan.FindControl("txtGroup");
            DropDownList DropMinggu = (DropDownList)fvInsertMingguan.FindControl("DropDownList1");
            DropDownList DropSenin  = (DropDownList)fvInsertMingguan.FindControl("DropDownList2");
            DropDownList DropSelasa = (DropDownList)fvInsertMingguan.FindControl("DropDownList3");
            DropDownList DropRabu   = (DropDownList)fvInsertMingguan.FindControl("DropDownList4");
            DropDownList DropKamis  = (DropDownList)fvInsertMingguan.FindControl("DropDownList5");
            DropDownList DropJumat  = (DropDownList)fvInsertMingguan.FindControl("DropDownList6");
            DropDownList DropSabtu  = (DropDownList)fvInsertMingguan.FindControl("DropDownList7");

            string kode_shift = "M" + txtGroup.Text;
            string Format     = DropMinggu.SelectedValue + DropSenin.SelectedValue + DropSelasa.SelectedValue + DropRabu.SelectedValue + DropKamis.SelectedValue + DropJumat.SelectedValue + DropSabtu.SelectedValue;

            e.Command.Parameters["@KODE_SHIFT"].Value = kode_shift;
            e.Command.Parameters["@FORMAT"].Value     = Format;
        }
コード例 #20
0
        //Method yang dieksekusi sebelum melakukan penambahan pada database
        //Fungsinya untuk mengambil nilai dari kontrol-kontrol lalu di masukan pada Parameter Query
        protected void ds_ceremony_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            if (GVceremony.Rows.Count > 0)
            {
                try
                {
                    //Pengambilan Nilai dari Kontrol-kontrol
                    TextBox      Tanggal     = (TextBox)GVceremony.FooterRow.FindControl("txtCol0Footer");
                    TextBox      txtceremony = (TextBox)GVceremony.FooterRow.FindControl("txtCol1Footer");
                    DropDownList ddlRange    = (DropDownList)GVceremony.FooterRow.FindControl("ddlCol2Footer");

                    //Penginputan nilai ke Parameter DataBase
                    e.Command.Parameters["@TGL_UPACARA"].Value = DateTime.Parse(Tanggal.Text);
                    e.Command.Parameters["@KET_UPACARA"].Value = txtceremony.Text;
                    e.Command.Parameters["@KODE_RANGE"].Value  = ddlRange.SelectedValue;
                }
                catch (Exception ex)
                {
                    //ExceptionDetails.Text = lblNotSaved.Text;
                    ExceptionDetails.Text = lblNotSaved.Text + " (" + ex.Message + ")";
                    e.Cancel = true;
                }
            }
            else
            {
                try
                {
                    //Pengambilan Nilai dari Kontrol-kontrol
                    DateTime Tanggal = DateTime.Parse(((TextBox)Fvceremony.FindControl("txtCol0FormView")).Text);
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblNotSaved.Text + " (" + ex.Message + ")";
                    //ExceptionDetails.Text = lblNotSaved.Text;
                    e.Cancel = true;
                }
            }
        }
コード例 #21
0
		protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
		{
			if (!CanDelete)
				throw new NotSupportedException("Delete operation is not supported");
			if (oldValues == null && conflictOptions == ConflictOptions.CompareAllValues)
				throw new InvalidOperationException ("oldValues parameters should be specified when ConflictOptions is set to CompareAllValues");
			command = new SqlCommand (this.DeleteCommand, connection);
			SqlDataSourceCommandEventArgs cmdEventArgs = new SqlDataSourceCommandEventArgs (command);
			OnDeleting (cmdEventArgs);
			connection.Open ();
			Exception exception = null; 
			int result = -1;;
			try {
				result = command.ExecuteNonQuery();
			} catch (Exception e) {
				exception = e;
			}
			SqlDataSourceStatusEventArgs statusEventArgs = new SqlDataSourceStatusEventArgs (command, result, exception);
			OnDeleted (statusEventArgs);
			if (exception != null)
				throw exception;
			return result;
		}
コード例 #22
0
        protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)
        {
            if (!this.CanUpdate)
            {
                throw new NotSupportedException(System.Web.SR.GetString("SqlDataSourceView_UpdateNotSupported", new object[] { this._owner.ID }));
            }
            DbConnection connection = this._owner.CreateConnection(this._owner.ConnectionString);

            if (connection == null)
            {
                throw new InvalidOperationException(System.Web.SR.GetString("SqlDataSourceView_CouldNotCreateConnection", new object[] { this._owner.ID }));
            }
            string    oldValuesParameterFormatString = this.OldValuesParameterFormatString;
            DbCommand command = this._owner.CreateCommand(this.UpdateCommand, connection);

            this.InitializeParameters(command, this.UpdateParameters, keys);
            this.AddParameters(command, this.UpdateParameters, values, null, null);
            this.AddParameters(command, this.UpdateParameters, keys, null, oldValuesParameterFormatString);
            if (this.ConflictDetection == ConflictOptions.CompareAllValues)
            {
                if ((oldValues == null) || (oldValues.Count == 0))
                {
                    throw new InvalidOperationException(System.Web.SR.GetString("SqlDataSourceView_Pessimistic", new object[] { System.Web.SR.GetString("DataSourceView_update"), this._owner.ID, "oldValues" }));
                }
                this.AddParameters(command, this.UpdateParameters, oldValues, null, oldValuesParameterFormatString);
            }
            command.CommandType = GetCommandType(this.UpdateCommandType);
            SqlDataSourceCommandEventArgs e = new SqlDataSourceCommandEventArgs(command);

            this.OnUpdating(e);
            if (e.Cancel)
            {
                return(0);
            }
            this.ReplaceNullValues(command);
            return(this.ExecuteDbCommand(command, DataSourceOperation.Update));
        }
コード例 #23
0
ファイル: AddCategory.aspx.cs プロジェクト: rnramkumar/ToAchu
        protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        {
            TextBox txtCatName = (TextBox)categoryFormView.FindControl("catNameTextBox");
            DropDownList ddl = (DropDownList)categoryFormView.FindControl("ddlCat");
            //CheckBox chkStatus = (CheckBox)categoryFormView.FindControl("chkStatus");
            //SqlParameter param = new SqlParameter("parentId", ddl.SelectedItem.Value);
               //SqlParameter param1 = new SqlParameter("categoryName", txtCatName.Text);

              //  SqlDataSource1.InsertParameters["categoryId"].DefaultValue = ddl.SelectedItem.Value;
            //SqlDataSource1.InsertParameters["categoryName"].DefaultValue = txtCatName.Text;

            //SqlDataSource1.InsertParameters["parentId"].DefaultValue = ddl.SelectedItem.Value;
            //SqlDataSource1.Insert();
               // e.Command.Parameters.Add(param1);
            //e.Command.Parameters.Add(param);
            //SqlDataSource1.Insert();
            e.Command.Parameters["@categoryName"].Value = txtCatName.Text;
            e.Command.Parameters["@parentId"].Value = Convert.ToInt32(ddl.SelectedItem.Value);
            //int istatus=0;
            //if(chkStatus.Checked)
             //   istatus=1;

            //e.Command.Parameters["@status"].Value = istatus;
        }
 protected virtual new void OnInserting(SqlDataSourceCommandEventArgs e)
 {
 }
コード例 #25
0
 protected void item_Updating(object sender, SqlDataSourceCommandEventArgs e)
 {
     Utils.IsAuthorized("Settings_LoandAndInvestment", "Edit");
 }
コード例 #26
0
 protected void item_Deleting(object sender, SqlDataSourceCommandEventArgs e)
 {
     Utils.IsAuthorized("Deposit", "Delete");
     Utils.LogTransaction("Deposit", "Deposit deleted");
 }
コード例 #27
0
 protected void SqlDataSourceAtributos_Updating(object sender, SqlDataSourceCommandEventArgs e)
 {
 }
コード例 #28
0
ファイル: MantMultas.aspx.cs プロジェクト: ijustarrived/EXC
        //protected void GridView1_DataBound(object sender, EventArgs e)
        //{
        //    //if (!IsPostBack)
        //    //{
                
        //    //}
        //}

        protected void SqlDataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
            //foreach (GridViewRow r in multasGV.Rows)
            //{
            //    if (r.Cells[1].Text.Equals(((int)TiposMultas.Excavador).ToString()))
            //    {
            //        r.Cells[1].Text = ((int)TiposMultas.Excavador).ToString();
            //    }

            //    else
            //    {
            //        r.Cells[1].Text = ((int)TiposMultas.Demoledor).ToString();
            //    }
            //}

            var s = e.Command.CommandText;
        }
コード例 #29
0
 protected void SqlDataSource1_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
 }
コード例 #30
0
        protected void SqlDataSourceAssistenza_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {

            string sSQL = "SELECT * FROM Assistenza WHERE IDAss=" + Request.QueryString["IDAss"];

            SqlCommand cmdAss = new SqlCommand(sSQL, _cnn);
            SqlDataAdapter adap = new SqlDataAdapter(cmdAss);

            adap.Fill(_dtAss);
        }
コード例 #31
0
 protected void gridReadonlyCheck_Changing( object sender, SqlDataSourceCommandEventArgs e )
 {
     CheckReadOnly( );
       Service.ServiceFacade.ResetGroupsDefCache( );
 }
コード例 #32
0
 protected void item_Updating(object sender, SqlDataSourceCommandEventArgs e)
 {
     Utils.IsAuthorized("Settings_CompanyProfile", "Edit");
 }
    protected void SqlDataSource1_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
    {
        SqlParameter sqlVarBinaryParameter = (SqlParameter)e.Command.Parameters[0];

        sqlVarBinaryParameter.SqlDbType = SqlDbType.VarBinary;
    }
コード例 #34
0
ファイル: WebForm1.aspx.cs プロジェクト: hebert-nr/KingsCourt
 protected void SqlDataSource2_Inserting(object sender, SqlDataSourceCommandEventArgs e)
 {
     e.Command.Parameters["@IncomeID"].Value = Session["InsertedIncomeID"].ToString();
 }
コード例 #35
0
 //fungsi: Handle Ketika akan insert database
 protected void dsperformanceEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
 }
コード例 #36
0
 protected void SqlDataSourceRapporto_Updating(object sender, SqlDataSourceCommandEventArgs e)
 {
     AggiornaPrezzi();
 }
コード例 #37
0
		protected override int ExecuteDelete (IDictionary keys, IDictionary oldValues)
		{
			if (!CanDelete)
				throw new NotSupportedException("Delete operation is not supported");
			if (oldValues == null && ConflictDetection == ConflictOptions.CompareAllValues)
				throw new InvalidOperationException ("oldValues parameters should be specified when ConflictOptions is set to CompareAllValues");

			InitConnection ();

			DbCommand command = factory.CreateCommand ();
			command.CommandText = DeleteCommand;
			command.Connection = connection;
			if (DeleteCommandType == SqlDataSourceCommandType.Text)
				command.CommandType = CommandType.Text;
			else
				command.CommandType = CommandType.StoredProcedure;

			IDictionary oldDataValues;
			if (ConflictDetection == ConflictOptions.CompareAllValues) {
				oldDataValues = new Hashtable ();
				if (keys != null) {
					foreach (DictionaryEntry de in keys)
						oldDataValues [de.Key] = de.Value;
				}
				if (oldValues != null) {
					foreach (DictionaryEntry de in oldValues)
						oldDataValues [de.Key] = de.Value;
				}
			}
			else
				oldDataValues = keys;
			
			InitializeParameters (command, DeleteParameters, null, oldDataValues, true);

			SqlDataSourceCommandEventArgs args = new SqlDataSourceCommandEventArgs (command);
			OnDeleting (args);
			if (args.Cancel)
				return -1; 

			bool closed = connection.State == ConnectionState.Closed;

			if (closed)
				connection.Open();
			Exception exception = null; 
			int result = -1;;
			try {
				result = command.ExecuteNonQuery();
			} catch (Exception e) {
				exception = e;
			}

			if (closed)
				connection.Close ();

			OnDataSourceViewChanged (EventArgs.Empty);

			SqlDataSourceStatusEventArgs deletedArgs =
				new SqlDataSourceStatusEventArgs (command, result, exception);
			OnDeleted (deletedArgs);

			if (exception != null && !deletedArgs.ExceptionHandled)
				throw exception;

			return result;
		}
コード例 #38
0
 protected void dbServiceSql_Inserting(object sender, SqlDataSourceCommandEventArgs e)
 {
     
 }
コード例 #39
0
 protected void item_Deleting(object sender, SqlDataSourceCommandEventArgs e)
 {
     Utils.IsAuthorized("MobileBankers", "Delete");
 }
コード例 #40
0
		protected override int ExecuteInsert (IDictionary values)
		{
			if (!CanInsert)
				throw new NotSupportedException ("Insert operation is not supported");

			InitConnection ();

			DbCommand command = factory.CreateCommand ();
			command.CommandText = InsertCommand;
			command.Connection = connection;
			if (InsertCommandType == SqlDataSourceCommandType.Text)
				command.CommandType = CommandType.Text;
			else
				command.CommandType = CommandType.StoredProcedure;

			InitializeParameters (command, InsertParameters, values, null, false);

			SqlDataSourceCommandEventArgs args = new SqlDataSourceCommandEventArgs (command);
			OnInserting (args);
			if (args.Cancel)
				return -1;

			bool closed = connection.State == ConnectionState.Closed;
			if (closed)
				connection.Open ();
			Exception exception = null;
			int result = -1;
			try {
				result = command.ExecuteNonQuery ();
			}
			catch (Exception e) {
				exception = e;
			}

			if (closed)
				connection.Close ();

			OnDataSourceViewChanged (EventArgs.Empty);

			OnInserted (new SqlDataSourceStatusEventArgs (command, result, exception));

			if (exception != null)
				throw exception;
			return result;
		}
コード例 #41
0
        protected void SqlDataSource3_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
            int multaId = (int)ViewState["multaId"],
                affectedRow = (int)ViewState["affectedRow"];

            //if (string.IsNullOrWhiteSpace(multasGV.Rows[affectedRow].Cells[6].Text))
            //{
            //    ClientScript.RegisterStartupScript(GetType(), "alertMsg", "alert('Número de Inspección es requerido');", true);

            //    e.Cancel = true;
            //}

            //else
            //{
            e.Command.CommandText = e.Command.CommandText.Replace("@WHERE", string.Format("WHERE MultaId = {0};", multaId));
            //}            
        }
コード例 #42
0
		protected virtual void OnUpdating (SqlDataSourceCommandEventArgs e)
		{
			if (!HasEvents ()) return;
			SqlDataSourceCommandEventHandler h = Events [EventUpdating] as SqlDataSourceCommandEventHandler;
			if (h != null)
				h (this, e);
		}
コード例 #43
0
 /// <devdoc>
 /// Raises the Updating event.
 /// </devdoc>
 protected virtual void OnUpdating(SqlDataSourceCommandEventArgs e) {
     SqlDataSourceCommandEventHandler handler = Events[EventUpdating] as SqlDataSourceCommandEventHandler;
     if (handler != null) {
         handler(this, e);
     }
 }
コード例 #44
0
ファイル: SqlDataSourceTest.cs プロジェクト: LevNNN/mono
		void view_Deleting (object sender, SqlDataSourceCommandEventArgs e)
		{
			SqlDataSourceTest.CustomEventParameterCollection = (SqlParameterCollection) e.Command.Parameters;
			SqlDataSourceTest.PassedParameters = FormatParameters (SqlDataSourceTest.CustomEventParameterCollection);
			e.Cancel = true;
		}
コード例 #45
0
        /// <devdoc>
        /// Deletes rows from the data source with given parameters.
        /// </devdoc>
        protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues) {
            if (!CanDelete) {
                throw new NotSupportedException(SR.GetString(SR.SqlDataSourceView_DeleteNotSupported, _owner.ID));
            }

            DbConnection connection = _owner.CreateConnection(_owner.ConnectionString);

            if (connection == null) {
                throw new InvalidOperationException(SR.GetString(SR.SqlDataSourceView_CouldNotCreateConnection, _owner.ID));
            }

            // Create command and add parameters
            string oldValuesParameterFormatString = OldValuesParameterFormatString;
            DbCommand command = _owner.CreateCommand(DeleteCommand, connection);
            InitializeParameters(command, DeleteParameters, oldValues);
            AddParameters(command, DeleteParameters, keys, null, oldValuesParameterFormatString);
            if (ConflictDetection == ConflictOptions.CompareAllValues) {
                if (oldValues == null || oldValues.Count == 0) {
                    throw new InvalidOperationException(SR.GetString(SR.SqlDataSourceView_Pessimistic, SR.GetString(SR.DataSourceView_delete), _owner.ID, "values"));
                }
                AddParameters(command, DeleteParameters, oldValues, null, oldValuesParameterFormatString);
            }
            command.CommandType = GetCommandType(DeleteCommandType);

            // Raise event to allow customization and cancellation
            SqlDataSourceCommandEventArgs eventArgs = new SqlDataSourceCommandEventArgs(command);
            OnDeleting(eventArgs);

            // If the operation was cancelled, exit immediately
            if (eventArgs.Cancel) {
                return 0;
            }

            // Replace null values in parameters with DBNull.Value
            ReplaceNullValues(command);

            return ExecuteDbCommand(command, DataSourceOperation.Delete);
        }
コード例 #46
0
 protected void item_Updating(object sender, SqlDataSourceCommandEventArgs e)
 {
     Utils.IsAuthorized("Deposit", "Edit");
 }
コード例 #47
0
        /// <devdoc>
        /// Inserts a new row with data from a name/value collection.
        /// </devdoc>
        protected override int ExecuteInsert(IDictionary values) {
            if (!CanInsert) {
                throw new NotSupportedException(SR.GetString(SR.SqlDataSourceView_InsertNotSupported, _owner.ID));
            }

            DbConnection connection = _owner.CreateConnection(_owner.ConnectionString);

            if (connection == null) {
                throw new InvalidOperationException(SR.GetString(SR.SqlDataSourceView_CouldNotCreateConnection, _owner.ID));
            }

            // Create command and add parameters
            DbCommand command = _owner.CreateCommand(InsertCommand, connection);
            InitializeParameters(command, InsertParameters, null);
            AddParameters(command, InsertParameters, values, null, null);
            command.CommandType = GetCommandType(InsertCommandType);

            // Raise event to allow customization and cancellation
            SqlDataSourceCommandEventArgs eventArgs = new SqlDataSourceCommandEventArgs(command);
            OnInserting(eventArgs);

            // If the operation was cancelled, exit immediately
            if (eventArgs.Cancel) {
                return 0;
            }

            // Replace null values in parameters with DBNull.Value
            ReplaceNullValues(command);

            return ExecuteDbCommand(command, DataSourceOperation.Insert);
        }
コード例 #48
0
		static void view_Deleting (object source, SqlDataSourceCommandEventArgs e) 
		{
			if (eventsCalled == null) {
				eventsCalled = new ArrayList ();
			}
			eventsCalled.Add ("view_Deleting");
			eventsCalled.Add (FormatParameters ((SqlParameterCollection) e.Command.Parameters));
			e.Cancel = true;
		}
コード例 #49
0
 protected void AccessDataSource1_Modifying(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     throw new Exception("Please download the example to modify the datasource");
 }
コード例 #50
0
 private void SqlDataSource1_Inserting1(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     e.Command.Parameters["@Template1"].Value = HexsToArray(this.HiddenField1.Value);
     e.Command.Parameters["@Template2"].Value = HexsToArray(this.HiddenField2.Value);
 }
コード例 #51
0
        protected override int ExecuteInsert(IDictionary values)
        {
            if (!CanInsert)
            {
                throw new NotSupportedException("Insert operation is not supported");
            }

            InitConnection();

            DbCommand command = factory.CreateCommand();

            command.CommandText = InsertCommand;
            command.Connection  = connection;
            if (InsertCommandType == SqlDataSourceCommandType.Text)
            {
                command.CommandType = CommandType.Text;
            }
            else
            {
                command.CommandType = CommandType.StoredProcedure;
            }

            InitializeParameters(command, InsertParameters, values, null, false);

            SqlDataSourceCommandEventArgs args = new SqlDataSourceCommandEventArgs(command);

            OnInserting(args);
            if (args.Cancel)
            {
                return(-1);
            }

            bool closed = connection.State == ConnectionState.Closed;

            if (closed)
            {
                connection.Open();
            }
            Exception exception = null;
            int       result    = -1;

            try {
                result = command.ExecuteNonQuery();
            }
            catch (Exception e) {
                exception = e;
            }

            if (closed)
            {
                connection.Close();
            }

            OnDataSourceViewChanged(EventArgs.Empty);

            OnInserted(new SqlDataSourceStatusEventArgs(command, result, exception));

            if (exception != null)
            {
                throw exception;
            }
            return(result);
        }
コード例 #52
0
ファイル: WebForm1.aspx.cs プロジェクト: hebert-nr/KingsCourt
 protected void SqlDataSource2_Deleting(object sender, SqlDataSourceCommandEventArgs e)
 {
     e.Command.Parameters["@IncomeID"].Value = Session["DeletedIncome"];
 }
コード例 #53
0
        protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
        {
            if (!CanDelete)
            {
                throw new NotSupportedException("Delete operation is not supported");
            }
            if (oldValues == null && ConflictDetection == ConflictOptions.CompareAllValues)
            {
                throw new InvalidOperationException("oldValues parameters should be specified when ConflictOptions is set to CompareAllValues");
            }

            InitConnection();

            DbCommand command = factory.CreateCommand();

            command.CommandText = DeleteCommand;
            command.Connection  = connection;
            if (DeleteCommandType == SqlDataSourceCommandType.Text)
            {
                command.CommandType = CommandType.Text;
            }
            else
            {
                command.CommandType = CommandType.StoredProcedure;
            }

            IDictionary oldDataValues;

            if (ConflictDetection == ConflictOptions.CompareAllValues)
            {
                oldDataValues = new Hashtable();
                if (keys != null)
                {
                    foreach (DictionaryEntry de in keys)
                    {
                        oldDataValues [de.Key] = de.Value;
                    }
                }
                if (oldValues != null)
                {
                    foreach (DictionaryEntry de in oldValues)
                    {
                        oldDataValues [de.Key] = de.Value;
                    }
                }
            }
            else
            {
                oldDataValues = keys;
            }

            InitializeParameters(command, DeleteParameters, null, oldDataValues, true);

            SqlDataSourceCommandEventArgs args = new SqlDataSourceCommandEventArgs(command);

            OnDeleting(args);
            if (args.Cancel)
            {
                return(-1);
            }

            bool closed = connection.State == ConnectionState.Closed;

            if (closed)
            {
                connection.Open();
            }
            Exception exception = null;
            int       result    = -1;;

            try {
                result = command.ExecuteNonQuery();
            } catch (Exception e) {
                exception = e;
            }

            if (closed)
            {
                connection.Close();
            }

            OnDataSourceViewChanged(EventArgs.Empty);

            SqlDataSourceStatusEventArgs deletedArgs =
                new SqlDataSourceStatusEventArgs(command, result, exception);

            OnDeleted(deletedArgs);

            if (exception != null && !deletedArgs.ExceptionHandled)
            {
                throw exception;
            }

            return(result);
        }
コード例 #54
0
        protected void dsManualEdit_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                TextBox      jam_awal  = (TextBox)FvManual.FindControl("txtItem3FormView");
                TextBox      jam_akhir = (TextBox)FvManual.FindControl("txtItem4FormView");
                DropDownList ddlFlag   = (DropDownList)FvManual.FindControl("ddlFlag");

                bool TimeSpanValidation = false;

                try
                {
                    TimeSpan tsJamAwal  = TimeSpan.Parse(jam_awal.Text);
                    TimeSpan tsJamAkhir = TimeSpan.Parse(jam_akhir.Text);

                    TimeSpanValidation = true;
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblJamSalah2.Text;
                    e.Cancel = true;
                }

                if (TimeSpanValidation)
                {
                    DateTime Tanggal_Fix = DateTime.Parse(((Label)FvManual.FindControl("lblItem2FormView")).Text);
                    CheckBox ganti_hari  = (CheckBox)FvManual.FindControl("cbGantiHari");
                    string   TanggalFix  = "";

                    if (Session["strlang"].ToString() == "en")
                    {
                        TanggalFix = Tanggal_Fix.ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        TanggalFix = Tanggal_Fix.ToString("dd/MM/yyyy");
                    }

                    string jamAwal;
                    string jamAkhir;

                    if ((TimeSpan.Parse(jam_awal.Text) <= TimeSpan.Parse(jam_akhir.Text)) && (!ganti_hari.Checked))
                    {
                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix + " " + jam_akhir.Text + ":00";
                    }
                    else
                    {
                        string TanggalFix2 = "";

                        if (Session["strlang"].ToString() == "en")
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("MM/dd/yyyy");
                        }
                        else
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("dd/MM/yyyy");
                        }

                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix2 + " " + jam_akhir.Text + ":00";
                    }

                    e.Command.Parameters["@JAM_MASUK"].Value  = DateTime.Parse(jamAwal);
                    e.Command.Parameters["@JAM_KELUAR"].Value = DateTime.Parse(jamAkhir);
                    e.Command.Parameters["@ISI_MANUAL"].Value = ddlFlag.SelectedValue;
                }
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblCannotUpdate.Text;
                e.Cancel = true;
            }
        }
コード例 #55
0
        protected void dsManualEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                ViewState["TglHadir"] = ((TextBox)FvManual.FindControl("txtItem2FormView")).Text;

                TextBox jam_awal  = (TextBox)FvManual.FindControl("txtItem3FormView");
                TextBox jam_akhir = (TextBox)FvManual.FindControl("txtItem4FormView");

                bool TimeSpanValidation = false;

                try
                {
                    TimeSpan tsJamAwal  = TimeSpan.Parse(jam_awal.Text);
                    TimeSpan tsJamAkhir = TimeSpan.Parse(jam_akhir.Text);

                    TimeSpanValidation = true;
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblJamSalah2.Text;
                    e.Cancel = true;
                }

                if (TimeSpanValidation)
                {
                    string   sNIP;
                    DateTime Tanggal_Fix = DateTime.Parse(((TextBox)FvManual.FindControl("txtItem2FormView")).Text);
                    CheckBox ganti_hari  = (CheckBox)FvManual.FindControl("cbGantiHari");
                    string   TanggalFix  = "";

                    if (Session["strlang"].ToString() == "en")
                    {
                        TanggalFix = Tanggal_Fix.ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        TanggalFix = Tanggal_Fix.ToString("dd/MM/yyyy");
                    }

                    string jamAwal;
                    string jamAkhir;

                    if ((TimeSpan.Parse(jam_awal.Text) <= TimeSpan.Parse(jam_akhir.Text)) && (!ganti_hari.Checked))
                    {
                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix + " " + jam_akhir.Text + ":00";
                    }
                    else
                    {
                        string TanggalFix2 = "";

                        if (Session["strlang"].ToString() == "en")
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("MM/dd/yyyy");
                        }
                        else
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("dd/MM/yyyy");
                        }

                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix2 + " " + jam_akhir.Text + ":00";
                    }

                    if (isEntryUseNIP())
                    {
                        sNIP = ((TextBox)FvManual.FindControl("txtItem0FormView")).Text;
                    }
                    else
                    {
                        sNIP = azlib.getNIP(((TextBox)FvManual.FindControl("txtItem0FormView")).Text, Application["strCn"].ToString());
                    }
                    e.Command.Parameters["@NIP"].Value        = sNIP;
                    e.Command.Parameters["@TGL_MASUK"].Value  = Tanggal_Fix;
                    e.Command.Parameters["@JAM_MASUK"].Value  = DateTime.Parse(jamAwal);
                    e.Command.Parameters["@JAM_KELUAR"].Value = DateTime.Parse(jamAkhir);
                }
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblCannotUpdate.Text;
                e.Cancel = true;
            }
        }