protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);
        base.BodyClass = "class='bodybg'";

        user = AuthServer.GetLoginUser();
        if (this.IsPostBack == false)
        {
            if (SystemCode.GetDict("RecordM_StudentRecord_VaccineCate").Count > 0)
            {
                tbAry = JsonConvert.SerializeObject(SystemCode.GetDict("RecordM_StudentRecord_VaccineCate"));
            }
            int nowYear = DateTime.Now.Year - 1911;
            ddlYear.Items.Add(new ListItem(nowYear.ToString() + "年", nowYear.ToString()));
            ddlYear.Items.Add(new ListItem((nowYear + 1).ToString() + "年", (nowYear + 1).ToString()));

            //if (SystemElementarySchool.list.Count > 0)
            //{
            //    ddlSchool.Items.Add(new ListItem("0", "請選擇學校名稱"));
            //    foreach(var item in SystemElementarySchool.list)
            //    {
            //        ddlSchool.Items.Add(new ListItem(item.ElementarySchoolID.ToString(), item.SchoolName));
            //    }
            //}


            if (SystemElementarySchool.list.Count > 0)
            {
                sAry = JsonConvert.SerializeObject(SystemElementarySchool.list);
            }
        }
    }
示例#2
0
        /// <summary>
        /// 根据ID获取系统参数表实体
        /// </summary>
        /// <param name="guid">主键ID</param>
        /// <returns>返回系统参数表实体</returns>
        public SystemCode GetItemById(Guid guid)
        {
            SystemCode tem = new SystemCode();

            tem = Dal.Find <SystemCode>(SystemCode._.ID == guid);
            return(tem);
        }
示例#3
0
        public List <FunctionPower> GetPowers(int userAuthorizationID, SystemCode systemCode)
        {
            string sql = @"
                            Select FunctionPower.* from FunctionPower 
                                Join RoleFunctionPower on RoleFunctionPower.FunctionPowerID=FunctionPower.ID
                                join [Role] on [Role].ID = RoleFunctionPower.RoleID
                                join UserPower on UserPower.RoleID = [Role].ID
                                join UserAuthorization on UserAuthorization.ID = UserPower.UserAuthorizationID
                                where UserAuthorization.ID=@UserAuthorizationID and FunctionPower.AppInfoID = @SystemCode
                                union 
                                select FunctionPower.* from FunctionPower
                                join DepartmentFunctionPower on DepartmentFunctionPower.FunctionPowerID = FunctionPower.ID 
                                join Department on Department.ID = DepartmentFunctionPower.DepartmentID
                                join [Role] on [Role].DepartmentID = Department.ID 
                                join UserPower on UserPower.RoleID = [Role].ID
                                join UserAuthorization on UserAuthorization.ID = UserPower.UserAuthorizationID 
                                where UserAuthorization.ID=@UserAuthorizationID and FunctionPower.AppInfoID = @SystemCode
                        ";

            return(_dbHelper.GetModelList <FunctionPower>(sql, new { UserAuthorizationID = userAuthorizationID, SystemCode = (int)systemCode },
                                                          new PagerParameter
            {
                PageIndex = 1,
                PageSize = 99999999,
                OrderBy = "ID"
            }).Rows);
        }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        user = AuthServer.GetLoginUser();
        if (this.IsPostBack == false)
        {
            List <int> list = new List <int>()
            {
                1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
            };
            var dict = SystemCode.GetDict("RecordM_StudentRecord_VaccineCate");

            if (dict.Count > 0)
            {
                var query = dict.Where(item => list.Contains(item.EnumValue));
                tbAry = JsonConvert.SerializeObject(query);
            }

            int nowYear = DateTime.Now.Year - 1911;
            for (int i = 0; i < 5; i++)
            {
                ddlYear.Items.Add(new ListItem((nowYear - i).ToString() + "年", nowYear.ToString()));
            }

            if (SystemElementarySchool.list.Count > 0)
            {
                sAry = JsonConvert.SerializeObject(SystemElementarySchool.list.Where(item => item.OrgID == user.OrgID));
            }
        }
    }
