Esempio n. 1
0
 public virtual bool Insert(SMC_UserList userlist)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_UserList"))
         {
             int max_id = autoDao.GetMaxID("SMC_UserList");
             userlist.UL_ID = max_id + 1;
         }
         else
         {
             userlist.UL_ID = 1;
         }
         int i = SMC_UserListDao.Insert(userlist);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_UserList");
         }
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
Esempio n. 2
0
 public virtual bool Insert(SMC_Unit unit)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         //if (autoDao.HasMaxID("SMC_Unit"))
         //{
         //    int max_id = autoDao.GetMaxID("SMC_Unit");
         //    unit.Unit_ID = max_id + 1;
         //}
         //else
         //{
         //    unit.Unit_ID = 1;
         //}
         int i = SMC_UnitDao.Insert(unit);
         if (i > 0)
         {
             //autoDao.UpdateMaxID("SMC_Unit");
         }
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
Esempio n. 3
0
        public virtual bool Insert(SMC_BUAUserSyncToInside unit)
        {
            try
            {
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                if (autoDao.HasMaxID("SMC_BUAUserSyncToInside"))
                {
                    int max_id = autoDao.GetMaxID("SMC_BUAUserSyncToInside");
                    unit.busi_id = max_id + 1;
                }
                else
                {
                    unit.busi_id = 1;
                }
                int i = SMC_BUAUserSyncToInsideDao.Insert(unit);

                autoDao.UpdateMaxID("SMC_BUAUserSyncToInside");

                return(i > 0);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法Insert失败", ex);
            }
        }
Esempio n. 4
0
 public virtual bool Insert(SMC_Role role)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_Role"))
         {
             int max_id = autoDao.GetMaxID("SMC_Role");
             role.Role_ID = max_id + 1;
         }
         else
         {
             role.Role_ID = 1;
         }
         int i = SMC_RoleDao.Insert(role);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_Role");
         }
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
Esempio n. 5
0
        public virtual bool Insert(SMC_PackageExtSyncToOutside unit)
        {
            try
            {
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                //获取batchNo

                //int bat_no = autoDao.GetMaxID("SMC_PackageExtSyncToOutside", "sync_bat_no");
                //bat_no++;
                int maxid = this.SMC_PackageExtSyncToOutsideDao.GetMaxId("SMC_PackageExtSyncToOutside");
                //if (autoDao.HasMaxID("SMC_PackageExtSyncToOutside"))
                //{
                //    int max_id = autoDao.GetMaxID("SMC_PackageExtSyncToOutside");
                //    unit.peso_id = max_id + 1;
                //    //unit.sync_bat_no = bat_no;
                //}
                //else
                //{
                //    unit.peso_id = 1;
                //    //unit.sync_bat_no = bat_no;
                //}
                maxid        = maxid + 1;
                unit.peso_id = maxid;
                int i = SMC_PackageExtSyncToOutsideDao.Insert(unit);

                autoDao.UpdateMaxID("SMC_PackageExtSyncToOutside");

                return(i > 0);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法Insert失败", ex);
            }
        }
