示例#1
0
 public System.Int32 AddSysAccount(SysAccountData data)
 {
     try
     {
         var domain = new SysAccountDomainObject(ConnectionString);
         return domain.Add(data);
     }
     catch (Exception ex)
     {
         ErrorLog.Log("[AddSysAccount]", ex.Message);
     }
     return -1;
 }
        public virtual System.Int32 Add(SysAccountData obj)
        {
            JDataAccess dao = new JDataAccess(ConnectionString);
            dao.SetCommandText(SP_SYSACCOUNT_INSERT, CommandType.StoredProcedure);
            dao.SetParameters(new IDataParameter[]{
                dao.CreateParameter("@ID", obj.ID),
                dao.CreateParameter("@Username", obj.Username),
                dao.CreateParameter("@Password", obj.Password),
                dao.CreateParameter("@RealName", obj.RealName),
                dao.CreateParameter("@Email", obj.Email),
                dao.CreateParameter("@ID_DonVis", obj.ID_DonVis),
                dao.CreateParameter("@LastAccess", obj.LastAccess),
                dao.CreateParameter("@Active", obj.Active),
                dao.CreateParameter("@AccountType", obj.AccountType),
                dao.CreateParameter("@Creator_ID", obj.Creator_ID),
                dao.CreateParameter("@ID_DonViGoc", obj.ID_DonViGoc),
                dao.CreateParameter("@IsUpdate", obj.IsUpdate)

            });
            return dao.SubmitChange();
        }
        protected virtual SysAccountData Convert(DataRow row)
        {
            dynamic data = new DynamicDataRow(row);

            SysAccountData obj = new SysAccountData();

            obj.ID = System.Convert.ToInt32(data.ID);
            obj.Username = System.Convert.ToString(data.Username);
            obj.Password = System.Convert.ToString(data.Password);
            obj.RealName = System.Convert.ToString(data.RealName);
            obj.Email = System.Convert.ToString(data.Email);
            obj.ID_DonVis = System.Convert.ToString(data.ID_DonVis);
            obj.LastAccess = data.LastAccess != null ? System.Convert.ToDateTime(data.LastAccess) : (DateTime?)null;
            obj.Active = System.Convert.ToBoolean(data.Active);
            obj.AccountType = System.Convert.ToByte(data.AccountType);
            obj.Creator_ID = System.Convert.ToInt32(data.Creator_ID);
            obj.ID_DonViGoc = System.Convert.ToInt32(data.ID_DonViGoc);
            obj.IsUpdate = System.Convert.ToBoolean(data.IsUpdate);

            return obj;
        }