Ejemplo n.º 1
0
        public static List <SYS_UserView> GetAllUser(string search_text, string org_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            SYS_UserView current_user = Controller_User.GetUser(RequestID, RequestID);
            //Security Check For AllDepartment
            string departmentID = "";

            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "allDepartment"))
            {
                departmentID = current_user.DepartmentID;
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_UserViews
                    where c.Active == true && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID)) &&

                    ((search_text == "") ||
                     (search_text != "" && (
                          c.UserID.Contains(search_text) ||
                          c.UserCode.Contains(search_text) ||
                          c.UserName.Contains(search_text) ||
                          c.Email.Contains(search_text)
                          )))

                    orderby c.UserName
                    select c).ToList());
        }
Ejemplo n.º 2
0
        public static string DeleteUser(string record_id, string user_id, string RequestID)
        {
            try
            {
                //Security Check
                if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "delete"))
                {
                    throw new Exception("No Access.");
                }

                LINQ_SystemDataContext dc = new LINQ_SystemDataContext();
                SYS_User the_record       = (from c in dc.SYS_Users where c.UserID == record_id && c.Active == true select c).FirstOrDefault();
                if (the_record == null)
                {
                    return("Error~We can't find");
                }
                the_record.Active     = false;
                the_record.ModifiedOn = DateTime.Now;
                the_record.ModifiedBy = user_id;
                the_record.LastAction = Guid.NewGuid().ToString();
                dc.SubmitChanges(ConflictMode.ContinueOnConflict);
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 3
0
        public static string GetAllUserJson(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            SYS_UserView current_user = GetUser(RequestID, RequestID);
            //Security Check For AllDepartment
            string departmentID = "";

            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "allDepartment"))
            {
                departmentID = current_user.DepartmentID;
            }

            LINQ_SystemDataContext dc        = new LINQ_SystemDataContext();
            List <SYS_UserView>    user_list = (from c in dc.SYS_UserViews
                                                where c.Active == true && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID))
                                                orderby c.UserName
                                                select new SYS_UserView
            {
                UserID = c.UserID,
                UserCode = c.UserCode,
                UserName = c.UserName,
                RoleName = c.RoleName,
                Email = c.Email,
                PositionName = c.PositionName,
                DepartmentName = c.DepartmentName
            }).ToList();
            string return_str = new JavaScriptSerializer().Serialize(user_list);

            return(return_str);
        }
Ejemplo n.º 4
0
        public static string GetAllDepartmentJSON(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            LINQ_MasterDataContext dc = new LINQ_MasterDataContext();
            //Get current user info
            SYS_UserView current_user = Controller_User.GetUser(RequestID, RequestID);
            //Security Check For AllDepartment
            string departmentID = "";

            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "allDepartment"))
            {
                departmentID = current_user.DepartmentID;
            }
            //Add into Query Statment
            var Query = (from c in dc.Mst_DepartmentViews
                         where c.Active == true && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID))
                         orderby c.DepartmentName
                         select new Mst_DepartmentView
            {
                DepartmentID = c.DepartmentID,
                DepartmentName = c.DepartmentName,
                NotifyEmail = c.NotifyEmail,
                Protocol = c.Protocol,
                Description = c.Description,
                Remark = c.Remark,
            }).ToList();
            string return_str = new JavaScriptSerializer().Serialize(Query);

            return(return_str);
        }
Ejemplo n.º 5
0
        public static string DeleteSysMenuGroup(string menugp_id, string user_id, string RequestID)
        {
            try
            {
                //Security Check
                if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "delete"))
                {
                    throw new Exception("No Access.");
                }

                LINQ_SystemDataContext dc         = new LINQ_SystemDataContext();
                SYS_MenuGroup          the_record = (from sysmgp in dc.SYS_MenuGroups where sysmgp.MenuGroupID == menugp_id && sysmgp.Active == true select sysmgp).FirstOrDefault();
                if (the_record == null)
                {
                    return("Error ~ We can't find");
                }
                the_record.Active     = false;
                the_record.ModifiedOn = DateTime.Now;
                the_record.ModifiedBy = user_id;
                the_record.LastAction = Guid.NewGuid().ToString();
                dc.SubmitChanges();
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Error~" + ex.Message);
            }
        }
