public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.currencyCode)
            {
                hashcode = (hashcode * 397) + CurrencyCode.GetHashCode();
            }
            if (__isset.currencyName)
            {
                hashcode = (hashcode * 397) + CurrencyName.GetHashCode();
            }
            if (__isset.currencySign)
            {
                hashcode = (hashcode * 397) + CurrencySign.GetHashCode();
            }
            if (__isset.preferred)
            {
                hashcode = (hashcode * 397) + Preferred.GetHashCode();
            }
            if (__isset.coinRate)
            {
                hashcode = (hashcode * 397) + CoinRate.GetHashCode();
            }
            if (__isset.creditRate)
            {
                hashcode = (hashcode * 397) + CreditRate.GetHashCode();
            }
        }
        return(hashcode);
    }
예제 #2
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            PreferredDAO dt = new PreferredDAO();

            for (int i = 0; i < grMienGiam.RowCount; i++)
            {
                try
                {
                    Preferred a = new Preferred();
                    a.PreferredID = (int)grMienGiam.GetRowCellValue(i, grMienGiam.Columns["PreferredID"]);
                    a.Name        = grMienGiam.GetRowCellValue(i, grMienGiam.Columns["Name"]).ToString();
                    a.Status      = bool.Parse(grMienGiam.GetRowCellValue(i, grMienGiam.Columns["Status"]).ToString());
                    a.Percent     = float.Parse(grMienGiam.GetRowCellValue(i, grMienGiam.Columns["Percent"]).ToString());
                    if (dt.Edit(a) == true)
                    {
                    }
                    else
                    {
                        MessageBox.Show("Bản ghi " + i + " lỗi");
                        break;
                    }
                }
                catch
                {
                }
            }
            this.Close();
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Preferred != null)
         {
             hashCode = hashCode * 59 + Preferred.GetHashCode();
         }
         if (ContactMediumType != null)
         {
             hashCode = hashCode * 59 + ContactMediumType.GetHashCode();
         }
         if (ValidFor != null)
         {
             hashCode = hashCode * 59 + ValidFor.GetHashCode();
         }
         if (Characteristic != null)
         {
             hashCode = hashCode * 59 + Characteristic.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if ContactMedium instances are equal
        /// </summary>
        /// <param name="other">Instance of ContactMedium to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ContactMedium other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Preferred == other.Preferred ||
                     Preferred != null &&
                     Preferred.Equals(other.Preferred)
                     ) &&
                 (
                     ContactMediumType == other.ContactMediumType ||
                     ContactMediumType != null &&
                     ContactMediumType.Equals(other.ContactMediumType)
                 ) &&
                 (
                     ValidFor == other.ValidFor ||
                     ValidFor != null &&
                     ValidFor.Equals(other.ValidFor)
                 ) &&
                 (
                     Characteristic == other.Characteristic ||
                     Characteristic != null &&
                     Characteristic.Equals(other.Characteristic)
                 ));
        }
예제 #5
0
        public bool Remove(Preferred entity)
        {
            Preferred a = dt.Preferreds.Where(t => t.PreferredID == entity.PreferredID).FirstOrDefault();

            dt.Preferreds.DeleteOnSubmit(a);
            dt.SubmitChanges();
            return(true);
        }
예제 #6
0
        public bool Edit(Preferred entity)
        {
            Preferred a = dt.Preferreds.Where(t => t.PreferredID == entity.PreferredID).FirstOrDefault();

            a.Name    = entity.Name;
            a.Percent = entity.Percent;
            a.Status  = entity.Status;
            dt.SubmitChanges();
            return(true);
        }
예제 #7
0
        public bool Insert(Preferred entity)
        {
            Preferred a = new Preferred();

            a.Name    = entity.Name;
            a.Status  = entity.Status;
            a.Percent = entity.Percent;
            dt.Preferreds.InsertOnSubmit(a);
            dt.SubmitChanges();
            return(true);
        }
예제 #8
0
 public float lookPreferredPercent(int perferredID)
 {
     if (perferredID == 0)
     {
         return(100);
     }
     else
     {
         Preferred a = dt.Preferreds.FirstOrDefault(t => t.PreferredID == perferredID);
         return((float)a.Percent);
     }
 }
