Esempio n. 1
0
        public void setupFields(UniversityModel ob)
        {
            txtApporvalAmount.Text     = ob.Approval_Amount;
            txtApprovalDate.Text       = ob.Approval_Date;
            txtFifthPaymentAmount.Text = ob.Fifth_Payment_Amount.ToString();

            txtFifthChequeNumber.Text = ob.Fifth_Payment_Cheque_Number;
            txtFifthPaymentDate.Text  = ob.Fifth_Payment_Date;

            txtFirstPaymentAmount.Text       = ob.First_Payment_Amount.ToString();
            txtFirstChequeNumber.Text        = ob.First_Payment_Cheque_Number;
            txtFirstPaymentDate.Text         = ob.First_Payment_Date;
            txtForuthPaymentAmount.Text      = ob.Foruth_Payment_Amount.ToString();
            txtFourthChequeNumber.Text       = ob.Fourth_Payment_Cheque_Number;
            txtFourthPaymentDate.Text        = ob.Fourth_Payment_Date;
            txtOrganisation.Text             = ob.Organisation;
            txtPaymentBank.Text              = ob.Payment_Bank;
            txtPaymentBankAccountNumber.Text = ob.Payment_Bank_Account_Number;
            txtProgrammeName.Text            = ob.Programme_Name;
            txtProgramLeader.Text            = ob.Program_Leader;
            txtProjectCode.Text              = ob.Project_Code;
            txtSecondPaymentAmount.Text      = ob.Second_Payment_Amount.ToString();
            txtSecondChequeNumber.Text       = ob.Second_Payment_Cheque_Number;
            txtSecondPaymentDate.Text        = ob.Second_Payment_Date;
            txtSourceofFunding.Text          = ob.Source_of_Funding;
            txtThirdPaymentAmount.Text       = ob.Third_Payment_Amount.ToString();
            txtThirdChequeNumber.Text        = ob.Third_Payment_Cheque_Number;
            txtThirdPaymentDate.Text         = ob.Third_Payment_Date;
        }
        public static UniversityModel GetUniversityByProjectCode(string code)
        {
            try
            {
                using (SQLiteConnection conn = new SQLiteConnection(GetConnectionString()))
                {
                    conn.Open();

                    string stm = "SELECT * FROM university Where Project_Code=?";

                    using (var cmd = new SQLiteCommand(stm, conn))
                    {
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = code
                        });

                        SQLiteDataReader rdr = cmd.ExecuteReader();

                        UniversityModel ob = new UniversityModel();
                        while (rdr.Read())
                        {
                            ob.Project_Code                 = rdr["Project_Code"].ToString();
                            ob.Organisation                 = rdr["Organisation"].ToString();
                            ob.Programme_Name               = rdr["Programme_Name"].ToString();
                            ob.Source_of_Funding            = rdr["Source_of_Funding"].ToString();
                            ob.Program_Leader               = rdr["Program_Leader"].ToString();
                            ob.Approval_Date                = rdr["Approval_Date"].ToString();
                            ob.Approval_Amount              = rdr["Approval_Amount"].ToString();
                            ob.First_Payment_Date           = rdr["First_Payment_Date"].ToString();
                            ob.Second_Payment_Date          = rdr["Second_Payment_Date"].ToString();
                            ob.Third_Payment_Date           = rdr["Third_Payment_Date"].ToString();
                            ob.Fourth_Payment_Date          = rdr["Fourth_Payment_Date"].ToString();
                            ob.Fifth_Payment_Date           = rdr["Fifth_Payment_Date"].ToString();
                            ob.First_Payment_Amount         = Convert.ToDecimal(rdr["First_Payment_Amount"]);
                            ob.Second_Payment_Amount        = Convert.ToDecimal(rdr["Second_Payment_Amount"]);
                            ob.Third_Payment_Amount         = Convert.ToDecimal(rdr["Third_Payment_Amount"]);
                            ob.Foruth_Payment_Amount        = Convert.ToDecimal(rdr["Foruth_Payment_Amount"]);
                            ob.Fifth_Payment_Amount         = Convert.ToDecimal(rdr["Fifth_Payment_Amount"]);
                            ob.First_Payment_Cheque_Number  = rdr["First_Payment_Cheque_Number"].ToString();
                            ob.Second_Payment_Cheque_Number = rdr["Second_Payment_Cheque_Number"].ToString();
                            ob.Third_Payment_Cheque_Number  = rdr["Third_Payment_Cheque_Number"].ToString();
                            ob.Fourth_Payment_Cheque_Number = rdr["Fourth_Payment_Cheque_Number"].ToString();
                            ob.Fifth_Payment_Cheque_Number  = rdr["Fifth_Payment_Cheque_Number"].ToString();
                            ob.Payment_Bank                 = rdr["Payment_Bank"].ToString();
                            ob.Payment_Bank_Account_Number  = rdr["Payment_Bank_Account_Number"].ToString();
                        }


                        return(ob);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtProjectCode.Text))
            {
                UniversityModel data = SetFields();
                SqliteDataAccess.SaveUniversity(data);

                MessageBox.Show("Record saved successfully.");
                button1_Click(sender, e);
            }
            else
            {
                MessageBox.Show("enter project code");
            }
        }
