示例#1
0
        protected internal void LoadCharge(object sender, EventArgs e)
        {
            int ChargeID = -1;
            int.TryParse(((LinkButton)sender).CommandArgument, out ChargeID);

            thisCharge = Charge.Get(ChargeID);

            //BindData();
            LoadHeader();
        }
示例#2
0
        protected internal void SaveCharge(object sender, EventArgs e)
        {
            int chargeID = int.Parse(ChargeID.Text);
            thisCharge = Charge.Get(chargeID);
            thisCharge.UORCode = UOR_Code.Text;
            thisCharge.Description = Description.Text;

            thisCharge.UpdateUOR();
            ChargeUpdatedPanel.CssClass += " visible";

            Response.Redirect(Request.Url.AbsoluteUri);
        }
示例#3
0
文件: Charge.cs 项目: jblackett/RJLou
        public static Charge Get(int id)
        {
            string dsn = ConfigurationManager.ConnectionStrings["RJLouEntities"].ToString();
            string sql = @"
                SELECT      *
                FROM        Charge
                WHERE       Charge_ID = @ID";

            using (SqlConnection conn = new SqlConnection(dsn))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("ID", id);

                SqlDataReader read = cmd.ExecuteReader();

                if (read.Read())
                {
                    Charge result = new Charge()
                    {
                        ChargeID = Convert.ToInt32(read["Charge_ID"]),
                        UORCode = read["UOR_Code"].ToString(),
                        Description = read["Description"].ToString(),
                    };

                    return result;
                }
            }

            return null;
        }
示例#4
0
文件: Case.cs 项目: jblackett/RJLou
        internal void DeleteCharge(Charge charge)
        {
            string sql = @"
                DELETE FROM Case_Charge
                WHERE       Case_ID = @CaseID
                AND         Charge_ID = @ChargeID";

            using (SqlConnection conn = new SqlConnection(Constants.DSN))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("CaseID", CaseID);
                cmd.Parameters.AddWithValue("ChargeID", charge.ChargeID);

                cmd.ExecuteNonQuery();
            }
        }
示例#5
0
文件: Case.cs 项目: jblackett/RJLou
        internal void AddCharge(Charge charge)
        {
            string sql = @"
                INSERT INTO Case_Charge (Case_ID, Charge_ID)
                VALUES                  (@CaseID, @ChargeID)";

            using (SqlConnection conn = new SqlConnection(Constants.DSN))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("CaseID", CaseID);
                cmd.Parameters.AddWithValue("ChargeID", charge.ChargeID);

                cmd.ExecuteNonQuery();
            }
        }