Example #1
0
 public UserPMModel Get(string user)
 {
     try
     {
         using (var session = LOANSessionManager.OpenSession())
         {
             IDbCommand command = new SqlCommand();
             command.Connection  = session.Connection;
             command.CommandType = CommandType.StoredProcedure;
             command.CommandText = "sp_PD_USER_GetWidthUserName";
             command.Parameters.Add(new SqlParameter("@UserName", user));
             var dt = new DataTable();
             dt.Load(command.ExecuteReader());
             if (dt != null)
             {
                 if (dt.Rows.Count > 0)
                 {
                     UserPMModel userModel = new UserPMModel();
                     userModel.IDUser   = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                     userModel.Email    = dt.Rows[0]["Email"].ToString();
                     userModel.UserName = dt.Rows[0]["UserName"].ToString();
                     userModel.FullName = dt.Rows[0]["FullName"].ToString();
                     userModel.TypeUser = Convert.ToInt32(dt.Rows[0]["Type"]);
                     return(userModel);
                 }
             }
             return(null);
         }
     }
     catch (BusinessException ex)
     {
         throw ex;
     }
 }
Example #2
0
        public async Task <JsonResult> LayDSSale()
        {
            List <UserPMModel> rs = new List <UserPMModel>();
            var lstNhom           = new GroupRepository().LayDSCuaNhanVien(GlobalData.User.IDUser);

            if (lstNhom != null)
            {
                foreach (var item in lstNhom)
                {
                    var lstNhanVien = await _rpEmployee.LayDSThanhVienNhomCaConAsync(item.ID, GlobalData.User.IDUser);

                    if (lstNhanVien != null)
                    {
                        foreach (var jtem in lstNhanVien)
                        {
                            var user = new UserPMModel();
                            user.FullName = jtem.Name;
                            user.Code     = jtem.Code;
                            user.IDUser   = jtem.Id;
                            rs.Add(user);
                        }
                    }
                }
            }
            rs.Add(GlobalData.User);
            rs = rs.GroupBy(p => p.IDUser).Select(g => g.First()).ToList();
            return(ToJsonResponse(true, null, rs));
        }
Example #3
0
 public List <UserPMModel> LayDSByMaQL(int maQL)
 {
     try
     {
         using (var session = LOANSessionManager.OpenSession())
         {
             IDbCommand command = new SqlCommand();
             command.Connection  = session.Connection;
             command.CommandType = CommandType.StoredProcedure;
             command.CommandText = "sp_NHAN_VIEN_LayDSByMaQL";
             command.Parameters.Add(new SqlParameter("@MaQL", maQL));
             var dt = new DataTable();
             dt.Load(command.ExecuteReader());
             if (dt == null)
             {
                 return(null);
             }
             List <UserPMModel> rs = new List <UserPMModel>();
             foreach (DataRow item in dt.Rows)
             {
                 UserPMModel us = new UserPMModel();
                 us.IDUser   = Convert.ToInt32(item["ID"].ToString());
                 us.Code     = item["Code"].ToString();
                 us.FullName = item["HoTen"].ToString();
                 rs.Add(us);
             }
             return(rs);
         }
     }
     catch (BusinessException ex)
     {
         throw ex;
     }
 }
Example #4
0
 public static void SendMailToAdmin(int id, string url)
 {
     try
     {
         var hoSo = new HoSoBLL().LayChiTiet(id);
         if (hoSo != null)
         {
             var lstUserApprove = new NhanVienNhomBLL().LayDSNhanVien(hoSo.HoSoCuaAi, (int)QuyenIndex.DuyetHoSo);
             if (lstUserApprove != null)
             {
                 foreach (var item in lstUserApprove)
                 {
                     string      mailTo      = "";
                     string      subject     = "[FINTECHCOM]{0}";
                     string      mailBody    = "";
                     string      genderSend  = "";
                     UserPMModel userSend    = new UserPMBLL().GetUserByID(hoSo.HoSoCuaAi.ToString());
                     UserPMModel userReceive = item;
                     mailTo = userReceive.Email;
                     string genderReceive = "";
                     string template      = "";
                     mailBody += "<p style=\"margin-left:20px;margin-top:20px\"><font size=\"2.5\" face=\"Arial\">Dear{0} {1}\r\n\r\n";
                     mailBody += "Bạn được chọn để duyệt hồ sơ bởi {2} {3}.\r\n";
                     mailBody += "Hồ sơ: {4}\r\n";
                     mailBody += "Mã hồ sơ: <a href='" + url + "/DuyetHoSo/XemHSByID/" + id + "'>{5}</a>\r\n\r\n";
                     mailBody += "Vui lòng click vào link bên dưới {6} thực hiện việc kiểm duyệt.\r\n\r\n";
                     mailBody += "http://" + url + "/DuyetHoSo/XemHSByID/" + id + ".\r\n\r\n";
                     mailBody += "Đây là một email được tạo ra hệ thống. Xin vui lòng không trả lời tin nhắn này.\r\n";
                     //mailBody += "Nếu bạn có bất kỳ thắc mắc, xin vui lòng liên hệ {7}\r\n";
                     mailBody += "Trân trọng,\r\n\r\n";
                     mailBody += "VIETBANK – HỆ THỐNG KIỂM DUYỆT HỒ SƠ\r\n\r\n</font></p>";
                     template += "<html><table style=\"width: 700px\"  cellpadding=\"0\" cellspacing=\"0\"><tr style =\"background-color:#0D622F\"><td style =\"width:15%;float:left\"><img style=\"width:120px;margin-left: 20px;margin-top: 20px;\" src ='" + CMLink.PathLogo + "'></td><td style=\"width:85%\"><p style=\"float:left; margin: 10px 0px 10px 15px\"><font size=\"6\" face=\"VIETBANK – HỆ THỐNG KIỂM DUYỆT HỒ SƠ\" style=\"color:white\">HỆ THỐNG KIỂM DUYỆT HỒ SƠ</font></p ></td></tr>";
                     template += "<tr style=\"background-color:#61ec66\" align=\"left\" ><td colspan='2'>###</td></tr>";
                     template += "</table></html>";
                     mailBody  = mailBody.Replace("\r\n", "<br>");
                     mailBody  = string.Format(mailBody, genderReceive, userReceive.FullName, genderSend, userSend.FullName, hoSo.TenKhachHang, hoSo.MaHoSo, "đây");
                     template  = template.Replace("###", mailBody);
                     SendMail(mailTo, string.Format(subject, hoSo.TenKhachHang), hoSo.TenKhachHang, template);
                 }
             }
         }
     }
     catch
     {
     }
 }