示例#5
0
        /// <summary>
        /// 取得1.0协议的sn
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static string getSn(string msg)
        {
            if (msg.StartsWith("6969"))
            {
                return("");                       //2.0协议返回空
            }
            string _CollectorCode;
            string sbUnitID = "";
            bool   isNormal = false;
            string tmpchar;

            //将后面是00的抛弃
            for (int i = 18; i >= 4; i--)
            {
                tmpchar = msg.Substring(i * 2, 2);
                if (!isNormal && !tmpchar.Equals("00"))
                {
                    isNormal = true;
                }
                if (isNormal)
                {
                    sbUnitID = ASCII.Chr((int)SystemCode.HexNumberToDenary(tmpchar, false, 8, 'u')) + sbUnitID;
                }
            }
            _CollectorCode = sbUnitID.ToString();
            _CollectorCode = _CollectorCode.Replace("\0", "0");//临时处理非法测试数据
            return(_CollectorCode);
        }
示例#6
0
        public async Task <IActionResult> Edit(string id, [Bind("Category,Code,DisplayOrder,DisplayName,Description,CreateDatetime,CreateUserId,UpdateDatetime,UpdateUserId")] SystemCode systemCode)
        {
            if (id != systemCode.Category)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemCode);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemCodeExists(systemCode.Category))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCode));
        }
        /// <summary>
        /// 根据证书中的appendDetail和客户端配置的WcfClientInvokeAttribute -> SystemCode
        /// 来解析出关联系统的服务连接
        /// </summary>
        /// <param name="code">客户端的配置System Code</param>
        /// <param name="appendDetail">证书中的appendDetail信息以分号分隔</param>
        /// <returns>关联系统的服务的信息</returns>
        private static WcfCredentialInfo resolveSubSystemCredentialInfo(SystemCode code, string appendDetail, WcfCredentialInfo mainCredentialInfo)
        {
            if (!string.IsNullOrEmpty(appendDetail))
            {
                string[] subServices = appendDetail.Split(';');
                if (subServices.Length > 0)
                {
                    foreach (string subService in subServices)
                    {
                        string[] subServiceAttribute = subService.Split(',');
                        if (subServiceAttribute.Length > 0 && subServiceAttribute.Length == 5)
                        {
                            string systemCode = subServiceAttribute[0].Substring(
                                subServiceAttribute[0].IndexOf("CfgName=") + "CfgName=".Length);

                            if (string.Compare(code.ToString(), systemCode, true) == 0)
                            {
                                WcfCredentialInfo subCredetialInfo = MB.Util.MyReflection.Instance.FillModelObject <WcfCredentialInfo>(mainCredentialInfo);
                                string            uri = subServiceAttribute[1].Substring("URL=".Length);
                                subCredetialInfo.EndpointFormatString = uri;
                                subCredetialInfo.BaseAddress          = uri.Substring(0, uri.Length - "{0}.svc".Length - 1);
                                subCredetialInfo.Domain   = subServiceAttribute[2].Substring("Domain=".Length);
                                subCredetialInfo.UserName = subServiceAttribute[3].Substring("LoginName=".Length);
                                subCredetialInfo.Password = subServiceAttribute[4].Substring("LoginPassword=".Length);
                                return(subCredetialInfo);
                            }
                        }
                    }
                }
            }

            return(null);
        }
示例#8
0
 /// <summary>
 /// Creates a ImmunizationEvent object from a PHSA model.
 /// </summary>
 /// <param name="model">The immunization view object to convert.</param>
 /// <returns>The newly created ImmunizationEvent object.</returns>
 private static TargetDisease FromPHSAModel(SystemCode model)
 {
     return(new TargetDisease()
     {
         Code = model.Code,
         Name = model.Display,
     });
 }
示例#9
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        ElementaryRecordID = GetNumber <int>("i");

        if (ElementaryRecordID == 0)
        {
            IsValid = false;
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }


        user = AuthServer.GetLoginUser();
        if (this.IsPostBack == false)
        {
            DataSet ds = MSDB.GetDataSet("ConnDB", "dbo.usp_RecordM_xGetElementaryRecordByID"
                                         , new Dictionary <string, object>()
            {
                { "@ElementaryRecordID", ElementaryRecordID }
            });

            ElementaryRecordVM VM = new ElementaryRecordVM();
            EntityS.FillModel(VM, ds.Tables[0]);
            List <ElementaryRecordDataVM> list = new List <ElementaryRecordDataVM>();
            EntityS.FillModel(list, ds.Tables[1]);

            for (int i = VM.AdmissionYear; i <= DateTime.Now.Year - 1911; i++)
            {
                ddlYear.Items.Add(new ListItem(i.ToString() + "年", i.ToString()));
            }


            var dict = SystemCode.GetDict("RecordM_StudentRecord_VaccineCate");
            if (dict.Count > 0)
            {
                tbAry = JsonConvert.SerializeObject(dict);
            }
            if (list.Count > 0)
            {
                tbAry2 = JsonConvert.SerializeObject(list);
            }

            ddlST.SelectedValue = VM.StudentYear.ToString();

            var slist = SystemElementarySchool.list.Where(item => item.OrgID == user.OrgID);
            ddlSchool.Items.Add(new ListItem("請選擇學校名稱", "0"));
            foreach (var item in slist)
            {
                ddlSchool.Items.Add(new ListItem(item.SchoolName, item.ElementarySchoolID.ToString()));
            }

            ddlSchool.SelectedValue = VM.ElementarySchoolID.ToString();
        }
    }
