Ejemplo n.º 1
0
        public List <OmanAmount> GetOmanAmount()
        {
            MySqlConnection con = new MySqlConnection(ConnectionString);

            try
            {
                MySqlCommand com = new MySqlCommand("getOmanAmount", con);
                com.CommandType = System.Data.CommandType.StoredProcedure;
                List <OmanAmount> OmanAmountList = new List <OmanAmount>();
                con.Open();
                MySqlDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    OmanAmount OmnAmount = new OmanAmount();

                    OmnAmount.ID                   = Convert.ToInt32(reader["ID"]);
                    OmnAmount.PaymentstoOman       = Convert.ToDouble(reader["PaymentstoOman"]);
                    OmnAmount.TotalRemainingAmount = Convert.ToDouble(reader["TotalRemainingAmount"]);
                    DateTime?dt1 = (reader["Dateofpayment"] == System.DBNull.Value) ? (DateTime?)null : Convert.ToDateTime(reader["Dateofpayment"]);
                    OmnAmount.Dateofpayment = dt1;
                    OmanAmountList.Add(OmnAmount);
                }
                //lblTotalAmount.Text = Convert.ToDouble(reader["TotalRemainingAmount"]);
                con.Close();
                return(OmanAmountList);
            }
            catch
            {
                con.Close();
                return(null);
            }
        }
Ejemplo n.º 2
0
        public void InsertOmanAmount(OmanAmount omanAmount)
        {
            //Connection and Command objects.
            MySqlConnection con = new MySqlConnection(ConnectionString);
            MySqlCommand    com = new MySqlCommand("OmanAddAmount", con);

            //Procedure Parameters .
            com.CommandType = System.Data.CommandType.StoredProcedure;
            com.Parameters.Add(new MySqlParameter("VarID", omanAmount.ID));
            com.Parameters.Add(new MySqlParameter("VarPaymentstoOman", omanAmount.PaymentstoOman));
            com.Parameters.Add(new MySqlParameter("VarDateofpayment", omanAmount.Dateofpayment));
            con.Open();
            com.ExecuteNonQuery();
            con.Close();
        }
Ejemplo n.º 3
0
        protected void gvOF_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            OmanFloatDAL OFDAL = new OmanFloatDAL();
            OmanAmount   com   = new OmanAmount();

            OFDAL.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString();
            com.ID             = Convert.ToInt32((gvOF.DataKeys[e.RowIndex].Values["ID"]));
            com.PaymentstoOman = Convert.ToDouble((gvOF.Rows[e.RowIndex].FindControl("tbP2O") as TextBox).Text);
            DateTime?DOP = (((gvOF.Rows[e.RowIndex].FindControl("lblDateofpayment") as Label).Text) == "")? (DateTime?)null : Convert.ToDateTime(((gvOF.Rows[e.RowIndex].FindControl("lblDateofpayment") as Label).Text));

            com.Dateofpayment = DOP;
            OFDAL.InsertOmanAmount(com);
            gvOF.EditIndex = -1;
            GetOAmount();
            GetTAmount();
        }