Ejemplo n.º 6
0
        public static string DeleteDepartment(string dep_id, string user_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "delete"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MasterDataContext dc = new LINQ_MasterDataContext();

            try
            {
                Mst_Department dep = new Mst_Department();
                dep = (from c in dc.Mst_Departments where c.DepartmentID == dep_id && c.Active == true select c).FirstOrDefault();
                if (dep == null)
                {
                    return("Error~We can't find");
                }
                dep.Active     = false;
                dep.ModifiedOn = DateTime.Now;
                dep.ModifiedBy = user_id;
                dep.LastAction = Guid.NewGuid().ToString();
                dc.SubmitChanges(ConflictMode.ContinueOnConflict);
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 7
0
        public static string GetAllPositionJSON(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            LINQ_MasterDataContext dc = new LINQ_MasterDataContext();
            //Get current user info
            SYS_UserView current_user = Controller_User.GetUser(RequestID, RequestID);
            //Add into Query Statment
            var Query = (from c in dc.Mst_PositionViews
                         where c.Active == true
                         orderby c.PositionName
                         select new Mst_PositionView
            {
                PositionID = c.PositionID,
                PositionName = c.PositionName,
                PositionCode = c.PositionCode,
                Protocol = c.Protocol,
                Description = c.Description,
                Remark = c.Remark,
            }).ToList();
            string return_str = new JavaScriptSerializer().Serialize(Query);

            return(return_str);
        }
Ejemplo n.º 8
0
        public static string SaveProgram(string record_id, string user_id, string program_name, string program_code, string RequestID)
        {
            try
            {
                LINQ_SystemDataContext dc         = new LINQ_SystemDataContext();
                SYS_Program            the_record = new SYS_Program();
                if (record_id == "" || record_id == null)
                {
                    the_record = (from c in dc.SYS_Programs where c.ProgramCode == program_code && c.Active == true select c).FirstOrDefault();
                    if (the_record == null)
                    {
                        //Security Check
                        if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "create"))
                        {
                            throw new Exception("No Access.");
                        }

                        the_record = new SYS_Program()
                        {
                            CreatedBy  = user_id,
                            CreatedOn  = DateTime.Now,
                            Active     = true,
                            ProgramID  = Guid.NewGuid().ToString(),
                            LastAction = Guid.NewGuid().ToString()
                        };
                        dc.SYS_Programs.InsertOnSubmit(the_record);
                    }
                    else
                    {
                        return("Error~Duplicate Country Code");
                    }
                }
                else
                {
                    //Security Check
                    if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "update"))
                    {
                        throw new Exception("No Access.");
                    }

                    the_record = (from c in dc.SYS_Programs where c.ProgramID == record_id select c).FirstOrDefault();
                    if (the_record == null)
                    {
                        throw new Exception("System cannot find the record");
                    }
                }
                the_record.ModifiedBy = user_id;
                the_record.ModifiedOn = DateTime.Now;
                the_record.LastAction = Guid.NewGuid().ToString();

                the_record.ProgramName = program_name;
                the_record.ProgramCode = program_code;
                dc.SubmitChanges();
                return("Success~" + the_record.ProgramID);
            }
            catch (Exception ex)
            {
                return("Error~" + ex.Message);
            }
        }