Esempio n. 4
0
 private void btnGet_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtIpProjectCode.Text))
     {
         UniversityModel data = SqliteDataAccess.GetUniversityByProjectCode(txtIpProjectCode.Text.Trim());
         setupFields(data);
         isEditing         = true;
         btnDelete.Visible = true;
         GProject_Code     = data.Project_Code;
     }
     else
     {
         MessageBox.Show("enter project code");
     }
 }
Esempio n. 5
0
        public UniversityModel SetFields()
        {
            UniversityModel ob = new UniversityModel();

            ob.Approval_Amount = txtApporvalAmount.Text;
            ob.Approval_Date   = txtApprovalDate.Text;
            if (!String.IsNullOrEmpty(txtFifthPaymentAmount.Text))
            {
                ob.Fifth_Payment_Amount = Convert.ToDecimal(txtFifthPaymentAmount.Text);
            }
            ob.Fifth_Payment_Cheque_Number = txtFifthChequeNumber.Text;
            ob.Fifth_Payment_Date          = txtFifthPaymentDate.Text;
            if (!String.IsNullOrEmpty(txtFirstPaymentAmount.Text))
            {
                ob.First_Payment_Amount = Convert.ToDecimal(txtFirstPaymentAmount.Text);
            }
            ob.First_Payment_Cheque_Number = txtFirstChequeNumber.Text;
            ob.First_Payment_Date          = txtFirstPaymentDate.Text;
            if (!String.IsNullOrEmpty(txtForuthPaymentAmount.Text))
            {
                ob.Foruth_Payment_Amount = Convert.ToDecimal(txtForuthPaymentAmount.Text);
            }
            ob.Fourth_Payment_Cheque_Number = txtFourthChequeNumber.Text;
            ob.Fourth_Payment_Date          = txtFourthPaymentDate.Text;
            ob.Organisation = txtOrganisation.Text;
            ob.Payment_Bank = txtPaymentBank.Text;
            ob.Payment_Bank_Account_Number = txtPaymentBankAccountNumber.Text;
            ob.Programme_Name = txtProgrammeName.Text;
            ob.Program_Leader = txtProgramLeader.Text;
            ob.Project_Code   = txtProjectCode.Text;
            if (!String.IsNullOrEmpty(txtSecondPaymentAmount.Text))
            {
                ob.Second_Payment_Amount = Convert.ToDecimal(txtSecondPaymentAmount.Text);
            }
            ob.Second_Payment_Cheque_Number = txtSecondChequeNumber.Text;
            ob.Second_Payment_Date          = txtSecondPaymentDate.Text;
            ob.Source_of_Funding            = txtSourceofFunding.Text;
            if (!String.IsNullOrEmpty(txtThirdPaymentAmount.Text))
            {
                ob.Third_Payment_Amount = Convert.ToDecimal(txtThirdPaymentAmount.Text);
            }
            ob.Third_Payment_Cheque_Number = txtThirdChequeNumber.Text;
            ob.Third_Payment_Date          = txtThirdPaymentDate.Text;

            return(ob);
        }
        public static void SaveUniversity(UniversityModel universityModel)
        {
            try
            {
                using (SQLiteConnection conn = new SQLiteConnection(GetConnectionString()))
                {
                    conn.Open();

                    using (var cmd = new SQLiteCommand(@"Insert into university (" +
                                                       "Project_Code,Organisation,Programme_Name,Source_of_Funding," +
                                                       "Program_Leader,Approval_Date,Approval_Amount,First_Payment_Date,Second_Payment_Date," +
                                                       "Third_Payment_Date,Fourth_Payment_Date,Fifth_Payment_Date,First_Payment_Amount,Second_Payment_Amount," +
                                                       "Third_Payment_Amount,Foruth_Payment_Amount,Fifth_Payment_Amount,First_Payment_Cheque_Number," +
                                                       "Second_Payment_Cheque_Number,Third_Payment_Cheque_Number,Fourth_Payment_Cheque_Number,Fifth_Payment_Cheque_Number,Payment_Bank,Payment_Bank_Account_Number) values(?, ?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?)", conn))
                    {
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Project_Code
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Organisation
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Programme_Name
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Source_of_Funding
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Program_Leader
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Approval_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Approval_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.First_Payment_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Second_Payment_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Third_Payment_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Fourth_Payment_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Fifth_Payment_Date
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.Decimal, Value = universityModel.First_Payment_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.Decimal, Value = universityModel.Second_Payment_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.Decimal, Value = universityModel.Third_Payment_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.Decimal, Value = universityModel.Foruth_Payment_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.Decimal, Value = universityModel.Fifth_Payment_Amount
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.First_Payment_Cheque_Number
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Second_Payment_Cheque_Number
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Third_Payment_Cheque_Number
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Fourth_Payment_Cheque_Number
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Fifth_Payment_Cheque_Number
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Payment_Bank
                        });
                        cmd.Parameters.Add(new SQLiteParameter {
                            DbType = DbType.String, Value = universityModel.Payment_Bank_Account_Number
                        });

                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }