コード例 #1
0
ファイル: QuotationDb.cs プロジェクト: sifayideenjs/SXaYmZple
        //internal IEnumerable<UserDetail> GetUserDetails(string userId)
        //{
        //    List<UserDetail> userDetails = new List<UserDetail>();

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

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

        //    if (dataSet != null)
        //    {
        //        var dataTable = dataSet.Tables[0];
        //        userDetails = dataTable.AsEnumerable().Select(row =>
        //                        new UserDetail
        //                        {
        //                            UserID = (int)row.Field<long>("UserID"),
        //                            UserName = row.Field<string>("UserName"),
        //                            Password = row.Field<string>("Password"),
        //                            CreatedBy = row.Field<string>("CreatedBy"),
        //                            CreatedDate = row.Field<DateTime?>("CreatedDate"),
        //                            LastUpdatedBy = row.Field<string>("LastUpdatedBy"),
        //                            LastUpdatedDate = row.Field<DateTime?>("LastUpdatedDate")
        //                        }).ToList();
        //    }

        //    return userDetails;
        //}

        internal ErrorDetail UpdateOwnerDetails(OwnerDetail ownerDetail, string flag)
        {
            Dictionary <string, SqlParameter> cmdParameters = new Dictionary <string, SqlParameter>();

            cmdParameters["@Flag"]              = new SqlParameter("@Flag", flag);
            cmdParameters["@Name"]              = new SqlParameter("@Name", ownerDetail.Name);
            cmdParameters["@NRIC"]              = new SqlParameter("@NRIC", ownerDetail.NRIC);
            cmdParameters["@Contact"]           = new SqlParameter("@Contact", ownerDetail.Contact);
            cmdParameters["@BizRegNo"]          = new SqlParameter("@BizRegNo", ownerDetail.BizRegNo);
            cmdParameters["@DateOfBirth"]       = new SqlParameter("@DateOfBirth", ownerDetail.DateOfBirth);
            cmdParameters["@Gender"]            = new SqlParameter("@Gender", ownerDetail.Gender);
            cmdParameters["@MaritalStatus"]     = new SqlParameter("@MaritalStatus", ownerDetail.MaritalStatus);
            cmdParameters["@Occupation"]        = new SqlParameter("@Occupation", ownerDetail.Occupation);
            cmdParameters["@Industry"]          = new SqlParameter("@Industry", ownerDetail.Industry);
            cmdParameters["@LicenseDate"]       = new SqlParameter("@LicenseDate", ownerDetail.LicenseDate);
            cmdParameters["@Email"]             = new SqlParameter("@Email", ownerDetail.Email);
            cmdParameters["@Address"]           = new SqlParameter("@Address", ownerDetail.Address);
            cmdParameters["@RenewalRemindDays"] = new SqlParameter("RenewalRemindDays", ownerDetail.RenewalRemindDays);
            cmdParameters["@LogUser"]           = new SqlParameter("@LogUser", ownerDetail.CreatedBy);

            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.UpdateOwnerDetails", cmdParameters);
            //if (dataSet != null && dataSet.Tables.Count > 1)
            //{
            //    var dataTable = dataSet.Tables[0];
            //    errorDetail.Code = dataTable.Rows[0].Field<int>("@ERRORNO");
            //    errorDetail.Info = dataTable.Rows[0].Field<string>("@ERRORDESC");
            //}

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

            return(errorDetail);
        }
コード例 #2
0
ファイル: LicenseDb.cs プロジェクト: sifayideenjs/SXaYmZple
        internal bool UpdateLicense(int userId, string encryptedLicenseDetail)
        {
            Dictionary <string, SqlParameter> cmdParameters = new Dictionary <string, SqlParameter>();

            cmdParameters["UserID"]        = new SqlParameter("UserID", userId);
            cmdParameters["LiceseDetails"] = new SqlParameter("LiceseDetails", encryptedLicenseDetail);

            var result = dbutility.ExecuteNonQuery("QuotationDb", "dbo.UpdateLicense", cmdParameters);

            return(result == 1 ? true : false);
        }
コード例 #3
0
        internal ErrorDetail UpdateUser(UserDetail userDetail, string flag, string userName)
        {
            Dictionary <string, SqlParameter> cmdParameters = new Dictionary <string, SqlParameter>();

            cmdParameters["UserID"]   = new SqlParameter("UserID", userDetail.UserID);
            cmdParameters["UserName"] = new SqlParameter("UserName", userDetail.UserName);
            cmdParameters["Name"]     = new SqlParameter("Name", userDetail.Name);
            cmdParameters["Password"] = new SqlParameter("Password", CryptographyUtility.EncryptPassword(userDetail.Password, userDetail.UserName));
            cmdParameters["GroupID"]  = new SqlParameter("GroupID", userDetail.GroupID);
            cmdParameters["Flag"]     = new SqlParameter("Flag", flag);
            cmdParameters["LogUser"]  = new SqlParameter("LogUser", userName);

            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.UpdateUser", cmdParameters);

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

            return(errorDetail);
        }