private void TenderNumberTxt_LostFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            var t = UniqueConstraints.ExistTenderingNumber(TenderNumberTxt.Text, CurrentContract);

            if (t == null)
            {
                ErrorHandler.ShowErrorMessage(Errors.NotFoundTendering);
                CurrentContract.TenderingSystemCode = "";
            }
            else
            {
                ErrorHandler.NotifyUser(Errors.FoundTendering);
                CurrentContract.ContractTtile = t.TenderingTitle;
                var c = DataManagement.RetrieveTenderingContractorRequest(t);
                CurrentContract.SupervisingUnit       = c.RequestingUnit;
                CurrentContract.SupervisingUnitHigher = c.SupervisionId;
                try
                {
                    var res = DataManagement.SearchOrCreateTenderingResult(t);
                    CurrentContract.ContractorId   = res.FirstContractorWinnerId;
                    CurrentContract.ContractBudget = (from items in DataManagement.RetrieveBids(t) where items.ContractorId == CurrentContract.ContractorId select items).FirstOrDefault().Bid1;
                }
                catch (System.Exception ex)
                {
                }
            }
        }
 private void SocialTxt_LostFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (UniqueConstraints.ValidSocialSecurityNumber(SocialTxt.Text, PageUser) == false)
     {
         ErrorHandler.ShowErrorMessage(Errors.InvalidNumber);
         SocialTxt.Text = "";
     }
 }
 private void ReqNomTxt_LostFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (UniqueConstraints.ValidRequestNumber(ReqNomTxt.Text, CurrentReq) == false)
     {
         ErrorHandler.ShowErrorMessage(Errors.InvalidNumber);
         CurrentReq.RequestNumber = "";
     }
 }
 private void CNumberTxt_LostFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (UniqueConstraints.ValidContractNumber(CNumberTxt.Text, CurrentContract) == false)
     {
         ErrorHandler.ShowErrorMessage(Errors.InvalidNumber);
         CurrentContract.ContractNumber = "";
         //CNumberTxt.Focus();
     }
 }
示例#5
0
        protected UniqueRule Unique(string constraintName, string[] columnNames, string errorMessage)
        {
            var unique = new UniqueRule(constraintName, columnNames)
            {
                Message = errorMessage
            };

            UniqueConstraints.Add(unique);
            return(unique);
        }
示例#6
0
        public String DropSubObjects()
        {
            StringBuilder script = new StringBuilder();

            script.Append(Indexes.DropAllScript());
            script.Append(UniqueConstraints.DropAllScript());
            if (PrimarKey != null)
            {
                script.AppendLine(PrimarKey.DropScript());
            }
            script.Append(CheckConstraints.DropAllScript());
            script.Append(DefaultConstraints.DropAllScript());
            return(script.ToString());
        }
示例#7
0
        public virtual Table Clone([NotNull] CloneContext cloneContext)
        {
            Check.NotNull(cloneContext, "cloneContext");

            var clone = new Table(Name, Columns.Select(c => c.Clone(cloneContext)));

            if (PrimaryKey != null)
            {
                clone._primaryKey = PrimaryKey.Clone(cloneContext);
            }

            clone._uniqueConstraints.AddRange(UniqueConstraints.Select(uc => uc.Clone(cloneContext)));
            clone._foreignKeys.AddRange(ForeignKeys.Select(fk => fk.Clone(cloneContext)));
            clone._indexes.AddRange(Indexes.Select(ix => ix.Clone(cloneContext)));

            return(clone);
        }
示例#8
0
        public String CreateSubObjects(Boolean withFk)
        {
            StringBuilder script = new StringBuilder();

            if (PrimarKey != null)
            {
                script.AppendLine(PrimarKey.CreateScript());
                script.AppendLine();
            }

            script.Append(UniqueConstraints.CreateAllScript());
            script.Append(Indexes.CreateAllScript());
            script.Append(CheckConstraints.CreateAllScript());
            script.Append(DefaultConstraints.CreateAllScript());

            if (withFk)
            {
                script.Append(ForeignKeys.CreateAllScript());
            }
            return(script.ToString());
        }
示例#9
0
        public void GetUniqueConstraints()
        {
            //initialize connection
            using (SqlConnection sqlcon = new SqlConnection(ConnectionString))
            {
                sqlcon.Open();
                //retrieving Indexes

                using (SqlCommand sqlUniqueConstraints = new SqlCommand(SQLcommands.GetUniqueConstraints, sqlcon))
                {
                    SqlDataReader uqcreader;
                    uqcreader = sqlUniqueConstraints.ExecuteReader();

                    //get index create statements
                    while (uqcreader.Read())
                    {
                        UniqueConstraints.Add(uqcreader[0].ToString());
                    }
                }
            }
        }