Ejemplo n.º 9
0
        public static string GetAllMenuTreeView(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            string result                = "";
            LINQ_SystemDataContext dc    = new LINQ_SystemDataContext();
            List <SYS_MenuView>    Menus = (from c in dc.SYS_MenuViews where c.Active == true orderby c.MenuName descending select c).ToList();

            List <SYS_MenuView> GroupMenus = (from c in Menus where c.IsNode == true orderby c.MenuSeq select c).ToList();

            foreach (SYS_MenuView groupMenu in GroupMenus)
            {
                result += "<ul >  <li class='jstree-open'  id='" + groupMenu.MenuID + "' >" + groupMenu.MenuName;
                List <SYS_MenuView> childMenus = (from c in Menus where c.NoteMenuID == groupMenu.MenuID && c.IsNode == false orderby c.MenuSeq select c).ToList();
                if (childMenus.Count > 0)
                {
                    result += "<ul>";


                    foreach (SYS_MenuView childMenu in childMenus)
                    {
                        result += "<li data-jstree = '{\"type\":\"html\"}' id='" + childMenu.MenuID + "' seq='" + childMenu.MenuSeq + "' > " + childMenu.MenuName + " </li>";
                    }
                    result += "  </ul>";
                }
                result += "  </li>";
                result += "  </ul>";
            }
            return(result);
        }
Ejemplo n.º 10
0
        public static string GetAllRequestJSON(string search_text, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            //Get current user info
            SYS_UserView            current_user = Controller_User.GetUser(RequestID, RequestID);
            LINQ_MeetingDataContext dc           = new LINQ_MeetingDataContext();

            //Security Check For AllDepartment
            string departmentID = "";

            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "allDepartment"))
            {
                departmentID = current_user.DepartmentID;
            }

            List <MET_RequestView> the_requestlist = (from c in dc.MET_RequestViews
                                                      where c.Active == true && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID)) &&
                                                      ((search_text == "") ||
                                                       (search_text != "" && (

                                                            c.RequestNo.Contains(search_text) ||
                                                            c.RequestStatus.Contains(search_text) ||
                                                            c.RequestTitle.Contains(search_text) ||
                                                            c.RequestType.Contains(search_text) ||
                                                            c.Description.Contains(search_text) ||
                                                            c.Remark.Contains(search_text) ||
                                                            c.DepartmentName.Contains(search_text))))
                                                      orderby c.CreatedOn descending
                                                      select c
                                                      ).ToList();
            var lists = new Newtonsoft.Json.Linq.JArray() as dynamic;

            foreach (var row in the_requestlist)
            {
                dynamic request = new Newtonsoft.Json.Linq.JObject();

                request.RequestID       = row.RequestID;
                request.DepartmentID    = row.DepartmentID;
                request.RequestType     = row.RequestType;
                request.RequestNo       = row.RequestNo;
                request.RequestUserName = row.RequestUserName;
                request.RequestTitle    = row.RequestTitle;
                request.RequestStatus   = row.RequestStatus;
                request.RequestOn       = row.RequestOn;
                request.DepartmentName  = row.DepartmentName;
                request.ApprovalStatus  = row.ApprovalStatus;
                lists.Add(request);
            }

            return(lists.ToString());
        }
Ejemplo n.º 11
0
        public static List <SYS_UserRoleMenu> GetUserRoleMenu(string role_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_UserRoleMenus where c.RoleID == role_id select c).ToList());
        }
