示例#1
0
        public ActionResult Updatechucvu(string act, string ID, ChucDanhModels model)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            if (act == "create")
            {
                ChucDanhModels param = new ChucDanhModels();
                param.machucdanh  = model.machucdanh;
                param.tenchucdanh = model.tenchucdanh;
                param.tengiaodich = model.tengiaodich;
                param.ghichu      = model.ghichu;
                param.xoa         = "0";
                param.nguoitao    = int.Parse(Session["userid"].ToString());
                param.ngaytao     = ngaytao;
                DanhmucServices services = new DanhmucServices();
                string          result   = services.InsertRow_chucdanh(param);
            }
            else if (act == "update")
            {
                ChucDanhModels param    = new ChucDanhModels();
                FunctionXML    function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config"));
                param.machucdanh  = int.Parse(AES.DecryptText(ID, function.ReadXMLGetKeyEncrypt()));
                param.tenchucdanh = model.tenchucdanh;
                param.tengiaodich = model.tengiaodich;
                param.ghichu      = model.ghichu;
                param.xoa         = "0";
                param.nguoitao    = int.Parse(Session["userid"].ToString());
                param.ngaytao     = ngaytao;
                DanhmucServices services = new DanhmucServices();
                bool            result   = services.UpdateRow_chucdanh(param);
            }
            else if (act == "delete")
            {
                ChucDanhModels param    = new ChucDanhModels();
                FunctionXML    function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config"));
                param.machucdanh = int.Parse(AES.DecryptText(ID, function.ReadXMLGetKeyEncrypt()));

                param.nguoihieuchinh = int.Parse(Session["userid"].ToString());
                DanhmucServices services = new DanhmucServices();

                bool result = services.DeleteRows_chucdanh(param);
            }
            return(RedirectToAction("Indexchucdanh", "Danhmuc"));
        }