示例#10
0
        /// <summary>
        ///  新增数据
        /// </summary>
        /// Author  :Napoleon
        /// Created :2015-06-06 02:02:41
        public int InsertSystemCode(SystemCode model)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat("insert into System_Code(Id,ParentId,CodeName,OrderBy) values(@Id,@ParentId,@CodeName,@OrderBy)");
            int i = DbHelper.ExecuteSql(sql.ToString(), model);

            return(i);
        }
示例#11
0
        /// <summary>
        ///  更新数据
        /// </summary>
        /// Author  :Napoleon
        /// Created :2015-06-06 02:02:41
        public int UpdateSystemCode(SystemCode model)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat("update System_Code set Id=@Id,ParentId=@ParentId,CodeName=@CodeName,OrderBy=@OrderBy where Id=@Id");
            int i = DbHelper.ExecuteSql(sql.ToString(), model);

            return(i);
        }
示例#12
0
    public static void ServerSelect(ref DropDownList ddl, string SystemCateName)
    {
        List <SystemCodeVM> SystemCodeList = SystemCode.GetDict(SystemCateName);

        foreach (SystemCodeVM sc in SystemCodeList)
        {
            ddl.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
        }
    }
示例#13
0
    public static void ServerCheckBox(ref CheckBoxList cbl, string SystemCateName)
    {
        List <SystemCodeVM> SystemCodeList = SystemCode.GetDict(SystemCateName);

        foreach (SystemCodeVM sc in SystemCodeList)
        {
            cbl.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
        }
    }
示例#14
0
        /// <summary>
        /// 取得当个信息地址的值,字符串表示
        /// </summary>
        /// <param name="valuestr"></param>
        /// <param name="infounitAddress"></param>
        /// <param name="bytetype"></param>
        /// <returns></returns>
        private static string getValue(string valuestr, InfoUnitAddress infounitAddress, int bytetype)
        {
            double value = (double)SystemCode.HexNumberToDenary(valuestr, infounitAddress.reversionType, bytetype, infounitAddress.signtype);

            if (infounitAddress.dotnum > 0)
            {
                value = Math.Round(value / Math.Pow(10, infounitAddress.dotnum), 1);
            }
            return(value.ToString());
        }
示例#15
0
        /// <summary>
        /// 解析单个信息体
        /// </summary>
        /// <param name="body"></param>
        /// <returns></returns>
        public static string[] analyze(string body, int infoType, InfoUnitAddress infounitAddress)
        {
            string valuestr = "", value = "";

            switch (infoType)
            {
            case DataType.yaoce:
                valuestr = body.Substring(3 * 2, 4 * 2);
                value    = getValue(valuestr, infounitAddress, 32);
                break;

            case DataType.yaoxin:    //对于遥信的信息体,放回值和时间
                valuestr = body.Substring(3 * 2, 1 * 2);
                value    = getValue(valuestr, infounitAddress, 8);
                //再取得故障时间
                valuestr = body.Substring(5 * 2, 7 * 2);
                int year = 2000 + (int)SystemCode.HexNumberToDenary(valuestr.Substring(12, 2), false, 8, 'u') % 99;
                int moth = (int)SystemCode.HexNumberToDenary(valuestr.Substring(10, 2), false, 8, 'u');
                if (moth > 12)
                {
                    moth = 12;
                }
                int day = (int)SystemCode.HexNumberToDenary(valuestr.Substring(8, 2), false, 8, 'u');
                if (day > 31)
                {
                    day = 28;
                }
                int hh = (int)SystemCode.HexNumberToDenary(valuestr.Substring(6, 2), false, 8, 'u');
                if (hh > 23)
                {
                    hh = 23;
                }
                int mm = (int)SystemCode.HexNumberToDenary(valuestr.Substring(4, 2), false, 8, 'u');
                if (mm > 60)
                {
                    mm = 59;
                }
                int ss = (int)SystemCode.HexNumberToDenary(valuestr.Substring(2, 2), false, 8, 'u');
                if (ss > 60)
                {
                    ss = 59;
                }
                value += ":" + new DateTime(year, moth, day, hh, mm, ss).ToString("yyyy-mm-dd HH:mm:ss");
                break;

            case DataType.yaomai:
                valuestr = body.Substring(3 * 2, 4 * 2);
                value    = getValue(valuestr, infounitAddress, 32);
                break;

            default:
                break;
            }
            return((infounitAddress.address + ":" + value).Split(':'));
        }
