Beispiel #1
0
        protected void cvEventItem_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
        {
            int EventID;
            int EventPeriodID;

            try
            {
                EventID = int.Parse(Session["EventID"].ToString());
            }
            catch
            {
                EventID = -1;
            }
            try
            {
                EventPeriodID = int.Parse(Session["EventPeriodID"].ToString());
            }
            catch
            {
                EventPeriodID = -1;
            }
            int    OrganisationID = UserContext.UserData.OrgID;
            string EventItem      = this.txtEventItem.Text;

            BusinessServices.Event objProfile = new BusinessServices.Event();

            DataTable dtEventName = objProfile.CheckEventItem(EventItem, EventID, EventPeriodID, UserContext.UserID);

            if (dtEventName.Rows.Count > 0)
            {
                ((CustomValidator)source).ErrorMessage = ResourceManager.GetString("EventItemExists");
                args.IsValid = false;
                return;
            }

            string strEventItem = this.txtEventItem.Text;

            if (strEventItem.Equals(String.Empty))
            {
                ((CustomValidator)source).ErrorMessage = ResourceManager.GetString("rfvEventItem");
                args.IsValid = false;
                return;
            }
        }