public receipt Insert(receipt id)
        {
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_RECEIPT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Account_ID", id.Account_ID);
                cmd.Parameters.AddWithValue("@Check_Num", id.Check_Num);
                cmd.Parameters.AddWithValue("@DLN", id.DLN);
                cmd.Parameters.AddWithValue("@Phone", id.Phone);
                cmd.Parameters.AddWithValue("@Pay_Type", id.Pay_Type);
                cmd.Parameters.AddWithValue("@Amount", id.Amount);
                cmd.Parameters.AddWithValue("@Transfer", id.Transfer);
                cmd.Parameters.AddWithValue("@Recieve", id.Recieve);
                cmd.ExecuteReader();
                con.Close();
                con.Open();
                cmd             = new SqlCommand("SP_DMCS_GET_RECEIPT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Account_ID", id.Account_ID);
                cmd.Parameters.AddWithValue("@Check_Num", id.Check_Num);
                cmd.Parameters.AddWithValue("@DLN", id.DLN);
                cmd.Parameters.AddWithValue("@Phone", id.Phone);
                cmd.Parameters.AddWithValue("@Pay_Type", id.Pay_Type);
                cmd.Parameters.AddWithValue("@Amount", id.Amount);
                cmd.Parameters.AddWithValue("@Transfer", id.Transfer);
                cmd.Parameters.AddWithValue("@Recieve", id.Recieve);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    id.Receipt_ID = rdr.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                id.SetColumnDefaults();
            }
            finally
            {
                con.Close();
            }
            return(id);
        }
 public receipt Insert(receipt id)
 {
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_INSERT_RECEIPT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Account_ID", id.Account_ID);
     cmd.Parameters.AddWithValue("@Check_Num", id.Check_Num);
     cmd.Parameters.AddWithValue("@DLN", id.DLN);
     cmd.Parameters.AddWithValue("@Phone", id.Phone);
     cmd.Parameters.AddWithValue("@Pay_Type", id.Pay_Type);
     cmd.Parameters.AddWithValue("@Amount", id.Amount);
     cmd.Parameters.AddWithValue("@Transfer", id.Transfer);
     cmd.Parameters.AddWithValue("@Recieve", id.Recieve);
     cmd.ExecuteReader();
     con.Close();
     con.Open();
     cmd = new SqlCommand("SP_DMCS_GET_RECEIPT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Account_ID", id.Account_ID);
     cmd.Parameters.AddWithValue("@Check_Num", id.Check_Num);
     cmd.Parameters.AddWithValue("@DLN", id.DLN);
     cmd.Parameters.AddWithValue("@Phone", id.Phone);
     cmd.Parameters.AddWithValue("@Pay_Type", id.Pay_Type);
     cmd.Parameters.AddWithValue("@Amount", id.Amount);
     cmd.Parameters.AddWithValue("@Transfer", id.Transfer);
     cmd.Parameters.AddWithValue("@Recieve", id.Recieve);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         id.Receipt_ID = rdr.GetInt32(0);
     }
     }
     catch (Exception ex)
     {
     id.SetColumnDefaults();
     }
     finally
     {
     con.Close();
     }
     return id;
 }
 public receipt Select(int id)
 {
     receipt receipt = new receipt();
     string ConnectionString = IDManager.connection();
     SqlConnection con = new SqlConnection(ConnectionString);
     try
     {
     con.Open();
     SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_RECEIPT", con);
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@Receipt_ID", id);
     SqlDataReader rdr = cmd.ExecuteReader();
     if (rdr.HasRows)
     {
         rdr.Read();
         if (!rdr.IsDBNull(0))
         {
             receipt.Receipt_ID = rdr.GetInt32(0);
         }
         else
         {
             receipt.Receipt_ID = 0;
         }
         if (!rdr.IsDBNull(1))
         {
             receipt.Account_ID = rdr.GetInt32(1);
         }
         else
         {
             receipt.Account_ID = 0;
         }
         if (!rdr.IsDBNull(2))
         {
             receipt.Check_Num = rdr.GetInt32(2);
         }
         else
         {
             receipt.Check_Num = 0;
         }
         if (!rdr.IsDBNull(3))
         {
             receipt.DLN = rdr.GetInt32(3);
         }
         else
         {
             receipt.DLN = 0;
         }
         if (!rdr.IsDBNull(4))
         {
             receipt.Phone = rdr.GetInt32(4);
         }
         else
         {
             receipt.Phone = 0;
         }
         if (!rdr.IsDBNull(5))
         {
             receipt.Pay_Type = rdr.GetInt32(5);
         }
         else
         {
             receipt.Pay_Type = 0;
         }
         if (!rdr.IsDBNull(6))
         {
             receipt.Amount = rdr.GetInt32(6);
         }
         else
         {
             receipt.Amount = 0;
         }
         if (!rdr.IsDBNull(7))
         {
             receipt.Transfer = rdr.GetBoolean(7);
         }
         else
         {
             receipt.Transfer = false;
         }
         if (!rdr.IsDBNull(8))
         {
             receipt.Recieve = rdr.GetBoolean(8);
         }
         else
         {
             receipt.Recieve = false;
         }
         }
         else
         {
             receipt.SetColumnDefaults();
         }
     }
     catch (Exception ex)
     {
     receipt.SetColumnDefaults();
     return receipt;
     }
     finally
     {
     con.Close();
     }
     return receipt;
 }
        public receipt Select(int id)
        {
            receipt       receipt          = new receipt();
            string        ConnectionString = IDManager.connection();
            SqlConnection con = new SqlConnection(ConnectionString);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SP_DMCS_SELECT_RECEIPT", con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Receipt_ID", id);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (!rdr.IsDBNull(0))
                    {
                        receipt.Receipt_ID = rdr.GetInt32(0);
                    }
                    else
                    {
                        receipt.Receipt_ID = 0;
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        receipt.Account_ID = rdr.GetInt32(1);
                    }
                    else
                    {
                        receipt.Account_ID = 0;
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        receipt.Check_Num = rdr.GetInt32(2);
                    }
                    else
                    {
                        receipt.Check_Num = 0;
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        receipt.DLN = rdr.GetInt32(3);
                    }
                    else
                    {
                        receipt.DLN = 0;
                    }
                    if (!rdr.IsDBNull(4))
                    {
                        receipt.Phone = rdr.GetInt32(4);
                    }
                    else
                    {
                        receipt.Phone = 0;
                    }
                    if (!rdr.IsDBNull(5))
                    {
                        receipt.Pay_Type = rdr.GetInt32(5);
                    }
                    else
                    {
                        receipt.Pay_Type = 0;
                    }
                    if (!rdr.IsDBNull(6))
                    {
                        receipt.Amount = rdr.GetInt32(6);
                    }
                    else
                    {
                        receipt.Amount = 0;
                    }
                    if (!rdr.IsDBNull(7))
                    {
                        receipt.Transfer = rdr.GetBoolean(7);
                    }
                    else
                    {
                        receipt.Transfer = false;
                    }
                    if (!rdr.IsDBNull(8))
                    {
                        receipt.Recieve = rdr.GetBoolean(8);
                    }
                    else
                    {
                        receipt.Recieve = false;
                    }
                }
                else
                {
                    receipt.SetColumnDefaults();
                }
            }
            catch (Exception ex)
            {
                receipt.SetColumnDefaults();
                return(receipt);
            }
            finally
            {
                con.Close();
            }
            return(receipt);
        }