コード例 #1
0
        public static bool AddPermitFormScreenDesignTemplate(PermitFormScreenDesignTemplateBE o, out int id)
        {
            bool success = false;
            id = 0;
            using (SqlConnection conn = new SqlConnection(_connectionstring))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand("usp_PermitFormScreenDesignTemplate_Add", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                BusinessEntityHelper.ReplaceNullProperties<PermitFormScreenDesignTemplateBE>(o);
                FromPermitFormScreenDesignTemplateBE(ref cmd, o);
                cmd.Parameters.Add("ErrorOccured", SqlDbType.Bit);
                cmd.Parameters["ErrorOccured"].Direction = ParameterDirection.Output;
                cmd.Parameters["FormID"].Direction = ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                if (cmd.Parameters["ErrorOccured"].Value != DBNull.Value)
                {
                    success = Convert.ToBoolean(cmd.Parameters["ErrorOccured"].Value);
                }
                if (cmd.Parameters["FormID"].Value != DBNull.Value)
                {
                    id = Convert.ToInt32(cmd.Parameters["FormID"].Value);
                }
            }
            return success;
        }
コード例 #2
0
 private static void FromPermitFormScreenDesignTemplateBE(ref SqlCommand cmd, PermitFormScreenDesignTemplateBE o)
 {
     cmd.Parameters.AddWithValue("FormID", o.FormID);
     cmd.Parameters.AddWithValue("Design", o.Design);
     cmd.Parameters.AddWithValue("Description", o.Description);
     cmd.Parameters.AddWithValue("Active", o.Active);
     cmd.Parameters.AddWithValue("CreatedDateTime", o.CreatedDateTime);
     cmd.Parameters.AddWithValue("LastUpdatedDateTime", o.LastUpdatedDateTime);
     cmd.Parameters.AddWithValue("CreatedBy", o.CreatedBy);
     cmd.Parameters.AddWithValue("UpdatedBy", o.UpdatedBy);
 }
コード例 #3
0
 private static PermitFormScreenDesignTemplateBE ToPermitFormScreenDesignTemplateBE(SqlDataReader sqlDataReader)
 {
     PermitFormScreenDesignTemplateBE designTemplate = new PermitFormScreenDesignTemplateBE();
     designTemplate.FormID = Convert.ToInt32(sqlDataReader["FormID"]);
     designTemplate.Design = Convert.ToString(sqlDataReader["Design"]);
     designTemplate.Description = Convert.ToString(sqlDataReader["Description"]);
     designTemplate.Active = Convert.ToBoolean(sqlDataReader["Active"]);
     designTemplate.CreatedDateTime = Convert.ToDateTime(sqlDataReader["CreatedDateTime"]);
     designTemplate.LastUpdatedDateTime = Convert.ToDateTime(sqlDataReader["LastUpdatedDateTime"]);
     designTemplate.UpdatedBy = Convert.ToString(sqlDataReader["UpdatedBy"]);
     designTemplate.CreatedBy = Convert.ToString(sqlDataReader["CreatedBy"]);
     return designTemplate;
 }
コード例 #4
0
        public static PermitFormScreenDesignTemplateBE FetchPermitFormScreenDesignTemplate(int formId)
        {
            PermitFormScreenDesignTemplateBE o = null;

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

                SqlCommand cmd = new SqlCommand("usp_PermitFormScreenDesignTemplate_Fetch", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("FormID", formId);
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.Read())
                        o = ToPermitFormScreenDesignTemplateBE(reader);
                }
            }
            return o;
        }