Ejemplo n.º 1
0
        public Inquiries FindInq(int Id)
        {
            Inquiries inq = new Inquiries();

            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            MySqlCommand cmd = new MySqlCommand("select * from Inquiries where Id=@id", con);

            cmd.Parameters.AddWithValue("@id", Id);
            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                inq.Id                 = Convert.ToInt32(reader["Id"].ToString());
                inq.NameOfBank         = reader["NameOfBank"].ToString();
                inq.InquiryDate        = reader["InquiryDate"].ToString();
                inq.RemovalDate        = reader["RemovalDate"].ToString();
                inq.BusinessType       = reader["BusinessType"].ToString();
                inq.ContactInformation = reader["ContactInformation"].ToString();
                inq.LoansId            = reader["LoansId"].ToString();
            }
            return(inq);
        }
Ejemplo n.º 2
0
        public void CreateInq(Inquiries i)
        {
            if (i.Id == -1)
            {
                i.Id = getId();
            }

            //insert to DB
            //check if someone already use the database and wait if necessary
            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            string query = "INSERT INTO Inquiries (Id,NameOfBank,InquiryDate,RemovalDate,BusinessType,ContactInformation,LoansId) VALUES (@Id,@NameOfBank,@InquiryDate,@RemovalDate,@BusinessType,@ContactInformation,@LoansId)";

            MySqlCommand cmd = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", i.Id);
            cmd.Parameters.AddWithValue("@NameOfBank", i.NameOfBank);
            cmd.Parameters.AddWithValue("@InquiryDate", i.InquiryDate);
            cmd.Parameters.AddWithValue("@RemovalDate", i.RemovalDate);
            cmd.Parameters.AddWithValue("@BusinessType", i.BusinessType);
            cmd.Parameters.AddWithValue("@ContactInformation", i.ContactInformation);
            cmd.Parameters.AddWithValue("@LoansId", i.LoansId);

            cmd.ExecuteNonQuery();
            con.Close();
        }
Ejemplo n.º 3
0
 protected void AddInq_Click(object sender, EventArgs e)
 {
     try
     {
         Inquiries inq = new Inquiries(Bnametxt.Text, InqDate.Value, REmDAtetxt.Value, Btype.Text, CInformation.Text, "0");
         loan.AddInquiries(inq);
         l.InqList.Add(inq);
         popInqs();
     }
     catch (Exception ex)
     {
         error3.Text = ex.Message.Split('@')[0];
     }
     Bnametxt.Text     = "";
     InqDate.Value     = "";
     REmDAtetxt.Value  = "";
     Btype.Text        = "";
     CInformation.Text = "";
     AddInq.Text       = "Add";
 }
Ejemplo n.º 4
0
        public void UpdateInq(Inquiries i)
        {
            //change
            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            string       query = "UPDATE Inquiries SET NameOfBank=@NameOfBank,InquiryDate=@InquiryDate,RemovalDate=@RemovalDate,BusinessType=@BusinessType,ContactInformation=@ContactInformation,LoansId=@LoansId WHERE Id=@id";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", i.Id);
            cmd.Parameters.AddWithValue("@NameOfBank", i.NameOfBank);
            cmd.Parameters.AddWithValue("@InquiryDate", i.InquiryDate);
            cmd.Parameters.AddWithValue("@RemovalDate", i.RemovalDate);
            cmd.Parameters.AddWithValue("@BusinessType", i.BusinessType);
            cmd.Parameters.AddWithValue("@ContactInformation", i.ContactInformation);
            cmd.Parameters.AddWithValue("@LoansId", i.LoansId);
            cmd.ExecuteNonQuery();
            con.Close();
        }
Ejemplo n.º 5
0
 protected void AddInq_Click(object sender, EventArgs e)
 {
     try
     {
         string ind;
         if (InqDate.Value == "")
         {
             ind = InqDateChange.Text;
         }
         else
         {
             ind = InqDate.Value;
         }
         string rem;
         if (REmDAtetxt.Value == "")
         {
             rem = REmDAteChange.Text;
         }
         else
         {
             rem = REmDAtetxt.Value;
         }
         Inquiries inq = new Inquiries(Bnametxt.Value, ind, rem, Btype.Value, CInformation.Value, "0");
         inq.Id = loan.getIdDynamicInq(l.InqList);
         loan.AddInquiries(inq);
         l.InqList.Add(inq);
         popInqs();
     }
     catch (Exception ex)
     {
         error3.Text = ex.Message.Split('@')[0];
     }
     Bnametxt.Value     = "";
     InqDate.Value      = "";
     REmDAtetxt.Value   = "";
     Btype.Value        = "";
     CInformation.Value = "";
     AddInq.Text        = "Add";
 }
Ejemplo n.º 6
0
 public void AddInquiries(Inquiries inq)
 {
     if (inq.NameOfBank == "")
     {
         throw new Exception("The Bank Name Field Is empty@3@" + inq.Id);
     }
     if (inq.InquiryDate == "")
     {
         throw new Exception("The Inquiry Date Field Is empty@3@" + inq.Id);
     }
     if (inq.RemovalDate == "")
     {
         throw new Exception("The Removal Date Field Is empty@3@" + inq.Id);
     }
     if (inq.BusinessType == "")
     {
         throw new Exception("The Business Type Field Is empty@3@" + inq.Id);
     }
     if (inq.ContactInformation == "")
     {
         throw new Exception("The Contact Information Field Is empty@3@" + inq.Id);
     }
 }
Ejemplo n.º 7
0
        public void updateChosenInq(Inquiries i)//when click update
        {
            InquiriesC inter = new InquiriesC();

            inter.UpdateInq(i);
        }