예제 #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <param name="b">0 修改 1 新增</param>
    private void GetCheck(System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e, int b)
    {
        if (e.InputParameters["vchrUid"] == null || e.InputParameters["vchrUid"].ToString().Trim() == "")
        {
            throw new Exception("用户编码不可为空");
        }
        if (e.InputParameters["vchrName"] == null || e.InputParameters["vchrName"].ToString().Trim() == "")
        {
            throw new Exception("用户名称不可为空");
        }
        if (b == 1 && (e.InputParameters["vchrName"] == null || e.InputParameters["vchrName"].ToString().Trim() == ""))
        {
            throw new Exception("密码不可为空");
        }

        //sSQL = "select vchrName from _UserInfo where vchrUid='" + e.InputParameters["vchrUid"].ToString() + "' or vchrName='" + e.InputParameters["vchrName"].ToString() + "'";
        //if (b == 0)
        //{
        //    sSQL = sSQL + " and vchrUid<>'" + e.InputParameters["vchrUid"].ToString() + "'";
        //}
        //DataTable dt = clsSQLCommond.ExecQuery(sSQL);
        //if (dt.Rows.Count > 0)
        //{
        //    throw new Exception("该发票号已经输入");
        //}
    }
예제 #2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <param name="b">0 修改 1 新增</param>
    private void GetCheck(System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e, int b)
    {
        string iID   = e.InputParameters["iID"].ToString();
        string iType = e.InputParameters["iType"].ToString();
        string iText = e.InputParameters["iText"].ToString();

        if (gridview.ParameterIsNull(iID))
        {
            throw new Exception("序号不可为空");
        }
        if (gridview.ParameterIsNull(iType))
        {
            throw new Exception("类别不可为空");
        }
        if (gridview.ParameterIsNull(iText))
        {
            throw new Exception("内容不可为空");
        }
        if (b == 1)
        {
            if (!sDate.CheckiID(iID, iType))
            {
                throw new Exception("当前类别序号重复");
            }
            else if (!sDate.CheckiText(iID, iType, iText))
            {
                throw new Exception("名称重复");
            }
        }
    }
예제 #3
0
 protected void CityPerDiemDataSource_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     if (e.InputParameters["AccountId"] != null)
     {
         e.InputParameters.Remove("AccountId");
     }
 }
        protected void dsMensaje_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            MENSAJE mensaje = (MENSAJE)e.InputParameters[0];

            DropDownList drlCondicionMensaje = (DropDownList)this.frmMensaje.FindControl("drlCondicionMensaje");
            ViewState.Add("Mensaje", mensaje);
        }
 protected void ImageItemDataSource_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     var id = (e.InputParameters["item"] as ImageItem).ID;
     var img = new ImageDAO().GetImageItem(id);
     var filepath = Path.Combine(DestinationDirectory, img.FileName);
     if (File.Exists(filepath)) File.Delete(filepath);
 }
 protected void dsHistory_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     CF.History history = e.InputParameters[0] as CF.History;
     DriverManager dm = new DriverManager();
     UserManager um = new UserManager();
     history.Driver = dm.GetById(Convert.ToInt32((fvEditHistory.FindControl("ddlDrivers") as DropDownList).SelectedValue));
     history.User = um.GetById(Convert.ToInt32((fvEditHistory.FindControl("ddlUsers") as DropDownList).SelectedValue));
 }
 protected void dsDrivers_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     Driver driver = e.InputParameters[0] as Driver;
     driver.Car.CarModel = extractTextBoxValue(fvAddDriver , "txtCarModel");
     driver.Car.CarBrand = extractTextBoxValue(fvAddDriver , "txtCarBrand");
     driver.Car.CarNumber = extractTextBoxValue(fvAddDriver, "txtCarNumber");
     driver.Car.CarClass = extractTextBoxValue(fvAddDriver,"txtCarClass");
     string VechileType =(fvAddDriver.FindControl("ddlBody_type") as DropDownList).SelectedValue;
     driver.Car.VehicleType =(VehicleType)Enum.Parse(typeof(VehicleType), VechileType);
 }
        protected void dsMensajeTransaccional_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            MENSAJE_TRANSACCIONAL mensajeTransaccional = (MENSAJE_TRANSACCIONAL)e.InputParameters[0];

            RadioButtonList rdlCondicionMensaje = (RadioButtonList)this.grvMensajeTransaccional.Rows[this.grvMensajeTransaccional.EditIndex].FindControl("rblCondicionMensajeEdit");
            mensajeTransaccional.CONDICION_MENSAJE = new CONDICION_MENSAJE()
            {
                CNM_CODIGO = int.Parse(rdlCondicionMensaje.SelectedValue)
            };
        }
        protected void dsGrupoMensaje_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            GRUPO_MENSAJE grupoMensaje = (GRUPO_MENSAJE)e.InputParameters[0];
            DropDownList drlTipoMensaje = (DropDownList)this.frmGrupoMensaje.FindControl("drlTipoMensaje");

            TIPO_MENSAJE tipoMensaje = new TIPO_MENSAJE() { TMJ_CODIGO = int.Parse(drlTipoMensaje.SelectedValue) };
            grupoMensaje.TIPO_MENSAJE = tipoMensaje;

            ViewState.Add("GrupoMensaje", grupoMensaje);
        }
        protected void dsColumna_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            COLUMNA columna = (COLUMNA)e.InputParameters[0];
            TIPO_DATO_COLUMNA tipoDatoColumna = new TIPO_DATO_COLUMNA()
            {
                TDC_CODIGO = int.Parse(((DropDownList)this.grvColumna.Rows
                [this.grvColumna.EditIndex].FindControl("drlTipoEdit")).SelectedValue)
            };

            columna.TIPO_DATO_COLUMNA = tipoDatoColumna;
        }
        protected void dsMensaje_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            MENSAJE mensaje = (MENSAJE)e.InputParameters[0];

            DropDownList drlCondicionMensaje = (DropDownList)this.frmMensaje.FindControl("drlCondicionMensaje");

            GRUPO_MENSAJE grupoMensaje = new GRUPO_MENSAJE() { GMJ_CODIGO = int.Parse(((HtmlInputHidden)this.frmMensaje.FindControl("lblCodigoGrupoMensaje")).Value) };
            mensaje.GRUPO_MENSAJE = grupoMensaje;

            ViewState.Add("Mensaje", mensaje);
        }