Ejemplo n.º 12
0
        public static string DeleteRequest(string meetingreq_id, string user_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "delete"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            try
            {
                MET_Request request_record = new MET_Request();
                request_record = (from c in dc.MET_Requests where c.RequestID == meetingreq_id && c.Active == true select c).FirstOrDefault();
                if (request_record == null)
                {
                    return("Error~We can't find");
                }
                request_record.Active     = false;
                request_record.ModifiedOn = DateTime.Now;
                request_record.ModifiedBy = user_id;
                request_record.LastAction = Guid.NewGuid().ToString();

                #region Request Item
                List <MET_RequestItem> item_list = new List <MET_RequestItem>();
                item_list = (from c in dc.MET_RequestItems where c.RequestID == meetingreq_id && c.Active == true select c).ToList();
                foreach (MET_RequestItem i in item_list)
                {
                    i.Active     = false;
                    i.ModifiedBy = RequestID;
                    i.ModifiedOn = DateTime.Now;
                }
                #endregion

                #region Request Decision
                List <MET_RequestDecision> decision_list = new List <MET_RequestDecision>();
                decision_list = (from c in dc.MET_RequestDecisions where c.RequestID == meetingreq_id && c.Active == true select c).ToList();
                foreach (MET_RequestDecision i in decision_list)
                {
                    i.Active     = false;
                    i.ModifiedBy = RequestID;
                    i.ModifiedOn = DateTime.Now;
                }
                #endregion

                dc.SubmitChanges(ConflictMode.ContinueOnConflict);
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 13
0
        public static MET_RequestView GetRequestByID(string meeting_reqID, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            return((from c in dc.MET_RequestViews where c.RequestID == meeting_reqID && c.Active == true select c).FirstOrDefault());
        }
Ejemplo n.º 14
0
        public static List <SYS_GetOrganizationMenuGroupResult> GetOrganizationMenuGroup(string org_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return(dc.SYS_GetOrganizationMenuGroup(org_id).ToList());
        }
Ejemplo n.º 15
0
        public static SYS_UserView GetProfileUser(string userID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, userID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_UserViews where c.UserID == userID && c.Active == true select c).FirstOrDefault());
        }
Ejemplo n.º 16
0
        public static SYS_MenuView GetSysMenu(string menu_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from sysm in dc.SYS_MenuViews where sysm.MenuID == menu_id && sysm.Active == true select sysm).FirstOrDefault());
        }
Ejemplo n.º 17
0
        public static List <SYS_MenuView> GetAllMenu(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_MenuViews where c.Active == true orderby c.MenuName descending select c).ToList());
        }
Ejemplo n.º 18
0
        public static SYS_ProgramView GetProgram(string record_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_ProgramViews where c.ProgramID == record_id && c.Active == true select c).FirstOrDefault());
        }
Ejemplo n.º 19
0
        public static Mst_DepartmentView GetDepartment(string dep_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MasterDataContext dc = new LINQ_MasterDataContext();

            return((from c in dc.Mst_DepartmentViews where c.DepartmentID == dep_id && c.Active == true select c).FirstOrDefault());
        }
Ejemplo n.º 20
0
        public static string ChangeCombineDecision(string agendaID, string meetingreq_id, string edited_decision, string user_id)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "update"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            try
            {
                MET_Request request_record = new MET_Request();
                request_record = (from c in dc.MET_Requests where c.RequestID == meetingreq_id && c.Active == true select c).FirstOrDefault();
                if (request_record == null)
                {
                    return("Error~We can't find");
                }
                request_record.CombineDecision = edited_decision;
                request_record.ModifiedOn      = DateTime.Now;
                request_record.ModifiedBy      = user_id;
                request_record.LastAction      = Guid.NewGuid().ToString();

                dc.SubmitChanges(ConflictMode.ContinueOnConflict);

                #region get all request

                SYS_UserView current_user = Controller_User.GetUser(user_id, user_id);
                //Security Check For AllDepartment
                string departmentID = "";
                if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "allDepartment"))
                {
                    departmentID = current_user.DepartmentID;
                }

                List <MET_RequestView> reqs_list = (from c in dc.MET_RequestViews
                                                    where c.Active == true && c.AgendaID == agendaID && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID))
                                                    orderby c.Protocol ascending
                                                    select c).ToList();

                string return_str = new JavaScriptSerializer().Serialize(reqs_list);
                #endregion
                return("Success~" + return_str);
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 21
0
        public static List <Mst_PositionView> GetAllPosition(string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            SYS_UserView           current_user = Controller_User.GetUser(RequestID, RequestID);
            LINQ_MasterDataContext dc           = new LINQ_MasterDataContext();

            return((from c in dc.Mst_PositionViews
                    where c.Active == true
                    orderby c.PositionName
                    select c).ToList());
        }
Ejemplo n.º 22
0
        public static List <SYS_UserView> GetAllUserByOrganization(string orgId, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_UserViews
                    where c.Active == true && c.OrgID == orgId
                    orderby c.UserName
                    select c).ToList());
        }