Example #5
0
        public JsonResult GetUser(string userName)
        {
            var message = new RMessage {
                ErrorMessage = Resources.Global.Message_Error, Result = false
            };
            UserPMModel user = null;

            try
            {
                user = new UserPMBLL().Get(userName);
            }
            catch (BusinessException ex)
            {
                message.Result        = false;
                message.MessageId     = ex.getExceptionId();
                message.ErrorMessage  = ex.Message;
                message.SystemMessage = ex.ToString();
            }
            return(Json(new { Message = message, User = user }, JsonRequestBehavior.AllowGet));
        }
 public List <UserPMModel> LayDSNhanVien(int userID, int quyen)
 {
     try
     {
         using (ISession session = LOANSessionManager.OpenSession())
         {
             IDbCommand command = new SqlCommand();
             command.Connection  = session.Connection;
             command.CommandType = CommandType.StoredProcedure;
             command.CommandText = "sp_Employee_LayDSByRule";
             command.Parameters.Add(new SqlParameter("@UserID", userID));
             command.Parameters.Add(new SqlParameter("@Rule", quyen));
             DataTable dt = new DataTable();
             dt.Load(command.ExecuteReader());
             if (dt != null)
             {
                 if (dt.Rows.Count > 0)
                 {
                     List <UserPMModel> result = new List <UserPMModel>();
                     foreach (DataRow item in dt.Rows)
                     {
                         UserPMModel nv = new UserPMModel();
                         nv.IDUser   = Convert.ToInt32(item["ID"].ToString());
                         nv.Email    = item["Email"].ToString();
                         nv.Code     = item["Code"].ToString();
                         nv.UserName = item["UserName"].ToString();
                         nv.FullName = item["FullName"].ToString();
                         nv.Phone    = item["Phone"].ToString();
                         result.Add(nv);
                     }
                     return(result);
                 }
             }
             return(null);
         }
     }
     catch (BusinessException ex)
     {
         throw ex;
     }
 }
Example #7
0
 public UserPMModel GetUserByID(string userID)
 {
     try
     {
         using (var session = LOANSessionManager.OpenSession())
         {
             IDbCommand command = new SqlCommand();
             command.Connection  = session.Connection;
             command.CommandType = CommandType.StoredProcedure;
             command.CommandText = "sp_NHAN_VIEN_GetUserByID";
             command.Parameters.Add(new SqlParameter("@UserID", userID));
             var dt = new DataTable();
             dt.Load(command.ExecuteReader());
             if (dt != null)
             {
                 if (dt.Rows.Count > 0)
                 {
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
                         UserPMModel userModel = new UserPMModel();
                         userModel.IDUser   = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
                         userModel.Email    = dt.Rows[i]["Email"].ToString();
                         userModel.Code     = dt.Rows[i]["Code"].ToString();
                         userModel.UserName = dt.Rows[i]["UserName"].ToString();
                         userModel.FullName = dt.Rows[i]["FullName"].ToString();
                         userModel.Phone    = dt.Rows[i]["Phone"].ToString();
                         userModel.Password = dt.Rows[i]["Password"].ToString();
                         userModel.TypeUser = Convert.ToInt32(dt.Rows[i]["Type"]);
                         return(userModel);
                     }
                 }
             }
             return(null);
         }
     }
     catch (BusinessException ex)
     {
         throw ex;
     }
 }
Example #8
0
 public UserPMModel DangNhap(string user, string pass)
 {
     try
     {
         using (var session = LOANSessionManager.OpenSession())
         {
             IDbCommand command = new SqlCommand();
             command.Connection  = session.Connection;
             command.CommandType = CommandType.StoredProcedure;
             command.CommandText = "sp_Employee_Login";
             command.Parameters.Add(new SqlParameter("@UserName", user));
             command.Parameters.Add(new SqlParameter("@Password", pass));
             var dt = new DataTable();
             dt.Load(command.ExecuteReader());
             if (dt != null)
             {
                 if (dt.Rows.Count > 0)
                 {
                     UserPMModel userModel = new UserPMModel();
                     userModel.Code     = dt.Rows[0]["Code"].ToString();
                     userModel.IDUser   = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                     userModel.Email    = dt.Rows[0]["Email"].ToString();
                     userModel.UserName = dt.Rows[0]["UserName"].ToString();
                     userModel.FullName = dt.Rows[0]["FullName"].ToString();
                     userModel.OrgId    = Convert.ToInt32(dt.Rows[0]["OrgId"].ToString());
                     userModel.RoleId   = string.IsNullOrWhiteSpace(dt.Rows[0]["RoleId"].ToString()) ? 0 :  Convert.ToInt32(dt.Rows[0]["RoleId"].ToString());
                     return(userModel);
                 }
             }
             return(null);
         }
     }
     catch (BusinessException ex)
     {
         throw ex;
     }
 }