Esempio n. 6
0
        public virtual bool InsertOrUpdate(SMC_PackageExtSyncToOutside unit)
        {
            try
            {
                int i = 0;
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                //int max_batno = 1;
                //if (autoDao.HasMaxID("sync_bat_no"))
                //{
                //    max_batno = autoDao.GetMaxID("sync_bat_no");
                //}

                if (SMC_PackageExtSyncToOutsideDao.Get(unit.peso_id) == null)
                {
                    if (autoDao.HasMaxID("SMC_PackageExtSyncToOutside"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_PackageExtSyncToOutside");
                        unit.pe_id = max_id + 1;
                    }
                    else
                    {
                        unit.pe_id = 1;
                    }
                    //unit.sync_bat_no = max_batno;
                    i = SMC_PackageExtSyncToOutsideDao.Insert(unit);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_PackageExtSyncToOutside");
                    }
                }
                else
                {
                    i = SMC_PackageExtSyncToOutsideDao.Update(unit);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
Esempio n. 7
0
        public virtual bool InsertOrUpdate(SMC_BUAUserSyncToInside unit)
        {
            try
            {
                int i = 0;
                if (SMC_BUAUserSyncToInsideDao.Get(unit.busi_id) == null)
                {
                    //i = SMC_UnitDao.Insert(unit);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_BUAUserSyncToInside"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_BUAUserSyncToInside");
                        unit.busi_id = max_id + 1;
                    }
                    else
                    {
                        unit.busi_id = 1;
                    }
                    i = SMC_BUAUserSyncToInsideDao.Insert(unit);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_BUAUserSyncToInside");
                    }
                }
                else
                {
                    i = SMC_BUAUserSyncToInsideDao.Update(unit);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
Esempio n. 8
0
        public virtual bool InsertOrUpdate(SMC_FunctionRole functionRole)
        {
            try
            {
                int i = 0;
                if (!SMC_FunctionRoleDao.Exists(functionRole.FR_ID) && !SMC_FunctionRoleDao.Exists(functionRole.FN_ID, functionRole.Role_ID))
                {
                    //i = SMC_FunctionRoleDao.Insert(functionRole);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_FunctionRole"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_FunctionRole");
                        functionRole.FR_ID = max_id + 1;
                    }
                    else
                    {
                        functionRole.FR_ID = 1;
                    }
                    i = SMC_FunctionRoleDao.Insert(functionRole);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_FunctionRole");
                    }
                }
                else
                {
                    i = SMC_FunctionRoleDao.Update(functionRole);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
Esempio n. 9
0
        public virtual bool InsertOrUpdate(SMC_User userList)
        {
            try
            {
                //IUserService us = Beyondbit.BUA.Client.ServiceFactory.Instance().GetUserService();
                //IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                //Beyondbit.BUA.Client.User usr = null;
                //try
                //{
                //    usr = us.GetUserInfo(userList.UL_UID);
                //}
                //catch
                //{
                //}

                ////Beyondbit.BUA.Client.User[] _users = us.QueryUsersByObjectCode(ObjectType.User, userList.UL_UID);
                //if (usr == null)
                //{
                //    //新增用户到统一授权
                //    Beyondbit.BUA.Client.User u = new Beyondbit.BUA.Client.User();
                //    u.UserUid = userList.UL_UID;
                //    u.UserName = userList.UL_Name;
                //    u.UserFullName = userList.UL_Name;
                //    u.UserEmail = userList.UL_MailAddress == null ? "" : userList.UL_MailAddress;
                //    u.UserPersonal = new UserPersonal();
                //    u.UserPersonal.UserMobilePhone = userList.UL_MobilePhone;
                //    u.UnitCode = userList.Unit_ID;
                //    u.OrgCode = userList.Unit_ID;
                //    u.UserPassword = userList.UL_PWD;
                //    us.AddUser(u);
                //}
                //else
                //{
                //}
                int i = 0;
                if (SMC_UserDao.Get(userList.U_ID) == null)
                {
                    //i = SMC_UserListDao.Insert(userList);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_User"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_User");
                        userList.U_ID = max_id + 1;
                    }
                    else
                    {
                        userList.U_ID = 1;
                    }
                    i = SMC_UserDao.Insert(userList);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_User");
                    }
                }
                else
                {
                    i = SMC_UserDao.Update(userList);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
Esempio n. 10
0
        public virtual bool InsertOrUpdate(SMC_Unit unit)
        {
            try
            {
                int i = 0;
                if (SMC_UnitDao.Get(unit.Unit_ID) == null)
                {
                    //i = SMC_UnitDao.Insert(unit);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    //if (autoDao.HasMaxID("SMC_Unit"))
                    //{
                    //    int max_id = autoDao.GetMaxID("SMC_Unit");
                    //    unit.Unit_ID = max_id + 1;
                    //}
                    //else
                    //{
                    //    unit.Unit_ID = 1;
                    //}
                    Beyondbit.BUA.Client.Org org = new Beyondbit.BUA.Client.Org();
                    org.OrgName = unit.Unit_Name;
                    org.OrgType = "Unit_Org";

                    Beyondbit.BUA.Client.IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();

                    if (String.IsNullOrEmpty(unit.Upper_Unit_ID))
                    {
                        Beyondbit.BUA.Client.Org topOrg = null;
                        try
                        {
                            topOrg = os.GetTopOrg();
                        }
                        catch (Exception ex)
                        {
                            throw new BOException("调用统一授权接口失败:" + ex.Message, ex);
                        }
                        org.ParentOrgCode = topOrg.OrgCode;
                        //org.OrgCode = NPinyin.Pinyin.GetInitials(unit.Unit_Name, System.Text.Encoding.UTF8);
                        org.OrgCode        = "smc_" + NPinyin.Pinyin.GetInitials(unit.Unit_Name, System.Text.Encoding.UTF8);
                        unit.Upper_Unit_ID = "";
                    }
                    else
                    {
                        org.ParentOrgCode = unit.Upper_Unit_ID;
                        //org.OrgCode = unit.Upper_Unit_ID + "_" + NPinyin.Pinyin.GetInitials(unit.Unit_Name, System.Text.Encoding.UTF8);
                        org.OrgCode = "smc_" + NPinyin.Pinyin.GetInitials(unit.Unit_Name, System.Text.Encoding.UTF8);
                    }

                    try
                    {
                        os.AddOrg(org);
                    }
                    catch (Exception ex)
                    {
                        throw new BOException("调用统一授权借口失败:" + ex.Message, ex);
                    }

                    unit.Unit_ID = org.OrgCode;

                    try
                    {
                        i = SMC_UnitDao.Insert(unit);
                    }
                    catch (Exception ex)
                    {
                        throw new BOException("调用方法InsertOrUpdate失败:" + ex.Message, ex);
                    }
                    if (true)
                    {
                        //autoDao.UpdateMaxID("SMC_Unit");
                    }
                }
                else
                {
                    Beyondbit.BUA.Client.IOrgService os  = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                    Beyondbit.BUA.Client.Org         org = os.GetOrgBaseInfo(Beyondbit.BUA.Client.ObjectType.Org, unit.Unit_ID);
                    org.OrgName = unit.Unit_Name;
                    os.ModiOrg(org);
                    unit.Unit_UpdateTime = DateTime.Now;

                    i = SMC_UnitDao.Update(unit);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
        public virtual bool InsertOrUpdate(SMC_BUAUserSyncToInside unit)
        {
            try
            {
                int i = 0;
                if (SMC_BUAUserSyncToInsideDao.Get(unit.busi_id) == null)
                {
                    //i = SMC_UnitDao.Insert(unit);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_BUAUserSyncToInside"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_BUAUserSyncToInside");
                        unit.busi_id = max_id + 1;
                    }
                    else
                    {
                        unit.busi_id = 1;
                    }
                    i = SMC_BUAUserSyncToInsideDao.Insert(unit);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_BUAUserSyncToInside");
                    }
                }
                else
                {
                    i = SMC_BUAUserSyncToInsideDao.Update(unit);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
        public virtual bool Insert(SMC_BUAUserSyncToInside unit)
        {
            try
            {
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                if (autoDao.HasMaxID("SMC_BUAUserSyncToInside"))
                {
                    int max_id = autoDao.GetMaxID("SMC_BUAUserSyncToInside");
                    unit.busi_id = max_id + 1;
                }
                else
                {
                    unit.busi_id = 1;
                }
                int i = SMC_BUAUserSyncToInsideDao.Insert(unit);

                autoDao.UpdateMaxID("SMC_BUAUserSyncToInside");

                return i > 0;
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法Insert失败", ex);
            }
        }
 public virtual bool Insert(SMC_FunctionRole functionRole)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_FunctionRole"))
         {
             int max_id = autoDao.GetMaxID("SMC_FunctionRole");
             functionRole.FR_ID = max_id + 1;
         }
         else
         {
             functionRole.FR_ID = 1;
         }
         int i = SMC_FunctionRoleDao.Insert(functionRole);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_FunctionRole");
         }
         return i > 0;
     }
     catch (DalException ex)
     {
         throw new BOException("���÷���Insertʧ��", ex);
     }
 }
        public virtual bool Insert(SMC_PackageExtSyncToOutside unit)
        {
            try
            {
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                //获取batchNo

                //int bat_no = autoDao.GetMaxID("SMC_PackageExtSyncToOutside", "sync_bat_no");
                //bat_no++;
                int maxid = this.SMC_PackageExtSyncToOutsideDao.GetMaxId("SMC_PackageExtSyncToOutside");
                //if (autoDao.HasMaxID("SMC_PackageExtSyncToOutside"))
                //{
                //    int max_id = autoDao.GetMaxID("SMC_PackageExtSyncToOutside");
                //    unit.peso_id = max_id + 1;
                //    //unit.sync_bat_no = bat_no;
                //}
                //else
                //{
                //    unit.peso_id = 1;
                //    //unit.sync_bat_no = bat_no;
                //}
                maxid = maxid + 1;
                unit.peso_id = maxid;
                int i = SMC_PackageExtSyncToOutsideDao.Insert(unit);

                autoDao.UpdateMaxID("SMC_PackageExtSyncToOutside");

                return i > 0;
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法Insert失败", ex);
            }
        }
        public virtual bool InsertOrUpdate(SMC_UserList userList)
        {
            try
            {
                IUserService us = Beyondbit.BUA.Client.ServiceFactory.Instance().GetUserService();
                IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                Beyondbit.BUA.Client.User usr = null;
                try
                {
                    usr = us.GetUserInfo(userList.UL_UID);
                }
                catch
                {
                }

                //Beyondbit.BUA.Client.User[] _users = us.QueryUsersByObjectCode(ObjectType.User, userList.UL_UID);
                if (usr == null)
                {
                    try
                    {
                        //�����û���ͳһ��Ȩ
                        Beyondbit.BUA.Client.User u = new Beyondbit.BUA.Client.User();
                        u.UserUid = userList.UL_UID;
                        u.UserName = userList.UL_Name;
                        u.UserFullName = userList.UL_Name;
                        u.UserEmail = userList.UL_MailAddress == null ? "" : userList.UL_MailAddress;
                        u.UserPersonal = new UserPersonal();
                        u.UserPersonal.UserMobilePhone = userList.UL_MobilePhone;
                        u.UnitCode = userList.Unit_ID;
                        u.OrgCode = userList.Unit_ID;
                        u.UserPassword = userList.UL_PWD;
                        us.AddUser(u);
                    }
                    catch (Exception exe)
                    {
                    }
                }
                else
                {
                }

                int i = 0;
                if (SMC_UserListDao.Get(userList.UL_ID) == null)
                {
                    //i = SMC_UserListDao.Insert(userList);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_UserList"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_UserList");
                        userList.UL_ID = max_id + 1;
                    }
                    else
                    {
                        userList.UL_ID = 1;
                    }
                    i = SMC_UserListDao.Insert(userList);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_UserList");
                    }
                }
                else
                {
                    i = SMC_UserListDao.Update(userList);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("���÷���InsertOrUpdateʧ��", ex);
            }
        }
 public virtual bool Insert(SMC_UserList userlist)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_UserList"))
         {
             int max_id = autoDao.GetMaxID("SMC_UserList");
             userlist.UL_ID = max_id + 1;
         }
         else
         {
             userlist.UL_ID = 1;
         }
         int i = SMC_UserListDao.Insert(userlist);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_UserList");
         }
         return i > 0;
     }
     catch (DalException ex)
     {
         throw new BOException("���÷���Insertʧ��", ex);
     }
 }
        public virtual bool InsertOrUpdate(SMC_FunctionRole functionRole)
        {
            try
            {
                int i = 0;
                if (!SMC_FunctionRoleDao.Exists(functionRole.FR_ID) && !SMC_FunctionRoleDao.Exists(functionRole.FN_ID, functionRole.Role_ID))
                {
                    //i = SMC_FunctionRoleDao.Insert(functionRole);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_FunctionRole"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_FunctionRole");
                        functionRole.FR_ID = max_id + 1;
                    }
                    else
                    {
                        functionRole.FR_ID = 1;
                    }
                    i = SMC_FunctionRoleDao.Insert(functionRole);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_FunctionRole");
                    }
                }
                else
                {
                    i = SMC_FunctionRoleDao.Update(functionRole);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("���÷���InsertOrUpdateʧ��", ex);
            }
        }
        public virtual bool InsertOrUpdate(SMC_PackageExtSyncToOutside unit)
        {
            try
            {
                int i = 0;
                SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                //int max_batno = 1;
                //if (autoDao.HasMaxID("sync_bat_no"))
                //{
                //    max_batno = autoDao.GetMaxID("sync_bat_no");
                //}

                if (SMC_PackageExtSyncToOutsideDao.Get(unit.peso_id) == null)
                {

                    if (autoDao.HasMaxID("SMC_PackageExtSyncToOutside"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_PackageExtSyncToOutside");
                        unit.pe_id = max_id + 1;
                    }
                    else
                    {
                        unit.pe_id = 1;
                    }
                    //unit.sync_bat_no = max_batno;
                    i = SMC_PackageExtSyncToOutsideDao.Insert(unit);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_PackageExtSyncToOutside");
                    }
                }
                else
                {
                    i = SMC_PackageExtSyncToOutsideDao.Update(unit);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
Esempio n. 19
0
        public virtual bool InsertOrUpdate(SMC_Role role)
        {
            try
            {
                int i = 0;
                if (SMC_RoleDao.Get(role.Role_ID) == null)
                {
                    //i = SMC_RoleDao.Insert(role);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_Role"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_Role");
                        role.Role_ID = max_id + 1;
                    }
                    else
                    {
                        role.Role_ID = 1;
                    }
                    i = SMC_RoleDao.Insert(role);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_Role");
                    }
                }
                else
                {
                    i = SMC_RoleDao.Update(role);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("���÷���InsertOrUpdateʧ��", ex);
            }
        }