Ejemplo n.º 23
0
        public static List <Object> GetLog(string RecordID, string RequestID, string PageNoString)
        {
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();
            int pageNo = 0;

            int.TryParse(PageNoString, out pageNo);

            //Get Skip Count
            int skip_count = (pageNo - 1) * RecordCountPerPage;

            var Query = (from c in dc.SysLogViews where c.RecordID == RecordID select c).OrderByDescending(x => x.LogDateTime);

            //Get Total Record Count
            int TotalCount = Query.Count();
            //GetTotal Number of Page
            int           TotalPage = (TotalCount / RecordCountPerPage) + (TotalCount % RecordCountPerPage == 0 ? 0 : 1);
            List <Object> result    = new List <object>();
            //Add overall pagination info on Index 0
            string previous_button = "y";

            if (pageNo == 1 || TotalPage == 1)
            {
                previous_button = "n";
            }
            string next_button = "y";

            if (pageNo == TotalPage)
            {
                next_button = "n";
            }
            if (TotalPage == 1)
            {
                previous_button = "n"; next_button = "n";
            }

            result.Add(TotalCount.ToString() + "~" + TotalPage.ToString() + "~" + pageNo.ToString() + "~" + previous_button + "~" + next_button);

            //Add Real Record Data from Index 1
            result.AddRange(new List <Object>(
                                Query
                                .Skip(skip_count).Take(RecordCountPerPage) // Add Skip and Take Function
                                .ToList()));
            return(result);
        }
Ejemplo n.º 24
0
        public static string GetAllAgendaJSON(string search_text, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }
            //Get current user info
            SYS_UserView            current_user = Controller_User.GetUser(RequestID, RequestID);
            LINQ_MeetingDataContext dc           = new LINQ_MeetingDataContext();

            //Security Check For AllDepartment
            string departmentID = "";

            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "allDepartment"))
            {
                departmentID = current_user.DepartmentID;
            }
            List <MET_AgendaView> the_agendalist = (from c in dc.MET_AgendaViews
                                                    where c.Active == true && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID)) &&
                                                    ((search_text == "") ||
                                                     (search_text != "" && (

                                                          c.AgendaNo.Contains(search_text) ||
                                                          c.AgendaRemark.Contains(search_text) ||
                                                          c.AgendaStatus.Contains(search_text) ||
                                                          c.CUserCode.Contains(search_text) ||
                                                          c.MUserCode.Contains(search_text)
                                                          )))
                                                    orderby c.CreatedOn descending
                                                    select c
                                                    ).ToList();
            var lists = new Newtonsoft.Json.Linq.JArray() as dynamic;

            foreach (var row in the_agendalist)
            {
                dynamic agenda = new Newtonsoft.Json.Linq.JObject();

                agenda.AgendaID     = row.AgendaID;
                agenda.AgendaNo     = row.AgendaNo;
                agenda.AgendaDate   = row.AgendaDate.ToString();
                agenda.AgendaRemark = row.AgendaRemark;
                agenda.AgendaStatus = row.AgendaStatus;
                lists.Add(agenda);
            }

            return(lists.ToString());
        }
Ejemplo n.º 25
0
        public static string GetAllRequestDecisionJson(string meeting_requsetID, string org_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext        dc = new LINQ_MeetingDataContext();
            List <MET_RequestDecisionView> reqdecision_list = (from c in dc.MET_RequestDecisionViews
                                                               where c.Active == true && c.RequestID == meeting_requsetID
                                                               orderby c.Seq
                                                               select c).ToList();
            string return_str = new JavaScriptSerializer().Serialize(reqdecision_list);

            return(return_str);
        }
Ejemplo n.º 26
0
        public static string GetAllUserByOrganizationJson(string orgId, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();
            List <SYS_UserView>    return_userlist = (from c in dc.SYS_UserViews
                                                      where c.Active == true && c.OrgID == orgId
                                                      orderby c.UserName
                                                      select c).ToList();

            string return_str = new JavaScriptSerializer().Serialize(return_userlist);

            return(return_str);
        }
