Ejemplo n.º 1
0
        internal IEnumerable <OwnerDetail> GetAllOwnerDetails()
        {
            List <OwnerDetail> ownerDetails = new List <OwnerDetail>();

            Dictionary <string, SqlParameter> queryParameters = new Dictionary <string, SqlParameter>();
            DataSet dataSet = dbutility.ExecuteQuery("QuotationDb", "dbo.GetAllOwnerDetails", queryParameters);

            if (dataSet != null)
            {
                var dataTable = dataSet.Tables[0];
                ownerDetails = dataTable.AsEnumerable().Select(row =>
                                                               new OwnerDetail
                {
                    Name              = row.Field <string>("Name"),
                    NRIC              = row.Field <string>("NRIC"),
                    DateOfBirth       = row.Field <DateTime?>("DateOfBirth"),
                    Gender            = row.Field <string>("Gender"),
                    MaritalStatus     = row.Field <string>("MaritalStatus"),
                    Occupation        = row.Field <string>("Occupation"),
                    LicenseDate       = row.Field <DateTime?>("LicenseDate"),
                    CreatedBy         = row.Field <string>("CreatedBy"),
                    CreatedDate       = row.Field <DateTime?>("CreatedDate"),
                    LastUpdatedBy     = row.Field <string>("LastUpdatedBy"),
                    LastUpdatedDate   = row.Field <DateTime?>("LastUpdatedDate"),
                    Email             = row.Field <string>("Email"),
                    Address           = row.Field <string>("Address"),
                    RenewalRemindDays = row.Field <short?>("RenewalRemindDays"),
                }).ToList();
            }

            return(ownerDetails);
        }
Ejemplo n.º 2
0
        //internal ErrorDetail UpdateGroupFormRights(IEnumerable<GroupFormRight> groupFormRights)
        //{
        //    DataTable dataTable = new DataTable();
        //    //dataTable.Columns.Add("GroupID", typeof(int));
        //    dataTable.Columns.Add("FormID", typeof(int));
        //    dataTable.Columns.Add("Options", typeof(string));

        //    foreach (var groupFormRight in groupFormRights)
        //    {
        //        dataTable.Rows.Add(groupFormRight.GroupID, groupFormRight.FormID, groupFormRight.Options);
        //    }

        //    Dictionary<string, SqlParameter> cmdParameters = new Dictionary<string, SqlParameter>();
        //    cmdParameters["GroupFormRightsDT"] = new SqlParameter("GroupFormRightsDT", dataTable);

        //    SqlParameter outPutParameter1 = new SqlParameter();
        //    outPutParameter1.ParameterName = "@ERRORNO";
        //    outPutParameter1.SqlDbType = System.Data.SqlDbType.Int;
        //    outPutParameter1.Size = 255;
        //    outPutParameter1.Direction = System.Data.ParameterDirection.Output;
        //    cmdParameters["@ERRORNO"] = outPutParameter1;

        //    SqlParameter outPutParameter2 = new SqlParameter();
        //    outPutParameter2.ParameterName = "@ERRORDESC";
        //    outPutParameter2.SqlDbType = System.Data.SqlDbType.VarChar;
        //    outPutParameter2.Size = 255;
        //    outPutParameter2.Direction = System.Data.ParameterDirection.Output;
        //    cmdParameters["@ERRORDESC"] = outPutParameter2;

        //    ErrorDetail errorDetail = new ErrorDetail();
        //    dbutility.ExecuteNonQuery("QuotationDb", "dbo.UpdateGroupFormRights", cmdParameters);

        //    errorDetail.Code = int.Parse(outPutParameter1.Value.ToString());
        //    errorDetail.Info = outPutParameter2.Value.ToString();

        //    return errorDetail;
        //}

        internal DataSet GetGroupDetails(string groupId)
        {
            Dictionary <string, SqlParameter> cmdParameters = new Dictionary <string, SqlParameter>();

            cmdParameters["GroupID"] = new SqlParameter("GroupID", groupId);

            SqlParameter outPutParameter1 = new SqlParameter();

            outPutParameter1.ParameterName = "@ERRORNO";
            outPutParameter1.SqlDbType     = System.Data.SqlDbType.Int;
            outPutParameter1.Size          = 255;
            outPutParameter1.Direction     = System.Data.ParameterDirection.Output;
            cmdParameters["@ERRORNO"]      = outPutParameter1;

            SqlParameter outPutParameter2 = new SqlParameter();

            outPutParameter2.ParameterName = "@ERRORDESC";
            outPutParameter2.SqlDbType     = System.Data.SqlDbType.VarChar;
            outPutParameter2.Size          = 255;
            outPutParameter2.Direction     = System.Data.ParameterDirection.Output;
            cmdParameters["@ERRORDESC"]    = outPutParameter2;

            DataSet dataSet = dbutility.ExecuteQuery("QuotationDb", "dbo.GetGroupDetails", cmdParameters);

            return(dataSet);
        }
Ejemplo n.º 3
0
        internal Dictionary <string, string> GetLicenseDetails()
        {
            Dictionary <string, string>       result        = null;
            Dictionary <string, SqlParameter> cmdParameters = new Dictionary <string, SqlParameter>();

            DataSet dataSet = dbutility.ExecuteQuery("QuotationDb", "dbo.GetLicenseDetails", cmdParameters);

            if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
            {
                result = CryptographyUtility.DecryptLicense(dataSet.Tables[0]);
            }

            return(result);
        }
Ejemplo n.º 4
0
        public void ExecuteQuery()
        {
            // add a customer
            Dictionary<string, SqlParameter> cmdParameters = new Dictionary<string, SqlParameter>();
            cmdParameters["name"] = new SqlParameter("name", "Smith");
            cmdParameters["state"] = new SqlParameter("state", "MD");
            SqlDatabaseUtility.ExecuteCommand("mssqltips", "dbo.AddCustomer", cmdParameters);

            // query the customer table
            Dictionary<string, SqlParameter> queryParameters = new Dictionary<string, SqlParameter>();
            SqlDataReader reader = SqlDatabaseUtility.ExecuteQuery(
                "mssqltips", "dbo.GetCustomerList", queryParameters);
            while (reader.Read() == true)
            {
                Console.WriteLine(string.Format("{0}\t{1}\t{2}",
                    reader[0].ToString(),
                    reader[1].ToString(),
                    reader[2].ToString()));
            }
        }