示例#16
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (IsValid == false)
        {
            return;
        }

        int    EnumValue   = 0;
        string EnumName    = PureString(tbName.Text);
        int    OrderNumber = 0;

        int.TryParse(tbValue.Text, out EnumValue);
        int.TryParse(tbSort.Text, out OrderNumber);

        UserVM user = AuthServer.GetLoginUser();
        int    Chk  = 0;

        Dictionary <string, object> OutDict = new Dictionary <string, object>()
        {
            { "@Chk", Chk }
        };

        MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_CodeM_xAddSystemCode"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@SystemCodeCateID", ID },
            { "@EnumValue", EnumValue },
            { "@EnumName", EnumName },
            { "@CanEdit", 0 },
            { "@OrderNumber", OrderNumber },
            { "@CreatedUserID", user.ID }
        });

        Chk = (int)OutDict["@Chk"];

        string script = "";

        if (Chk > 0)
        {
            script = string.Format("{0}<script>alert('儲存成功');location.href='{1}#{2}';</script>",
                                   "<style>body{display:none;}</style>"
                                   , "/System/CodeM/CodeSetting.aspx"
                                   , HttpUtility.HtmlDecode(GetString("hash") ?? "")
                                   );

            SystemCode.Update();
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
示例#17
0
        public async Task <IActionResult> Create([Bind("Category,Code,DisplayOrder,DisplayName,Description,CreateDatetime,CreateUserId,UpdateDatetime,UpdateUserId")] SystemCode systemCode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(systemCode);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCode));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //base.AllowHttpMethod("POST");
        //base.DisableTop(true);
        int pgNow;
        int pgSize;
        //int UrgeType=0;
        //int UrgeStatus=0;
        //string CreateDateS;
        string IdNo;


        IdNo = Request.Form["IdNo"] ?? "";
        //CreateDateE = Request.Form["CreateDateE"] ?? "";
        //if (CreateDateS != "") CreateDateS = (Convert.ToInt32(CreateDateS.Substring(0, 3)) + 1911).ToString() + "/" + CreateDateS.Substring(3, 2) + "/" + CreateDateS.Substring(5, 2);
        //if (CreateDateE != "") CreateDateE = (Convert.ToInt32(CreateDateE.Substring(0, 3)) + 1911).ToString() + "/" + CreateDateE.Substring(3, 2) + "/" + CreateDateE.Substring(5, 2);


        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        //int.TryParse(Request.Form["UrgeType"], out UrgeType);
        //int.TryParse(Request.Form["UrgeStatus"], out UrgeStatus);


        SystemCode.Update();
        DataSet ds = new DataSet();

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("dbo.usp_Log_xLogIdFilterList", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@pgNow", pgNow == 0 ? 1 : pgNow);
                cmd.Parameters.AddWithValue("@pgSize", pgSize == 0 ? 10 : pgSize);
                cmd.Parameters.AddWithValue("@IdNo", IdNo);
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    sc.Open();
                    da.Fill(ds);
                }
            }
        }

        List <LogListVM> list = new List <LogListVM>();
        PageVM           rtn  = new PageVM();

        EntityS.FillModel(list, ds.Tables[0]);
        EntityS.FillModel(rtn, ds.Tables[1]);
        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
示例#19
0
    protected void dllInit()
    {
        SystemCode.Update();
        if (SystemCode.dict.ContainsKey("CaseUser_ContactRelationShip"))
        {
            List <SystemCodeVM> SystemCodeList = SystemCode.dict["CaseUser_ContactRelationShip"];

            foreach (SystemCodeVM sc in SystemCodeList)
            {
                ddlRS.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
            }
        }
    }
