Example #1
0
        private void GetDepartmentRootByDepartmentID(SysContext db, string DeptID, ref hr_Department rootDepartment)
        {
            hr_Department dept = db.hr_Department.Where(d => d.DeptID == DeptID).SingleOrDefault();

            if (dept != null)
            {
                if (dept.ParentID != "")
                {
                    GetDepartmentRootByDepartmentID(db, dept.ParentID, ref rootDepartment);
                }
                else
                {
                    rootDepartment = dept;
                }
            }
        }
Example #2
0
 public ActionResult GetSideBar()
 {
     using (Panasia.Gemini.FL.Data.Common.SysContext db = new Panasia.Gemini.FL.Data.Common.SysContext())
     {
         string id = Panasia.Gemini.FL.LoginInfo.EmployeeID;
         if (id != null)
         {
             var sidbar = (from fl_as in db.fl_ApproveState
                           join form in db.fl_Form on fl_as.FormID equals form.FormID
                           where
                           fl_as.EmployeeID.Equals(id)
                           select new { FormName = form.FormName, FormID = form.FormID, DataForm = form.DataFrom }).Distinct().ToList();
             return(Json(sidbar, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(null);
         }
     }
 }
Example #3
0
        public ActionResult MessagesCount() //消息总数
        {
            string id = Panasia.Gemini.FL.LoginInfo.UserID;

            if (id != null)
            {
                using (Panasia.Gemini.FL.Data.Common.SysContext db = new Panasia.Gemini.FL.Data.Common.SysContext())
                {
                    db.Database.Connection.Open();
                    var cmd = db.Database.Connection.CreateCommand();
                    cmd.CommandText = "select * FROM [dbo].[hr_fl_MessageRemind]('0'," + "'" + id + "'" + ")";
                    List <UserMessage> ls = new List <UserMessage>();
                    using (var reader = cmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess))
                    {
                        while (reader.Read())
                        {
                            UserMessage um = new UserMessage();
                            um.MsgTitle = reader["MsgTitle"].ToString();
                            um.MsgType  = reader["MsgType"].ToString();
                            um.Count    = Convert.ToInt32(reader["Count"]);
                            um.MsgUrl   = reader["MsgUrl"].ToString();
                            ls.Add(um);
                        }
                        reader.Close();
                    }
                    db.Database.Connection.Close();
                    foreach (var l in ls)
                    {
                        var formid   = Convert.ToInt32(l.MsgType);
                        var dataform = db.fl_Form.Where(f => f.FormID.Equals(formid)).SingleOrDefault().DataFrom;
                        l.MsgType = dataform;
                    }
                    return(Json(ls, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(null);
            }
        }