예제 #12
0
 protected void ObjectDataSource1_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     //EmployeeDetails ed = new EmployeeDetails(
     //    Convert.ToInt32(e.InputParameters["EmployeeID"]),
     //    e.InputParameters["FirstName"].ToString(),
     //    e.InputParameters["LastName"].ToString(),
     //    e.InputParameters["City"].ToString());
     //e.InputParameters["emp"] = ed;
     //e.InputParameters.Remove("EmployeeID");
     //e.InputParameters.Remove("FirstName");
     //e.InputParameters.Remove("LastName");
     //e.InputParameters.Remove("City");
 }
예제 #13
0
 protected void ObjectDataSource1_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     var business = new Bussiness.PlayerBussiness();
     var player = business.GetUserSingleByNickName(UserName_tbx.Text);
     if (player != null)
     {
         player.GiftToken = Int32.Parse(((TextBox)FormView1.FindControl("GiftTokenTextBox")).Text);
         player.Gold = Int32.Parse(((TextBox)FormView1.FindControl("GoldTextBox")).Text);
         player.Money = Int32.Parse(((TextBox)FormView1.FindControl("MoneyTextBox")).Text);
         business.UpdatePlayer(player);
     }
     e.Cancel = true;
 }
        protected void dsCampoPlantilla_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            CAMPO_PLANTILLA campoPlantilla = (CAMPO_PLANTILLA)e.InputParameters[0];

            campoPlantilla.TIPO_DATO = new TIPO_DATO()
            {
                TDT_CODIGO = int.Parse(((DropDownList)this.frmCampoPlantilla.FindControl("drlTipoDato")).SelectedValue)
            };

            campoPlantilla.GRUPO_MENSAJE = new GRUPO_MENSAJE()
            {
                GMJ_CODIGO = int.Parse(((HiddenField)this.frmGrupoMensaje.FindControl("hdnCodigoGrupoMensaje")).Value)
            };
        }
예제 #15
0
        protected void Appointment_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            IDictionary paramsFromPage = e.InputParameters;

            paramsFromPage.Remove("Appointment");

            AppointmentServiceRef.Appointment app = new AppointmentServiceRef.Appointment();
            app.id = (int)paramsFromPage["id"];
            app.doctor = new AppointmentServiceRef.Doctor();
            app.patient = new AppointmentServiceRef.Patient();

            paramsFromPage.Add("Appointment",app);
            paramsFromPage.Remove("id");
        }