示例#20
0
    public static string HtmlSelect(string inputid, string inputname, string SystemCodeCate, string SelectVal)
    {
        string select  = "<select   {2}  {0}  >{1}</select>";
        string options = "";
        List <SystemCodeVM> SystemCodeList = SystemCode.GetDict(SystemCodeCate);

        foreach (SystemCodeVM sc in SystemCodeList)
        {
            options += string.Format("<option value=\"{1}\" {2} >{0}</option>", sc.EnumName, sc.EnumValue.ToString(), (sc.EnumValue.ToString() == SelectVal ? "selected" : ""));
        }

        return(string.Format(select, (inputid != "" ? " id=\"" + inputid + "\"" : ""), options, (inputname != "" ? " name=\"" + inputname + "\"" : "")));
    }
示例#21
0
        public async Task <bool> AddSystem(SystemCode entity)
        {
            await _context.SystemCodes.AddAsync(entity);

            try
            {
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#22
0
 public void SaveChanges(SystemCode system = SystemCode.Identity)
 {
     try { GetContext(system).SaveChanges(); }
     catch (DbEntityValidationException e) {
         var sb = new StringBuilder();
         foreach (var eve in e.EntityValidationErrors)
         {
             sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State));
             foreach (var ve in eve.ValidationErrors)
             {
                 sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage));
             }
         }
         throw new Exception(sb.ToString());
     }
 }
示例#23
0
  private void ShowFiles(int VisitID, bool bDownload)
  {
      DataTable dt = (DataTable)DBUtil.DBOp("ConnDB", "SELECT  isnull(C_CaseVisitFile.Filetype,0) Filetype,C_CaseVisitFile.ID,[FileID]  ,F_FileInfo.DisplayFileName FROM [dbo].[C_CaseVisitFile] inner join F_FileInfo on F_FileInfo.ID = [C_CaseVisitFile].FileID and [C_CaseVisitFile].VisitID={0} and C_CaseVisitFile.LogicDel=0", new string[] { VisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);

      foreach (DataRow r in dt.Rows)
      {
          string filetype = SystemCode.GetName("CaseVisit_VisitFileType", Convert.ToInt32(r["Filetype"]));

          if (bDownload)
          {
              ltFiles.Text += string.Format("<div id=\"FileDIV_{2}\"><a href=\"DownloadFileOP.aspx?i={1}\">{3} : {0}</a> <img src=\"/images/icon_del01.gif\"  class=\"delFile\" id=\"img_del_{2}\" />;</div>", Server.HtmlEncode(r["DisplayFileName"].ToString()), Server.HtmlEncode(r["FileID"].ToString()), Server.HtmlEncode(r["ID"].ToString()), filetype);
          }
          else
          {
              ltFiles.Text += filetype + ":" + Server.HtmlEncode(r["DisplayFileName"].ToString()) + ";";
          }
      }
  }
示例#24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //base.DisableTop(true);
        int r = 0;

        int.TryParse(Request["r"], out r);
        //SystemCode.Update();
        if (r > 0)
        {
            string ResultCatKey = "CaseVisit_VisitResult_Reason_" + r.ToString();

            List <SystemCodeVM> SystemCodeList = SystemCode.GetDict(ResultCatKey);
            VisitResultData = JsonConvert.SerializeObject(SystemCodeList);
        }

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(VisitResultData);
        Response.End();
    }
示例#25
0
 /// <summary>
 /// 取得单个信息体的解析规则
 /// </summary>
 /// <param name="body"></param>
 /// <returns></returns>
 public static InfoUnitAddress getInfoUnitAddress(string body)
 {
     try
     {
         //取出测点
         int address = (int)SystemCode.HexNumberToDenary(body.Substring(1 * 2, 2 * 2), true, 16, 'u');
         //取得不同信息单元地址对应的解析规则
         DataType dy = new DataType();
         if (DataType.deviceTypeMap.ContainsKey(address))
         {
             return((InfoUnitAddress)DataType.deviceTypeMap[address]);
         }
     }
     catch (Exception ee)
     {
         Console.WriteLine(ee.StackTrace);
     }
     return(null);
 }
