예제 #1
0
        public static MaskType PopulateMaskTypeFromSqlDataReader(SqlDataReader dr)
        {
            MaskType maskType = new MaskType();

            maskType.ID = Convert.ToInt32(dr["ID"]);
            maskType.Type = Convert.ToString(dr["Type"]);
            maskType.Description = Convert.ToString(dr["Description"]);

            return maskType;
        }
예제 #2
0
        public void AddMaskType(MaskType MaskType)
        {
            // Initialize SPROC
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand cmd = new SqlCommand("SPMaskTypeInsert", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            // Add Parameters
            cmd.Parameters.AddWithValue("@Type", MaskType.Type);
            cmd.Parameters.AddWithValue("@Description", MaskType.Description);

            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            reload();
        }
예제 #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     //Save
     MaskType mt = new MaskType();
     if (edit == false)
     {
         mt.Type = comboBox1.SelectedItem.ToString();
         mt.Description = textBox1.Text.ToString();
         ml.AddMaskType(mt);
         comboBox1.DataSource = dotType;
         textBox1.Text = "";
     }
     else
     {
         mt.ID = MaskID;
         mt.Type = comboBox1.SelectedItem.ToString();
         mt.Description = textBox1.Text.ToString();
         ml.UpdateMaskType(mt);
         this.Close();
     }
 }