예제 #16
0
 protected void odsUser_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     var countryControl = UserFormView.FindControl("CountryDropDownList") as DropDownList;
     var userRoleControl = UserFormView.FindControl("UserRoleDropDownList") as DropDownList;
     var user = Providers.SEOMembershipManager.GetUser(Page.User.Identity.Name);
     var password = UserFormView.FindControl("PasswordTextBox") as TextBox;
     if (countryControl != null && countryControl.SelectedIndex > 0)
         e.InputParameters["Country"] =
             Providers.SEOMembershipManager.GetCountryById(int.Parse(countryControl.SelectedValue));
     if (userRoleControl != null && userRoleControl.SelectedIndex > 0)
         e.InputParameters["UserRole"] =
             Providers.SEORolesManager.GetRoleById(int.Parse(userRoleControl.SelectedValue));
     if (e.InputParameters["Id"].ToString() != user.Id.ToString() && !User.IsInRole("Administrator")) return;
     if (password != null && password.Text.Trim().Length > 0) e.InputParameters["Password"] = password.Text;
 }
예제 #17
0
    private void GetDelCheck(System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e)
    {
        //string iID = e.InputParameters["iID"].ToString();
        //string iType = e.InputParameters["iType"].ToString();
        //string iText = e.InputParameters["iText"].ToString();
        //bool bSystem = DataType.BoolParse(e.InputParameters["bSystem"]);

        //if (!sDate.CheckiID(iID, iType))
        //{
        //    throw new Exception("当前类别序号重复");
        //}
        //else if (!sDate.CheckiText(iID, iType, iText))
        //{
        //    throw new Exception("名称重复");
        //}
    }
        void ObjectDataSourceAddress_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            Person person = Person.Load(Convert.ToInt32(GridViewPeople.SelectedDataKey[0]));

            Address toDelete = null;
            if (e.InputParameters["obj"] != null)
            {
                foreach (Address addr in person.Addresses)
                {
                    if (addr.ID == ((Address)e.InputParameters["obj"]).ID)
                    {
                        toDelete = addr;
                        break;
                    }
                }

                if (toDelete != null)
                {
                    person.Addresses.Remove(toDelete);
                    person.Save();
                }
            }
        }
		protected override int ExecuteInsert (IDictionary values)
		{
			if (!CanInsert)
				throw new NotSupportedException ("Insert operation not supported.");
				
			IOrderedDictionary paramValues;
			MethodInfo method;
			
			if (DataObjectTypeName.Length == 0) {
				paramValues = MergeParameterValues (InsertParameters, values, null);
				method = GetObjectMethod (InsertMethod, paramValues, DataObjectMethodType.Insert);
			} else {
				method = ResolveDataObjectMethod (InsertMethod, values, null, out paramValues);
			}
			
			ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
			OnInserting (args);
			if (args.Cancel)
				return -1;
			
			ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
			OnInserted (rargs);
			
			if (rargs.Exception != null && !rargs.ExceptionHandled)
				throw rargs.Exception;

			if (owner.EnableCaching)
				owner.Cache.Expire ();
			
			OnDataSourceViewChanged (EventArgs.Empty);

			return -1;
		}
예제 #20
0
		public void DoOnInserting (ObjectDataSourceMethodEventArgs e)
		{
			base.OnInserting (e);
		}
예제 #21
0
		static void Event (object sender, ObjectDataSourceMethodEventArgs e)
		{
			ObjectDataSourceViewTest.event_checker = true;
		}
예제 #22
0
 private void GetCheck(System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e, int b)
 {
 }
예제 #23
0
        /// <summary>
        /// TODO: Skriv beskrivning till PostDataSource_Inserting.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CommenttDataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            var contact = e.InputParameters[0] as Comment;

            if (contact == null)
            {
                AddErrorMessage(Strings.Post_Inserting_Unexpected_Error);
                e.Cancel = true;
            }
            else if (!contact.IsValid)
            {
                AddErrorMessage(contact);
                e.Cancel = true;
            }
        }
 protected void sourceEmployees_updating_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     //e.InputParameters["id"] = e.InputParameters["EmployeeID"];
       e.InputParameters["employeeID"] = e.InputParameters["EmployeeID"];
       e.InputParameters.Remove("EmployeeID");
 }
예제 #25
0
 protected void OnExpensesSelecting(object sender, ObjectDataSourceMethodEventArgs eventArgs)
 {
     if (eventArgs == null || eventArgs.InputParameters == null) return;
     eventArgs.InputParameters["approverName"] = User.Identity.Name;
 }
 protected virtual new void OnInserting(ObjectDataSourceMethodEventArgs e)
 {
 }
예제 #27
0
        protected void odsAttributes_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            int paramCount = e.InputParameters.Count;

            int assetID = Request.Params["assetID"] != null ? int.Parse(Request.Params["assetID"]) : 0;
            BusinessObjects.WorkManagement.AssetAttribute assetAttribute = new BusinessObjects.WorkManagement.AssetAttribute();
            assetAttribute.Name = e.InputParameters["Name"].ToString();

            e.InputParameters.Clear();
            e.InputParameters.Add("assetID", assetID);
            e.InputParameters.Add("instance", assetAttribute);
        }
 protected void odsContactCreate_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     //WebSite.CustomEntities.AddressBook.ContactODS.BeginTransaction();
 }
		protected virtual void OnUpdating (ObjectDataSourceMethodEventArgs e)
		{
			if (Events != null) {
				ObjectDataSourceMethodEventHandler eh = (ObjectDataSourceMethodEventHandler) Events [UpdatingEvent];
				if (eh != null) eh (this, e);
			}
		}