示例#26
0
    protected void btnRemove_Click(object sender, EventArgs e)
    {
        if (IsValid == false)
        {
            return;
        }

        int Chk = 0;

        Dictionary <string, object> OutDict = new Dictionary <string, object>()
        {
            { "@Chk", Chk }
        };

        MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_CodeM_xDeleteSystemCodeByID"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@SystemCodeID", ID }
        });

        Chk = (int)OutDict["@Chk"];

        string script = "";

        if (Chk > 0)
        {
            script = string.Format("{0}<script>alert('儲存成功');location.href='{1}#{2}';</script>",
                                   "<style>body{display:none;}</style>"
                                   , "/System/CodeM/CodeSetting_Detail.aspx?i=" + CateID
                                   , HttpUtility.HtmlDecode(GetString("hash") ?? "")
                                   );

            SystemCode.Update();
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
示例#27
0
        public async Task <bool> UpdateSystem(SystemCode entity)
        {
            try
            {
                var item = await _context.SystemCodes.AnyAsync(x => x.ID == entity.ID);

                if (item == false)
                {
                    return(false);
                }
                _context.SystemCodes.Update(entity);
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);
        base.BodyClass = "class='bodybg'";

        user = AuthServer.GetLoginUser();
        if (this.IsPostBack == false)
        {
            List <int> list = new List <int>()
            {
                1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
            };
            var dict = SystemCode.GetDict("RecordM_StudentRecord_VaccineCate");

            if (dict.Count > 0)
            {
                var query = dict.Where(item => list.Contains(item.EnumValue));
                tbAry = JsonConvert.SerializeObject(query);
            }

            int nowYear = DateTime.Now.Year - 1911;
            ddlYear.Items.Add(new ListItem(nowYear.ToString() + "年", nowYear.ToString()));
            ddlYear.Items.Add(new ListItem((nowYear + 1).ToString() + "年", (nowYear + 1).ToString()));

            //if (SystemElementarySchool.list.Count > 0)
            //{
            //    ddlSchool.Items.Add(new ListItem("0", "請選擇學校名稱"));
            //    foreach(var item in SystemElementarySchool.list)
            //    {
            //        ddlSchool.Items.Add(new ListItem(item.ElementarySchoolID.ToString(), item.SchoolName));
            //    }
            //}


            if (SystemElementarySchool.list.Count > 0)
            {
                sAry = JsonConvert.SerializeObject(SystemElementarySchool.list);
            }
        }
    }
示例#29
0
        private string GenerateToken(UserAuthorization user, DateTime expires, SystemCode SystemCode)
        {
            var            handler  = new JwtSecurityTokenHandler();
            ClaimsIdentity identity = new ClaimsIdentity(
                new GenericIdentity(user.LoginID, "TokenAuth"),
                new[] {
                new Claim("ID", user.ID.ToString()),
                new Claim("SystemCode", ((int)SystemCode).ToString())
            }
                );
            var securityToken = handler.CreateToken(new SecurityTokenDescriptor
            {
                Issuer             = TokenAuthOption.Issuer,
                Audience           = TokenAuthOption.Audience,
                SigningCredentials = TokenAuthOption.SigningCredentials,
                Subject            = identity,
                Expires            = expires
            });

            return(handler.WriteToken(securityToken));
        }
示例#30
0
    private string ShowFiles(int VisitID, bool bDownload)
    {
        StringBuilder sb = new StringBuilder("");

        DataTable dt = (DataTable)DBUtil.DBOp("ConnDB", "SELECT  isnull(C_CaseVisitFile.Filetype,0) Filetype,C_CaseVisitFile.ID,[FileID]  ,F_FileInfo.DisplayFileName FROM [dbo].[C_CaseVisitFile] inner join F_FileInfo on F_FileInfo.ID = [C_CaseVisitFile].FileID and [C_CaseVisitFile].VisitID={0} and C_CaseVisitFile.LogicDel=0", new string[] { VisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);

        foreach (DataRow r in dt.Rows)
        {
            string filetype = SystemCode.GetName("CaseVisit_VisitFileType", Convert.ToInt32(r["Filetype"]));

            if (bDownload)
            {
                sb.AppendFormat("<div id=\"FileDIV_{2}\"><a href=\"DownloadFileOP.aspx?i={1}\">{3} : {0}</a> ;</div>", Server.HtmlEncode(r["DisplayFileName"].ToString()), Server.HtmlEncode(r["FileID"].ToString()), Server.HtmlEncode(r["ID"].ToString()), filetype);
            }
            else
            {
                sb.Append(filetype + ":" + Server.HtmlEncode(r["DisplayFileName"].ToString()) + ";");
            }
        }
        return(sb.ToString());
    }