/// <summary> /// ���캯�� /// </summary> private User() { name = String.Empty; email = String.Empty; password = String.Empty; telephone = String.Empty; cellphone = String.Empty; joinDate = DateTime.Now; status = UserStatus.Normal; payModeCollection = null; activePayMode = null; }
/// <summary> /// ������ϵ����Ϣ /// </summary> private void DoSaveContactInfo() { string _name = request.Form["cname"] == null ? "" : request.Form["cname"].Trim(); string _telephone = request.Form["telephone"] == null ? "" : request.Form["telephone"].Trim(); string _cellphone = request.Form["cellphone"] == null ? "" : request.Form["cellphone"].Trim(); bool _userSave = false; int _payId = 0; if (UserCookieInfo.Get() == null) { return; } int _uid=UserCookieInfo.Get().Id; User u = new User(_uid); u.Name = _name; u.Telephone = _telephone; u.Cellphone = _cellphone; _userSave = u.Update(); if (!_userSave) { return; } _payId = request.Form["paymentModeId"] == null ? 0 : Convert.ToInt32(request.Form["paymentModeId"]); PaymentModeEnum payModeEnum = request.Form["paymentMode"] == null ? PaymentModeEnum.PostOffice : (PaymentModeEnum)(Convert.ToInt16(request.Form["paymentMode"])); PayMode payMode = new PayMode(payModeEnum, _uid, "�ʾֻ����Ϣ"); PaymentModeDetails _details=null; switch (payModeEnum) { case PaymentModeEnum.PostOffice: _details = new PaymentModePostOffice(); ((PaymentModePostOffice)_details).Name = request.Form["payName"] == null ? "" : request.Form["payName"].Trim(); ((PaymentModePostOffice)_details).Phone = request.Form["payPhone"] == null ? "" : request.Form["payPhone"].Trim(); ((PaymentModePostOffice)_details).Address = request.Form["payAddress"] == null ? "" : request.Form["payAddress"].Trim(); ((PaymentModePostOffice)_details).Postcode = request.Form["payPostcode"] == null ? "" : request.Form["payPostcode"].Trim(); break; case PaymentModeEnum.Online: _details = new PaymentModeOnline(); ((PaymentModeOnline)_details).Provider = request.Form["payProvider"] == null ? "" : request.Form["payProvider"].Trim(); ((PaymentModeOnline)_details).UserId = request.Form["payUserId"] == null ? "" : request.Form["payUserId"].Trim(); break; case PaymentModeEnum.ElectricityBill: _details = new PaymentModeElectricityBill(); ((PaymentModeElectricityBill)_details).Bank = request.Form["payBank"] == null ? "" : request.Form["payBank"].Trim(); ((PaymentModeElectricityBill)_details).BankName = request.Form["payBankName"] == null ? "" : request.Form["payBankName"].Trim(); ((PaymentModeElectricityBill)_details).CardNumber = request.Form["payCardNumber"] == null ? "" : request.Form["payCardNumber"].Trim(); ((PaymentModeElectricityBill)_details).Name = request.Form["payName"] == null ? "" : request.Form["payName"].Trim(); break; } if (_details != null) { payMode.Details = _details; } payMode.IsActive = true; payMode.Save(_payId); Html.Append("true"); }
/// <summary> /// ��ȡָ���û���֧����ʽ���� /// </summary> /// <param name="uid">�û�ID</param> /// <returns></returns> public static List<PayMode> List(int uid) { /* [INV_PayModeList] @uid int */ //[Id],[UserId],[Title],[Mode],[Details],[IsActive] List<PayMode> list = new List<PayMode>(); PayMode pm; using (SqlDataReader reader = Database.ExecuteReader(CommandType.StoredProcedure, "INV_PayModeList", new SqlParameter[] { Database.MakeInParam("@uid", SqlDbType.Int, uid) })) { while (reader.Read()) { pm = new PayMode(); pm.id = reader.GetInt32(0); pm.userId = reader.GetInt32(1); pm.title = reader.GetString(2); pm.mode = (PaymentModeEnum)(reader.GetInt16(3)); pm.InitDetails(reader.GetString(4)); pm.isActive = reader.GetBoolean(5); list.Add(pm); } reader.Close(); } return list; }
/// <summary> /// ��ȡ����ID��UserId��֧����ʽ /// </summary> /// <param name="uid">�û�ID</param> /// <param name="id">֧����ʽID</param> /// <returns></returns> public static PayMode Get(int uid,int id) { /* [INV_PayModeGet] @uid int=0, @id int */ //[Id],[UserId],[Title],[Mode],[Details],[IsActive] PayMode pm = null; using (SqlDataReader reader = Database.ExecuteReader(CommandType.StoredProcedure, "INV_PayModeGet", new SqlParameter[] { Database.MakeInParam("@uid",SqlDbType.Int,uid), Database.MakeInParam("@id",SqlDbType.Int,id) })) { if (reader.Read()) { pm = new PayMode(); pm.id = reader.GetInt32(0); pm.userId = reader.GetInt32(1); pm.title = reader.GetString(2); pm.mode = (PaymentModeEnum)(reader.GetInt16(3)); pm.InitDetails(reader.GetString(4)); pm.isActive = reader.GetBoolean(5); } reader.Close(); } return pm; }