Ejemplo n.º 27
0
        public static string DeleteAgenda(string agendaID, string user_id, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "delete"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            try
            {
                MET_Agenda agenda_record = new MET_Agenda();
                agenda_record = (from c in dc.MET_Agendas where c.AgendaID == agendaID && c.Active == true select c).FirstOrDefault();
                if (agenda_record == null)
                {
                    return("Error~We can't find");
                }
                agenda_record.Active     = false;
                agenda_record.ModifiedOn = DateTime.Now;
                agenda_record.ModifiedBy = user_id;
                agenda_record.LastAction = Guid.NewGuid().ToString();

                #region Request in agenda
                List <MET_Request> req_list = new List <MET_Request>();
                req_list = (from c in dc.MET_Requests where c.AgendaID == agendaID && c.Active == true select c).ToList();
                foreach (MET_Request i in req_list)
                {
                    i.AgendaID      = "";
                    i.RequestStatus = "Complete";
                    i.ModifiedBy    = RequestID;
                    i.ModifiedOn    = DateTime.Now;
                }
                #endregion

                dc.SubmitChanges(ConflictMode.ContinueOnConflict);
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 28
0
        public static string RequestApprove(string meetingreq_id, string status, string remark, string user_id)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "decision"))
            {
                throw new Exception("No Access.");
            }
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "update"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            try
            {
                MET_Request request_record = new MET_Request();
                request_record = (from c in dc.MET_Requests where c.RequestID == meetingreq_id && c.Active == true select c).FirstOrDefault();
                if (request_record == null)
                {
                    return("Error~We can't find");
                }

                request_record.ApprovalStatus = status;
                request_record.ApprovedBy     = user_id;
                request_record.ApprovedOn     = DateTime.Now;
                request_record.ApprovedRemark = remark;
                request_record.ModifiedOn     = DateTime.Now;
                request_record.ModifiedBy     = user_id;
                request_record.LastAction     = Guid.NewGuid().ToString();


                dc.SubmitChanges(ConflictMode.ContinueOnConflict);
                return("Success~" + request_record.ApprovalStatus + "~" + request_record.ApprovedRemark);
            }
            catch (ChangeConflictException ex)
            {
                return("Success~" + status + "~" + remark);
            }
        }
Ejemplo n.º 29
0
        public static string LoadRequestByAgendaID(string agendaID, string user_id)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_MeetingDataContext dc = new LINQ_MeetingDataContext();

            try
            {
                #region get all request
                //Security Check For AllDepartment
                SYS_UserView current_user = Controller_User.GetUser(user_id, user_id);
                string       departmentID = "";
                if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, user_id, "allDepartment"))
                {
                    departmentID = current_user.DepartmentID;
                }


                List <MET_RequestView> reqs_list = (from c in dc.MET_RequestViews
                                                    where c.Active == true && c.AgendaID == agendaID && (departmentID == "" || (departmentID != "" && c.DepartmentID == departmentID))
                                                    orderby c.Protocol ascending
                                                    select c).ToList();

                string return_str = new JavaScriptSerializer().Serialize(reqs_list);
                #endregion


                return("Success~" + return_str);
            }
            catch (Exception ex)
            {
                return("Success~");
            }
        }
Ejemplo n.º 30
0
        public static List <SYS_ProgramView> GetAllProgram(string search_text, string RequestID)
        {
            //Security Check
            if (!Controller_User_Access.CheckProgramAccess(AccessProgramCode, RequestID, "read"))
            {
                throw new Exception("No Access.");
            }

            LINQ_SystemDataContext dc = new LINQ_SystemDataContext();

            return((from c in dc.SYS_ProgramViews
                    where c.Active == true &&

                    ((search_text == "") ||
                     (search_text != "" && (
                          c.ProgramID.Contains(search_text) ||
                          c.ProgramName.Contains(search_text) ||
                          c.ProgramCode.Contains(search_text)
                          )))

                    orderby c.ProgramName
                    select c).ToList());
        }