Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="roleIds"></param>
        /// <returns>成更新的条数</returns>
        public int UpdateMemberRole(int memberId, List <int> roleIds)
        {
            int    result = 0;
            string sql    = string.Format(" delete from MemberRole where MemberId={0} ", memberId);

            if (m_dbo.ExecuteNonQuery(sql))
            {
                foreach (int roleId in roleIds)
                {
                    MemberRole mr = new MemberRole();
                    mr.MemberId = memberId;
                    mr.RoleId   = roleId;
                    if (mr.Save() > 0)
                    {
                        result += 1;
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// 发送申请单邮件(可审核)
 /// </summary>
 /// <param name="applyId"></param>
 /// <param name="dt">该申请单是被谁审核的 管理员的表 </param>
 /// <returns></returns>
 public bool SendEmail(int applyId, int isPass)
 {
     if (applyId > 0)//申请单添加成功,审核消息发送给对应的管理员
     {
         //1、找到要发邮件的对应的人
         //通过ApplyId找到(新申请单生成)申请人,(审核过一级的)审核了一次的审核人
         VIPApply apply = new VIPApply(applyId);
         if (apply.Status == "待审核")
         {
             int            memberId = apply.OperatorId > 0 ? apply.OperatorId : apply.MemberId;
             VIPApplyOption option   = new VIPApplyOption();
             Member         member   = new Member();
             DataSet        ds       = member.GetDeptComIdByMemberId(memberId);
             option.ComId    = Convert.ToInt32(ds.Tables[0].Rows[0]["ComId"]);
             option.MemberId = memberId;
             option.RoleId   = 2;//成本中心管理员
             option.Code     = Convert.ToString(ds.Tables[0].Rows[0]["Code"]);
             VIPApplyManager vam       = new VIPApplyManager();
             DataSet         dsAdmin   = vam.GetAdmin(option);
             List <int>      memberIds = new List <int>();
             if (dsAdmin.Tables[0].Rows.Count > 0)
             {
                 int SendmemberId = Convert.ToInt32(dsAdmin.Tables[0].Rows[0]["MemberId"]);//上一级成本中心
                 memberIds.Add(SendmemberId);
             }
             //越级是 admin+sys_admin  逐级是admin
             if (isPass == 1)//越级
             {
                 MemberRole role        = new MemberRole();
                 DataSet    dsMemberIds = role.GetSysAdmin(option.ComId);//找到系统管理
                 if (dsMemberIds.Tables[0].Rows.Count > 0)
                 {
                     memberIds.Add(Convert.ToInt32(dsMemberIds.Tables[0].Rows[0]["MemberId"]));
                 }
             }
             if (memberIds.Count > 0)
             {
                 Memberinfocfg configure = new Memberinfocfg();
                 DataSet       dsEmail   = configure.GetIsPassAudit(memberIds);
                 if (dsEmail.Tables[0].Rows.Count > 0)
                 {
                     for (int i = 0; i < dsEmail.Tables[0].Rows.Count; i++)
                     {
                         if (dsEmail.Tables[0].Rows[i]["Type"].ToString() == "实时发送" && Convert.ToInt32(dsEmail.Tables[0].Rows[i]["Value"]) == 1)
                         {
                             string emailss = dsEmail.Tables[0].Rows[i]["Email"].ToString();
                             if (emailss != "")
                             {
                                 int mId = Convert.ToInt32(dsEmail.Tables[0].Rows[i]["MemberId"]);
                                 mailToArray = new string[] { emailss };
                                 mailSubject = "订单审核:您有新订单需要审核 来自 领先办公(Stationery Order: You have one new order need to approve _ from Leading Future)";
                                 mailBody    = EmailBodyStr(applyId, mId);
                                 isbodyHtml  = true;
                                 Send();
                             }
                         }
                     }
                 }
             }
         }
         return(true);
     }
     return(false);
 }