예제 #9
0
파일: Name.cs 프로젝트: samvasta/Budget-CLI
        public bool Equals(string other, StringComparison stringComparison)
        {
            if (Preferred.Equals(other, stringComparison))
            {
                return(true);
            }
            foreach (var alt in Alternates)
            {
                if (alt.Equals(other, stringComparison))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #10
0
        public void laodPreferred()
        {
            List <string> b = new List <string>();

            for (int i = 0; i < (studentReceivableDAO.PreferredID.Length - 1); i += 2)
            {
                string a = studentReceivableDAO.PreferredID.Substring(i, 1);
                b.Add(a);
            }
            PreferredDAO     dt = new PreferredDAO();
            List <Preferred> c  = new List <Preferred>();

            foreach (var i in b)
            {
                Preferred e = dt.listPreferredByID(int.Parse(i));
                if (e != null)
                {
                    c.Add(e);
                }
            }
            grDanhsachmiengian.DataSource = c;
        }
예제 #11
0
 private void bntLuu_Click(object sender, EventArgs e)
 {
     try
     {
         PreferredDAO st = new PreferredDAO();
         Preferred    dt = new Preferred();
         dt.Name    = txtTemdienmiengiam.Text;
         dt.Percent = float.Parse(txtTilemiengiam.Text);
         dt.Status  = true;
         if (st.Insert(dt) == true)
         {
             MessageBox.Show("Them thanh cong");
         }
         else
         {
             MessageBox.Show("Them khong thanh cong");
         }
     }
     catch
     {
         MessageBox.Show("Da co loi");
     }
 }
예제 #12
0
 private void bntXoa_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("ban co muon xoa doi tuong:" + preferredName + "", "Thong bao", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
     {
         PreferredDAO dt = new PreferredDAO();
         try
         {
             Preferred a = new Preferred();
             a.PreferredID = prID;
             if (dt.Remove(a) == true)
             {
                 MessageBox.Show("Xoa thanh cong");
             }
             else
             {
                 MessageBox.Show("Xoa khong thanh cong");
             }
         }
         catch
         {
         }
     }
     loadMiengiam();
 }
예제 #13
0
        public Preferred listPreferredByID(int PrefrerredID)
        {
            Preferred a = dt.Preferreds.FirstOrDefault(t => t.PreferredID == PrefrerredID);

            return(a);
        }
예제 #14
0
파일: Name.cs 프로젝트: samvasta/Budget-CLI
        public string GetLongestMatch(string input, out int matchLength)
        {
            if (String.IsNullOrEmpty(input))
            {
                matchLength = 0;
                return(String.Empty);
            }

            Dictionary <string, CharEnumerator> enumerators = new Dictionary <string, CharEnumerator>();

            enumerators.Add(Preferred, Preferred.GetEnumerator());
            foreach (string alt in Alternates)
            {
                enumerators.Add(alt, alt.GetEnumerator());
            }

            int charIdx = 0;

            CharEnumerator inputEnumerator = input.GetEnumerator();

            List <string> toRemove = new List <string>();

            while (enumerators.Any())
            {
                if (!inputEnumerator.MoveNext())
                {
                    //End of input string
                    break;
                }
                charIdx++;

                foreach (KeyValuePair <string, CharEnumerator> kvp in enumerators)
                {
                    if (kvp.Value.MoveNext())
                    {
                        if (kvp.Value.Current != inputEnumerator.Current)
                        {
                            //Character doesn't match input
                            toRemove.Add(kvp.Key);
                        }
                    }
                    else
                    {
                        //String is over. Remove from list
                        toRemove.Add(kvp.Key);
                    }
                }

                //Make sure to not remove the remaining keys
                if (toRemove.Count > 0 && toRemove.Count < enumerators.Count)
                {
                    foreach (string keyToRemove in toRemove)
                    {
                        enumerators.Remove(keyToRemove);
                    }
                    toRemove.Clear();
                }
                else if (toRemove.Count == enumerators.Count)
                {
                    //All remaining keys should be removed. No reason to keep going
                    //Decrement charIdx because the latest idx didn't match anything
                    charIdx--;
                    break;
                }
            }

            matchLength = charIdx;

            //If we perfectly match one, return that.
            var perfectMatch = enumerators.FirstOrDefault(x => !x.Value.MoveNext() && x.Key.Length == charIdx).Key;

            if (perfectMatch != default(string))
            {
                return(perfectMatch);
            }

            return(enumerators.Keys.OrderByDescending(x => x.Length).First());
        }
예제 #15
0
 /// <summary>
 /// To string function
 /// </summary>
 /// <returns>The API info</returns>
 public override string ToString()
 {
     return("<api name=\"" + Name + "\" preferred=\"" + Preferred.ToString() + "\" apiLink=\"" + APILink + "\" blogID=\"" + BlogID + "\"/>");
 }
예제 #16
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("PaidCallCurrencyExchangeRate(");
        bool __first = true;

        if (CurrencyCode != null && __isset.currencyCode)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencyCode: ");
            CurrencyCode.ToString(sb);
        }
        if (CurrencyName != null && __isset.currencyName)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencyName: ");
            CurrencyName.ToString(sb);
        }
        if (CurrencySign != null && __isset.currencySign)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CurrencySign: ");
            CurrencySign.ToString(sb);
        }
        if (__isset.preferred)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Preferred: ");
            Preferred.ToString(sb);
        }
        if (CoinRate != null && __isset.coinRate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CoinRate: ");
            CoinRate.ToString(sb);
        }
        if (CreditRate != null && __isset.creditRate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CreditRate: ");
            CreditRate.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }