Esempio n. 1
0
        public ActionResult AjaxUserForm()
        {
            var list = _dnUserIsnRole.GetListByRoleId(UserItem.AgencyID, GuiId.FirstOrDefault());

            ViewBag.Department = _departmentApi.GetAll(UserItem.AgencyID);
            return(View(list));
        }
Esempio n. 2
0
        public ActionResult RoleAction()
        {
            var roleId         = GuiId.FirstOrDefault();
            var role           = _rolerDa.GetById(roleId);
            var roleName       = Request["ItemNameRole"];
            var listActiveRole = _rolerDa.GetlistActiveRole();

            foreach (var activeRole in listActiveRole)
            {
                if (Request[activeRole.NameActive] != null)
                {
                    role.ActiveRoles.Add(activeRole);
                }
                else
                {
                    role.ActiveRoles.Remove(activeRole);
                }
                _rolerDa.Save();
            }
            var msg = new JsonMessage
            {
                Erros   = false,
                ID      = roleId.ToString(),
                Message =
                    string.Format("Đã cập nhật chuyên mục: <b>{0}</b>.<br />",
                                  Server.HtmlEncode(roleName))
            };

            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult AjaxView()
        {
            ViewBag.GuiId    = GuiId.FirstOrDefault();
            ViewBag.ArrId    = ArrId.FirstOrDefault();
            ViewBag.AgencyID = UserItem.AgencyID;
            var model = _voteApi.GetListSimple(UserItem.AgencyID);

            return(View(model));
        }
Esempio n. 4
0
        public ActionResult AjaxRoleModule()
        {
            var model = new ModelDNRolesItem
            {
                Item            = _dnRoleApi.GetByid(GuiId.FirstOrDefault()),
                ActiveRoleItems = _dnActiveApi.GetAll()
            };

            ViewBag.Action     = "RoleModule";
            ViewBag.ActionText = ActionText;
            return(View(model));
        }
Esempio n. 5
0
        public ActionResult AjaxForm()
        {
            //ViewBag.Edit = systemActionItem.Edit;
            //ViewBag.Delete = systemActionItem.Delete;
            var userId     = GuiId.FirstOrDefault();
            var user       = _userDa.GetById(userId);
            var actionRole = _userDa.GetActiveRoleAll();

            ViewBag.ItemId      = userId;
            ViewBag.ActiveRoles = actionRole;
            return(View(user));
        }
Esempio n. 6
0
        public ActionResult Actions()
        {
            var    msg = new JsonMessage();
            var    obj = new DNRolesJsonItem();
            string json;

            switch (DoAction)
            {
            case ActionType.Add:
                UpdateModel(obj);
                obj.RoleId = Guid.NewGuid();
                obj.Code   = CodeLogin();
                json       = new JavaScriptSerializer().Serialize(obj);
                msg        = _dnRoleApi.Add(UserItem.AgencyID, json, CodeLogin());
                break;

            case ActionType.Edit:
                UpdateModel(obj);
                obj.Code   = CodeLogin();
                obj.RoleId = GuiId.FirstOrDefault();
                json       = new JavaScriptSerializer().Serialize(obj);
                msg        = _dnRoleApi.Update(json, GuiId.FirstOrDefault(), UserItem.AgencyID, CodeLogin());
                break;

            case ActionType.Delete:
                var lstId = Request["itemId"];
                msg = _dnRoleApi.Delete(lstId);
                break;

            case ActionType.View:
                msg = _dnRoleApi.UpdateActive(GuiId.FirstOrDefault(), Request["chkActiveRoles"]);
                break;

            case ActionType.RoleModule:
                msg = _dnRoleApi.UpdateModuleActive(GuiId.FirstOrDefault(), Request["chkActiveRoles"]);
                break;

            case ActionType.Active:
                var listInt = Request["listInt"];
                var RoleId  = Request["RoleId"];
                msg = _dnRoleApi.AddModuleRole(listInt, RoleId, UserItem.AgencyID);
                break;

            default:
                msg.Erros   = true;
                msg.Message = "Bạn không được phần quyển cho chức năng này.";
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult AjaxForm()
        {
            var obj = new DNRolesItem();

            if (DoAction == ActionType.Edit)
            {
                obj = _dnRoleApi.GetByid(GuiId.FirstOrDefault());
            }
            ViewBag.listroom   = _dnLevelRoom.GetListParentID(UserItem.AgencyID);
            ViewBag.listUser   = _dnUserApi.GetAll(UserItem.AgencyID);
            ViewData.Model     = obj;
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            return(View());
        }
Esempio n. 8
0
        public ActionResult AjaxForm()
        {
            var dnUser = new DNUserItem
            {
                PasswordSalt = "ssc123456",
                StartDate    = DateTime.Now.TotalSeconds()
            };

            if (DoAction == ActionType.Edit)
            {
                dnUser = _dnUserApi.GetItemById(UserItem.AgencyID, GuiId.FirstOrDefault());
            }
            ViewData.Model     = dnUser;
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            return(View());
        }
Esempio n. 9
0
        public ActionResult DeleteRoleAction()
        {
            JsonMessage msg;
            var         roleModuleActiveDa = new RoleModuleActiveDA("#");

            try
            {
                int moduleid = Convert.ToInt16(Request["moduleid"]);
                var roleId   = GuiId.FirstOrDefault();
                var role     = _rolerDa.GetById(roleId);
                var module   = role.Modules.FirstOrDefault(m => m.ID == moduleid);
                if (module != null)
                {
                    var namemodule = module.NameModule;
                    role.Modules.Remove(module);
                    _rolerDa.Save();
                    var roleModuleActive = roleModuleActiveDa.GetListRoleModuleActivekt(roleId, moduleid);
                    foreach (var moduleActive in roleModuleActive)
                    {
                        roleModuleActiveDa.Delete(moduleActive);
                        roleModuleActiveDa.Save();
                    }
                    msg = new JsonMessage
                    {
                        Erros   = false,
                        ID      = moduleid.ToString(),
                        Message = string.Format("Đã xóa chuyên mục <b>{0}</b>.<br />", Server.HtmlEncode(namemodule))
                    };
                    return(Json(msg, JsonRequestBehavior.AllowGet));
                }
                msg = new JsonMessage
                {
                    Erros   = true,
                    Message = "Không có hành động nào được thực hiện."
                };
            }
            catch (Exception)
            {
                msg = new JsonMessage
                {
                    Erros   = true,
                    Message = "Không có hành động nào được thực hiện."
                };
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        public ActionResult Actions()
        {
            var msg = new JsonMessage {
                Erros = false
            };
            var model = new ProduceItem();

            switch (DoAction)
            {
            case ActionType.Delete:
                var id  = GuiId.FirstOrDefault();
                var obj = _da.GetDetailById(id);
                obj.IsDeleted = true;
                _da.Save();
                return(Json(new JsonMessage(false, "")));

                break;
            }

            return(Json(1));
        }
Esempio n. 11
0
        public ActionResult AjaxView()
        {
            var model = _dnRoleApi.GetByid(GuiId.FirstOrDefault());

            return(View(model));
        }
Esempio n. 12
0
        public ActionResult AjaxView()
        {
            var model = _dnUserApi.GetItemById(UserItem.AgencyID, GuiId.FirstOrDefault());

            return(View(model));
        }
Esempio n. 13
0
        public ActionResult Actions()
        {
            var msg      = new JsonMessage();
            var dnUser   = new DNUserAddItem();
            var json     = "";
            var date     = Request["StartDay"];
            var birthDay = Request["BirthDay_"];

            switch (DoAction)
            {
            case ActionType.Add:
                UpdateModel(dnUser);
                if (!string.IsNullOrEmpty(date))
                {
                    dnUser.StartDate = date.StringToDecimal(0);
                }
                if (!string.IsNullOrEmpty(birthDay))
                {
                    dnUser.BirthDay = birthDay.StringToDecimal(0);
                }
                dnUser.UserId = Guid.NewGuid();
                json          = new JavaScriptSerializer().Serialize(dnUser);
                msg           = _dnUserApi.Add(UserItem.AgencyID, json);
                break;

            case ActionType.Edit:
                UpdateModel(dnUser);
                if (!string.IsNullOrEmpty(date))
                {
                    dnUser.StartDate = date.StringToDecimal(0);
                }
                if (!string.IsNullOrEmpty(birthDay))
                {
                    dnUser.BirthDay = birthDay.StringToDecimal(0);
                }
                dnUser.UserId = GuiId.FirstOrDefault();
                json          = new JavaScriptSerializer().Serialize(dnUser);
                msg           = _dnUserApi.Update(UserItem.AgencyID, json);
                break;

            case ActionType.Active:
                var listInt = Request["listInt"];
                var userId  = Request["userId"];
                msg = _dnUserApi.AddModuleUser(listInt, userId, UserItem.AgencyID);
                break;

            case ActionType.Delete:
                msg = _dnUserApi.Delete(json, Request["itemID"]);
                break;

            case ActionType.RoleModule:
                msg = _dnUserApi.UpdateModuleActive(GuiId.FirstOrDefault(), Request["chkActiveRoles"]);
                break;

            case ActionType.Show:
                var c = _dnUserApi.CheckinUser(ArrId.FirstOrDefault(), UserItem.AgencyID);
                if (c == 1)
                {
                    msg.Erros   = false;
                    msg.Message = "Bạn đã chấm công thành công.";
                }
                break;

            case ActionType.Hide:
                msg = _dnUserApi.ShowHide(GuiId.FirstOrDefault(), true);
                break;

            default:
                msg.Erros   = true;
                msg.Message = "Bạn không được phần quyển cho chức năng này.";
                break;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        public void TestXmlPersistClass()
        {
            TestPersist orig  = new TestPersist();
            GuiId       guiId = new GuiId(1180, 123456);

            orig.GuiId = guiId;

            orig.Array    = new object[6];
            orig.Array[0] = "Zkouška\r\nřádku";
            orig.Array[1] = new DateTime(2019, 01, 15, 12, 0, 0);
            orig.Array[2] = 16.02m;
            orig.Array[3] = new Rectangle(5, 10, 100, 50);
            orig.Array[4] = new List <int> {
                10, 20, 30
            };


            GuiId guiId0 = new GuiId(21, 1234);
            GuiId guiId5 = new GuiId(26, 6789);

            orig.GuiIdList = new List <GuiId>();
            orig.GuiIdList.Add(guiId0);
            orig.GuiIdList.Add(new GuiId(22, 2345));
            orig.GuiIdList.Add(null);                    // new GuiId(23, 3456));
            orig.GuiIdList.Add(new GuiId(24, 4567));
            orig.GuiIdList.Add(new GuiId(25, 5678));
            orig.GuiIdList.Add(guiId5);

            orig.Tabulka = new string[3, 2];
            for (int r = 0; r < 3; r++)
            {
                for (int c = 0; c < 2; c++)
                {
                    orig.Tabulka[r, c] = "Pozice(" + r + "," + c + ")";
                }
            }

            orig.Sachovnice = new TestDictionary();
            GuiId key1 = new GuiId(1, 101);
            GuiId key6 = new GuiId(1, 106);

            orig.Sachovnice.Add(key1, new Rectangle(1, 1, 1, 1));
            orig.Sachovnice.Add(new GuiId(1, 102), new Rectangle(2, 2, 2, 2));
            orig.Sachovnice.Add(new GuiId(1, 103), new Rectangle(3, 3, 3, 3));
            orig.Sachovnice.Add(new GuiId(1, 104), new Rectangle(4, 4, 4, 4));
            orig.Sachovnice.Add(new GuiId(1, 105), new Rectangle(5, 5, 5, 5));
            orig.Sachovnice.Add(key6, new Rectangle(6, 6, 6, 6));

            orig.Images = new List <GuiImage>();
            orig.Images.Add(RES.Images.Actions16.DialogNo3Png);
            orig.Images.Add(RES.Images.Actions16.DialogOk3Png);
            orig.Images.Add(RES.Images.Actions16.DialogOkApply3Png);

            string zip = Persist.Serialize(orig, PersistArgs.Compressed);
            string xml = Persist.Serialize(orig, PersistArgs.Default);

            TestPersist copy = Persist.Deserialize(zip) as TestPersist;

            // Test shodného obsahu:
            if (copy.GuiId == null)
            {
                throw new AssertFailedException("TestPersist.GuiId is null");
            }
            if (copy.GuiId != guiId)
            {
                throw new AssertFailedException("TestPersist.GuiId is not equal to original");
            }

            if (copy.GuiIdList == null)
            {
                throw new AssertFailedException("TestPersist.GuiIdList is null");
            }
            if (copy.GuiIdList.Count != 6)
            {
                throw new AssertFailedException("TestPersist.GuiIdList has bad count");
            }
            if (copy.GuiIdList[0] != guiId0)
            {
                throw new AssertFailedException("TestPersist.GuiIdList[0] is not equal to original");
            }
            if (copy.GuiIdList[2] != null)
            {
                throw new AssertFailedException("TestPersist.GuiIdList[2] is not null");
            }
            if (copy.GuiIdList[5] != guiId5)
            {
                throw new AssertFailedException("TestPersist.GuiIdList[5] is not equal to original");
            }

            if (copy.Tabulka == null)
            {
                throw new AssertFailedException("TestPersist.Tabulka is null");
            }
            if (copy.Tabulka.Rank != 2)
            {
                throw new AssertFailedException("TestPersist.Tabulka has Rank != 2");
            }
            if (copy.Tabulka.GetLength(0) != 3)
            {
                throw new AssertFailedException("TestPersist.Tabulka has Length(0) != 3");
            }
            if (copy.Tabulka.GetLength(1) != 2)
            {
                throw new AssertFailedException("TestPersist.Tabulka has Length(1) != 2");
            }
            if (copy.Tabulka[2, 1] != "Pozice(2,1)")
            {
                throw new AssertFailedException("TestPersist.Tabulka has bad value in cell [2,1]");
            }

            if (copy.Sachovnice == null)
            {
                throw new AssertFailedException("TestPersist.Sachovnice is null");
            }
            if (copy.Sachovnice.Count != 6)
            {
                throw new AssertFailedException("TestPersist.Sachovnice has bad count");
            }
            if (!copy.Sachovnice.ContainsKey(key1))
            {
                throw new AssertFailedException("TestPersist.Sachovnice does not contains key0");
            }
            if (copy.Sachovnice[key1].Top != 1)
            {
                throw new AssertFailedException("TestPersist.Sachovnice in [key0] has bad value");
            }
            if (!copy.Sachovnice.ContainsKey(key6))
            {
                throw new AssertFailedException("TestPersist.Sachovnice does not contains key5");
            }
            if (copy.Sachovnice[key6].Top != 6)
            {
                throw new AssertFailedException("TestPersist.Sachovnice in [key5] has bad value");
            }
        }