예제 #30
0
 protected void onDeleting(object sender, ObjectDataSourceMethodEventArgs  e)
 {
     if (GridView1.Rows.Count == 1) { // don't delete the only entry!
         e.Cancel = true;
     }
 }
 protected void ObjectDataSourceEditItem_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
 }
 protected void ObjectDataSourceItemsList_OnDeleting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     string path = WebConfigurationManager.AppSettings["DownloadFilesPath"];
     DownloadFile d = e.InputParameters[0] as DownloadFile;
     DownloadFiles ds = new DownloadFiles();
     DownloadFile f = d != null? ds.GetById(d.ID) : d ;
     if (!string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(f.FileName) && f != null && d != null)
     {
         string rootpath = Path.Combine(path, f.FileName);
         if (File.Exists(rootpath))
         {
             File.Delete(rootpath);
         }
         rootpath = Path.Combine(path, d.ID + ".jpg");
         if (File.Exists(rootpath))
         {
             File.Delete(rootpath);
         }
     }
 }
		protected override int ExecuteDelete (IDictionary keys, IDictionary oldValues)
		{
			if (!CanDelete)
				throw new NotSupportedException ("Delete operation not supported.");
				
			if (ConflictDetection == ConflictOptions.CompareAllValues && (oldValues == null || oldValues.Count == 0))
				throw new InvalidOperationException ("ConflictDetection is set to CompareAllValues and oldValues collection is null or empty.");

			IDictionary oldDataValues;
			oldDataValues = BuildOldValuesList (keys, oldValues, false);
					
			IOrderedDictionary paramValues;
			MethodInfo method;
			
			if (DataObjectTypeName.Length == 0) {
				paramValues = MergeParameterValues (DeleteParameters, null, oldDataValues);
				method = GetObjectMethod (DeleteMethod, paramValues, DataObjectMethodType.Delete);
			} else {
				method = ResolveDataObjectMethod (DeleteMethod, oldDataValues, null, out paramValues);
			}
			
			ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
			OnDeleting (args);
			if (args.Cancel)
				return -1;
			
			ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
			
			OnDeleted (rargs);
			
			if (rargs.Exception != null && !rargs.ExceptionHandled)
				throw rargs.Exception;

			if (owner.EnableCaching)
				owner.Cache.Expire ();
			
			OnDataSourceViewChanged (EventArgs.Empty);

			return -1;
		}
 protected virtual new void OnInserting(ObjectDataSourceMethodEventArgs e)
 {
 }
		protected override int ExecuteUpdate (IDictionary keys, IDictionary values, IDictionary oldValues)
		{
			IOrderedDictionary paramValues;
			MethodInfo method;

			IDictionary oldDataValues;
			oldDataValues = BuildOldValuesList (keys, oldValues, true);

			if (DataObjectTypeName.Length == 0)
			{
				IDictionary dataValues;
				dataValues = values;
				paramValues = MergeParameterValues (UpdateParameters, dataValues, oldDataValues);
				method = GetObjectMethod (UpdateMethod, paramValues, DataObjectMethodType.Update);
			}
			else
			{
				if (ConflictDetection != ConflictOptions.CompareAllValues) {
					oldDataValues = null;
				}
				IDictionary dataValues = new Hashtable ();
				if (keys != null) {
					foreach (DictionaryEntry de in keys)
						dataValues [de.Key] = de.Value;
				}
				if (values != null) {
					foreach (DictionaryEntry de in values)
						dataValues [de.Key] = de.Value;
				}

				method = ResolveDataObjectMethod (UpdateMethod, dataValues, oldDataValues, out paramValues);
			}			

			ObjectDataSourceMethodEventArgs args = new ObjectDataSourceMethodEventArgs (paramValues);
			OnUpdating (args);
			if (args.Cancel)
				return -1;
			
			ObjectDataSourceStatusEventArgs rargs = InvokeMethod (method, paramValues);
			OnUpdated (rargs);
			
			if (rargs.Exception != null && !rargs.ExceptionHandled)
				throw rargs.Exception;

			if (owner.EnableCaching)
				owner.Cache.Expire ();
			
			OnDataSourceViewChanged (EventArgs.Empty);

			return -1;
		}