示例#1
0
        public async Task <IActionResult> GetSysInfo()
        {
            CommonResult result = new CommonResult();

            try
            {
                SysSetting        sysSetting        = XmlConverter.Deserialize <SysSetting>("xmlconfig/sys.config");
                YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
                yuebonCacheHelper.Add("SysSetting", sysSetting);
                DashboardOutModel dashboardOutModel = new DashboardOutModel();
                dashboardOutModel.CertificatedCompany = sysSetting.CompanyName;
                dashboardOutModel.WebUrl               = sysSetting.WebUrl;
                dashboardOutModel.Title                = sysSetting.SoftName;
                dashboardOutModel.MachineName          = Environment.MachineName;
                dashboardOutModel.ProcessorCount       = Environment.ProcessorCount;
                dashboardOutModel.SystemPageSize       = Environment.SystemPageSize;
                dashboardOutModel.WorkingSet           = Environment.WorkingSet;
                dashboardOutModel.TickCount            = Environment.TickCount;
                dashboardOutModel.RunTimeLength        = (Environment.TickCount / 1000).ToBrowseTime();
                dashboardOutModel.FrameworkDescription = RuntimeInformation.FrameworkDescription;
                dashboardOutModel.OSName               = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "Linux" : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "OSX" : "Windows";
                dashboardOutModel.OSDescription        = RuntimeInformation.OSDescription + " " + RuntimeInformation.OSArchitecture;
                dashboardOutModel.OSArchitecture       = RuntimeInformation.OSArchitecture.ToString();
                dashboardOutModel.ProcessArchitecture  = RuntimeInformation.ProcessArchitecture.ToString();

                dashboardOutModel.Directory = AppContext.BaseDirectory;
                Version version = Environment.Version;
                dashboardOutModel.SystemVersion = version.Major + "." + version.Minor + "." + version.Build;
                dashboardOutModel.Version       = AppVersionHelper.Version;
                dashboardOutModel.Manufacturer  = AppVersionHelper.Manufacturer;
                dashboardOutModel.WebSite       = AppVersionHelper.WebSite;
                dashboardOutModel.UpdateUrl     = AppVersionHelper.UpdateUrl;
                dashboardOutModel.IPAdress      = Request.HttpContext.Connection.LocalIpAddress.ToString();
                dashboardOutModel.Port          = Request.HttpContext.Connection.LocalPort.ToString();
                dashboardOutModel.TotalUser     = await userService.GetCountByWhereAsync("1=1");

                dashboardOutModel.TotalModule = await menuService.GetCountByWhereAsync("1=1");

                dashboardOutModel.TotalRole = await roleService.GetCountByWhereAsync("1=1");

                dashboardOutModel.TotalTask = await taskManagerService.GetCountByWhereAsync("1=1");

                result.ResData = dashboardOutModel;
                result.ErrCode = ErrCode.successCode;
            }
            catch (Exception ex)
            {
                Log4NetHelper.Error("获取系统信息异常", ex);
                result.ErrMsg  = ErrCode.err60001;
                result.ErrCode = "60001";
            }
            return(ToJsonContent(result));
        }
示例#2
0
        public IActionResult Save(SysSetting info)
        {
            CommonResult result = new CommonResult();

            info.LocalPath = _hostingEnvironment.WebRootPath;
            SysSetting sysSetting = XmlConverter.Deserialize <SysSetting>("xmlconfig/sys.config");

            sysSetting = info;
            //对关键信息加密
            if (!string.IsNullOrEmpty(info.Email))
            {
                sysSetting.Email = DEncrypt.Encrypt(info.Email);
            }
            if (!string.IsNullOrEmpty(info.Emailsmtp))
            {
                sysSetting.Emailsmtp = DEncrypt.Encrypt(info.Emailsmtp);
            }
            if (!string.IsNullOrEmpty(info.Emailpassword))
            {
                sysSetting.Emailpassword = DEncrypt.Encrypt(info.Emailpassword);
            }
            if (!string.IsNullOrEmpty(info.Smspassword))
            {
                sysSetting.Smspassword = DEncrypt.Encrypt(info.Smspassword);
            }
            if (!string.IsNullOrEmpty(info.Smsusername))
            {
                sysSetting.Smsusername = DEncrypt.Encrypt(info.Smsusername);
            }
            string uploadPath = _hostingEnvironment.WebRootPath + "/" + sysSetting.Filepath;

            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }
            YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();

            if (yuebonCacheHelper.Exists("SysSetting"))
            {
                yuebonCacheHelper.Replace("SysSetting", sysSetting);
            }
            else
            {
                //写入缓存
                yuebonCacheHelper.Add("SysSetting", sysSetting);
            }
            XmlConverter.Serialize <SysSetting>(sysSetting, "xmlconfig/sys.config");
            result.ErrCode = ErrCode.successCode;
            return(ToJsonContent(result));
        }
示例#3
0
        public SysSetting ToEntity()
        {
            var sysSetting = new SysSetting
            {
                ID = ID,
                KeyName = KeyName,
                ValueType = ValueType,
                Value = Value,
                Description = Description,
                KeyGroup = KeyGroup
            };

            return sysSetting;
        }
        public override async Task <IActionResult> DeleteBatchAsync(DeletesInputDto info)
        {
            CommonResult result = new CommonResult();

            string where = string.Empty;
            where        = "id in ('" + info.Ids.Join(",").Trim(',').Replace(",", "','") + "')";

            if (!string.IsNullOrEmpty(where))
            {
                dynamic[] jobsId = info.Ids;
                foreach (var item in jobsId)
                {
                    if (string.IsNullOrEmpty(item.ToString()))
                    {
                        continue;
                    }
                    UploadFile        uploadFile        = new UploadFileApp().Get(item.ToString());
                    YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
                    SysSetting        sysSetting        = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
                    if (uploadFile != null)
                    {
                        if (System.IO.File.Exists(sysSetting.LocalPath + "/" + uploadFile.FilePath))
                        {
                            System.IO.File.Delete(sysSetting.LocalPath + "/" + uploadFile.FilePath);
                        }
                        if (!string.IsNullOrEmpty(uploadFile.Thumbnail))
                        {
                            if (System.IO.File.Exists(sysSetting.LocalPath + "/" + uploadFile.Thumbnail))
                            {
                                System.IO.File.Delete(sysSetting.LocalPath + "/" + uploadFile.Thumbnail);
                            }
                        }
                    }
                }
                bool bl = await iService.DeleteBatchWhereAsync(where).ConfigureAwait(false);

                if (bl)
                {
                    result.ErrCode = ErrCode.successCode;
                    result.ErrMsg  = ErrCode.err0;
                }
                else
                {
                    result.ErrMsg  = ErrCode.err43003;
                    result.ErrCode = "43003";
                }
            }
            return(ToJsonContent(result));
        }
示例#5
0
        public async Task <IActionResult> Save(SysSetting model, string columns = "")
        {
            var errMsg = GetModelErrMsg();

            if (!string.IsNullOrEmpty(errMsg))
            {
                return(ErrRes(errMsg));
            }
            model.Status = model.Status ?? 2;
            if (string.IsNullOrEmpty(model.SysSettingId) || !_unitOfWork.SysSettingRepository.Any(o => o.SysSettingId == model.SysSettingId))
            {
                //model.SysSettingId = GuidKey;
                model.CreateTime = DateTime.Now;
                model.CreateUser = Id;

                result = await _unitOfWork.SysSettingRepository.InsertAsync(model);

                if (result)
                {
                    _logger.LogInformation($"添加{_entityName}{model.SysSettingName}");
                }
            }
            else
            {
                //定义可以修改的列
                var lstColumn = new List <string>()
                {
                    nameof(SysSetting.SysSettingName), nameof(SysSetting.SysSettingGroup), nameof(SysSetting.Sort), nameof(SysSetting.Remark), nameof(SysSetting.Status), nameof(SysSetting.SetValue), nameof(SysSetting.SysSettingType),
                };
                if (!string.IsNullOrEmpty(columns))//固定过滤只修改某字段
                {
                    if (lstColumn.Count == 0)
                    {
                        lstColumn = columns.Split(',').ToList();
                    }
                    else
                    {
                        lstColumn = lstColumn.Where(o => columns.Split(',').Contains(o)).ToList();
                    }
                }
                result = await _unitOfWork.SysSettingRepository.UpdateAsync(model, true, lstColumn);

                if (result)
                {
                    _logger.LogInformation($"修改{_entityName}{model.SysSettingName}");
                }
            }
            return(result ? SuccessRes() : ErrRes());
        }
示例#6
0
        public IActionResult GetAllInfo()
        {
            CommonResult        result              = new CommonResult();
            YuebonCacheHelper   yuebonCacheHelper   = new YuebonCacheHelper();
            SysSetting          sysSetting          = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
            SysSettingOutputDto sysSettingOutputDto = new SysSettingOutputDto();

            if (sysSetting == null)
            {
                sysSetting = XmlConverter.Deserialize <SysSetting>("xmlconfig/sys.config");
            }

            //对关键信息解密
            if (!string.IsNullOrEmpty(sysSetting.Email))
            {
                sysSetting.Email = DEncrypt.Decrypt(sysSetting.Email);
            }
            if (!string.IsNullOrEmpty(sysSetting.Emailsmtp))
            {
                sysSetting.Emailsmtp = DEncrypt.Decrypt(sysSetting.Emailsmtp);
            }
            if (!string.IsNullOrEmpty(sysSetting.Emailpassword))
            {
                sysSetting.Emailpassword = DEncrypt.Decrypt(sysSetting.Emailpassword);
            }
            if (!string.IsNullOrEmpty(sysSetting.Smspassword))
            {
                sysSetting.Smspassword = DEncrypt.Decrypt(sysSetting.Smspassword);
            }
            if (!string.IsNullOrEmpty(sysSetting.Smsusername))
            {
                sysSetting.Smsusername = DEncrypt.Decrypt(sysSetting.Smsusername);
            }
            sysSettingOutputDto = sysSetting.MapTo <SysSettingOutputDto>();
            if (sysSettingOutputDto != null)
            {
                sysSettingOutputDto.CopyRight = UIConstants.CopyRight;
                result.ResData = sysSettingOutputDto;
                result.Success = true;
                result.ErrCode = ErrCode.successCode;
            }
            else
            {
                result.ErrMsg  = ErrCode.err60001;
                result.ErrCode = "60001";
            }
            return(ToJsonContent(result));
        }
示例#7
0
        private void InitSubForm()
        {
            panel1.Controls.Clear();
            MainForm mForm = new MainForm();

            mForm.TopLevel = false;
            mForm.Dock     = DockStyle.Fill;
            mForm.Parent   = this.panel1;
            panel1.Controls.Add(mForm);
            //mForm.Show();
            //mssa.ControlInitSize(this); //比例最大化的初始化
            //curForm = mForm;
            SysSetting sysSetForm = new SysSetting();

            sysSetForm.TopLevel = false;
            //mForm.FormBorderStyle = FormBorderStyle.None;
            sysSetForm.Dock   = DockStyle.Fill;
            sysSetForm.Parent = this.panel1;
        }
示例#8
0
        public IActionResult DeleteFile(string id)
        {
            CommonResult result = new CommonResult();

            try
            {
                UploadFile uploadFile = new UploadFileApp().Get(id);

                YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
                SysSetting        sysSetting        = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
                string            localpath         = _hostingEnvironment.WebRootPath;
                if (uploadFile != null)
                {
                    string filepath = (localpath + "/" + uploadFile.FilePath).ToFilePath();
                    if (System.IO.File.Exists(filepath))
                    {
                        System.IO.File.Delete(filepath);
                    }
                    string filepathThu = (localpath + "/" + uploadFile.Thumbnail).ToFilePath();
                    if (System.IO.File.Exists(filepathThu))
                    {
                        System.IO.File.Delete(filepathThu);
                    }

                    result.ErrCode = ErrCode.successCode;
                    result.Success = true;
                }
                else
                {
                    result.ErrCode = ErrCode.failCode;
                    result.Success = false;
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.Error("", ex);
                result.ErrCode = "500";
                result.ErrMsg  = ex.Message;
            }
            return(ToJsonContent(result));
        }
        public SysSetting GetSysSetting(Guid id)
        {
            SysSetting sysSetting = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetSysSetting]";
                        cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = id;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                if (sdr.Read())
                                {
                                    sysSetting       = new SysSetting();
                                    sysSetting.ID    = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : sysSetting.ID);
                                    sysSetting.Name  = (sdr["Name"].ToString() != "" ? sdr["Name"].ToString() : sysSetting.Name);
                                    sysSetting.Value = (sdr["Value"].ToString() != "" ? sdr["Value"].ToString() : sysSetting.Value);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(sysSetting);
        }
示例#10
0
 public int Edit(SysSetting model)
 {
     if (model.Id == 0)
     {
         model.Id = Common.PrimaryKey.GetHashCodeID;
         DB.Set <SysSetting>().Add(model);
     }
     else
     {
         var line = DB.SysSetting.Where(c => c.Id == model.Id).Update(b => new SysSetting
         {
             TimeStamp  = DateTime.Now,
             SystemName = model.SystemName,
             Contact    = model.Contact,
             Feeback    = model.Feeback,
             IsEnable   = model.IsEnable
         });
         if (!string.IsNullOrEmpty(model.LoginLogo))
         {
             line = DB.SysSetting.Where(c => c.Id == model.Id).Update(b => new SysSetting {
                 LoginLogo = model.LoginLogo
             });
         }
         if (!string.IsNullOrEmpty(model.FootLogo))
         {
             line = DB.SysSetting.Where(c => c.Id == model.Id).Update(b => new SysSetting {
                 FootLogo = model.FootLogo
             });
         }
         if (!string.IsNullOrEmpty(model.HomeLogo))
         {
             line = DB.SysSetting.Where(c => c.Id == model.Id).Update(b => new SysSetting {
                 HomeLogo = model.HomeLogo
             });
         }
         return(line);
     }
     return(DB.SaveChanges());
 }
示例#11
0
文件: Main.cs 项目: liusile/WGProject
 private void ToolSysSetting_Click(object sender, EventArgs e)
 {
     try
     {
         Form frm = new SysSetting();
         frm.ShowDialog();
         var sysConfig = new SysConfigService().Get();
         SysConfig.PrintType    = sysConfig.PrintType;
         SysConfig.IP           = sysConfig.IP;
         SysConfig.Port         = sysConfig.Port;
         SysConfig.DomainName   = sysConfig.DomainName;
         SysConfig.ScanPortName = sysConfig.ScanPortName;
         if (serialPort_Scan.IsOpen)
         {
             serialPort_Scan.Close();
         }
         serialPort_Scan.PortName = SysConfig.ScanPortName ?? "";
         serialPort_Scan.Open();
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#12
0
        private void sysBtn_Click(object sender, EventArgs e)
        {
            if (lastSender == sender)
            {
                return;
            }

            if (curForm != null)
            {
                curForm.Close();
            }

            SysSetting form = new SysSetting();

            panel1.Controls.Clear();
            form.TopLevel = false;
            form.Dock     = DockStyle.Fill;
            form.Parent   = this.panel1;
            panel1.Controls.Add(form);
            form.Show();
            mssa.ControlInitSize(this); //比例最大化的初始化
            curForm    = form;
            lastSender = sender;
        }
示例#13
0
        public IActionResult GetInfo()
        {
            CommonResult        result              = new CommonResult();
            YuebonCacheHelper   yuebonCacheHelper   = new YuebonCacheHelper();
            SysSetting          sysSetting          = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
            SysSettingOutputDto sysSettingOutputDto = new SysSettingOutputDto();

            if (sysSetting == null)
            {
                sysSetting = XmlConverter.Deserialize <SysSetting>("xmlconfig/sys.config");
            }
            sysSetting.Email         = "";
            sysSetting.Emailsmtp     = "";
            sysSetting.Emailpassword = "";
            sysSetting.Smspassword   = "";
            sysSetting.SmsSignName   = "";
            sysSetting.Smsusername   = "";
            sysSettingOutputDto      = sysSetting.MapTo <SysSettingOutputDto>();
            if (sysSettingOutputDto != null)
            {
                sysSettingOutputDto.CopyRight = UIConstants.CopyRight;
                result.ResData = sysSettingOutputDto;
                result.Success = true;
                result.ErrCode = ErrCode.successCode;
            }
            else
            {
                result.ErrMsg  = ErrCode.err60001;
                result.ErrCode = "60001";
            }

            IEnumerable <APP> appList = aPPService.GetAllByIsNotDeleteAndEnabledMark();

            yuebonCacheHelper.Add("AllowAppId", appList);
            return(ToJsonContent(result));
        }
示例#14
0
    protected void logOut_Click(object sender, EventArgs e)
    {
        if (Session["account"] != null || Session["player"] != null)
        {
            string userName = string.Empty;
            if (Session["account"] == null)
            {
                userName = ((Lib.Player)(Session["player"])).ID;
                SysSetting.AddLog("登入", userName, "一般受測人員登出成功", DateTime.Now);
            }
            else
            {
                userName = ((Lib.Account)(Session["account"])).ID;
                SysSetting.AddLog("登入", userName, "進階使用者登出成功", DateTime.Now);
            }

            Session.Clear();
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            Response.Redirect("~/Login.aspx");
        }
    }
示例#15
0
 /// <summary>
 /// 设置系统参数序列化
 /// </summary>
 /// <param name="set"></param>
 public static void SetSetting(SysSetting set)
 {
     Voodoo.IO.XML.SaveSerialize(set, settingPath);
 }
示例#16
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            User         u   = UserAction.opuser;
            UserGroup    g   = //UserGroupView.GetModelByID(u.Group.ToS());
                               (from l in ent.UserGroup where l.ID == u.Group select l).FirstOrDefault();

            if (FileUpload1.FileName.IsNullOrEmpty())
            {
                Js.AlertAndGoback("为提高您文章的排名,请选择一张标题图片");
                return;
            }

            #region    图片
            SysSetting ss = BasePage.SystemSetting;

            HttpPostedFile file     = Request.Files["FileUpload1"];
            string         FileName = file.FileName.GetFileNameFromPath();    //文件名
            string         ExtName  = file.FileName.GetFileExtNameFromPath(); //扩展名
            string         NewName  = @string.GetGuid() + ExtName;            //新文件名

            if (!ExtName.Replace(".", "").IsInArray(ss.FileExtNameFilter.Split(',')))
            {
                Js.AlertAndGoback("不允许上传此类文件");
                return;
            }
            if (file.ContentLength > ss.MaxPostFileSize)
            {
                Js.AlertAndGoback("文件太大");
                return;
            }

            string Folder        = ss.FileDir + "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/"; //文件目录
            string FolderShotCut = Folder + "ShortCut/";                                         //缩略图目录

            string FilePath          = Folder + NewName;                                         //文件路径
            string FilePath_ShortCut = FolderShotCut + NewName;                                  //缩略图路径

            file.SaveAs(Server.MapPath(FilePath), true);
            ImageHelper.MakeThumbnail(Server.MapPath(FilePath), Server.MapPath(FilePath_ShortCut), 105, 118, "Cut");



            FileInfo savedFile = new FileInfo(Server.MapPath(FilePath));

            Voodoo.Basement.File f = new Voodoo.Basement.File();

            f.FileDirectory = ss.FileDir;
            f.FileExtName   = ExtName;
            f.FilePath      = FilePath;
            f.FileSize      = (savedFile.Length / 1024).ToInt32();
            //f.FileType=
            f.SmallPath = FilePath_ShortCut;
            f.UpTime    = DateTime.Now;

            ent.AddToFile(f);
            ent.SaveChanges();
            #endregion


            News n = new News();
            n.Author      = txt_Author.Text.TrimDbDangerousChar();
            n.AutorID     = UserAction.opuser.ID;
            n.ClassID     = ddl_Class.SelectedValue.ToInt32();
            n.ClickCount  = 0;
            n.Content     = txt_Content.Text.TrimDbDangerousChar();
            n.Description = txt_Description.Text.TrimDbDangerousChar();
            n.DownCount   = 0;
            n.EnableReply = false;
            n.FTitle      = txtFtitle.Text.TrimDbDangerousChar();
            n.KeyWords    = txt_Keyword.Text.TrimDbDangerousChar();
            n.ModelID     = 0;
            n.NavUrl      = "";
            n.NewsTime    = DateTime.Now;
            n.SetTop      = false;
            n.Source      = txt_Source.Text.TrimDbDangerousChar();
            n.Title       = txt_Title.Text.TrimDbDangerousChar();
            n.TitleColor  = "000";
            n.TitleImage  = FilePath;//上传图片
            n.ZtID        = 0;
            n.Audit       = g.PostAotuAudit;
            n.FileForder  = DateTime.Now.ToString("yyyy-MM-dd");

            n.ID = WS.RequestInt("id");

            Result r = NewsAction.UserPost(n, UserAction.opuser);

            if (r.Success)
            {
                Js.AlertAndChangUrl(r.Text, "PostList.aspx");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }
            ent.Dispose();
        }
示例#17
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ISysSettingService sysSettingService = IoC.Resolve <ISysSettingService>();

            List <SysSetting> sysSettingList = new List <SysSetting>();
            //平台名称
            SysSetting sysSetting = new SysSetting();

            sysSetting.Key   = "PTMC";
            sysSetting.Value = this.txtTitle.Text;
            sysSettingList.Add(sysSetting);

            //网站开关
            SysSetting sysSetting1 = new SysSetting();

            sysSetting1.Key   = "WZKG";
            sysSetting1.Value = drpIsShowDialog.SelectedValue;
            sysSettingList.Add(sysSetting1);

            //网站公告开关
            SysSetting sysSetting2 = new SysSetting();

            sysSetting2.Key   = "WZGGKG";
            sysSetting2.Value = this.txtContent.Text;
            sysSettingList.Add(sysSetting2);

            //中奖排行开关
            SysSetting sysSetting3 = new SysSetting();

            sysSetting3.Key   = "ZJPHKG";
            sysSetting3.Value = drpShangBanOpen.SelectedValue;
            sysSettingList.Add(sysSetting3);


            //会员上榜最低中奖金额
            SysSetting sysSetting4 = new SysSetting();

            sysSetting4.Key   = "HYSPZDZJJE";
            sysSetting4.Value = this.txtMinMonery.Text;
            sysSettingList.Add(sysSetting4);

            //虚拟上榜会员昵称
            CreateSettingItem("XNSPHYNC", this.txtXuNiInContennt.Text, sysSettingList);
            //充值限制
            SysSetting sysSetting5 = new SysSetting();

            sysSetting5.Key   = "CZXZ";
            sysSetting5.Value = (string.IsNullOrEmpty(this.txtInMinMonery.Text.Trim()) ? "10" : this.txtInMinMonery.Text.Trim()) + "," + (string.IsNullOrEmpty(this.txtInMaxMonery.Text.Trim()) ? "50000" : this.txtInMaxMonery.Text.Trim());
            sysSettingList.Add(sysSetting5);
            //提现限制
            SysSetting sysSetting6 = new SysSetting();

            sysSetting6.Key   = "TXXZ";
            sysSetting6.Value = (string.IsNullOrEmpty(this.txtOutMinMonery.Text.Trim()) ? "100" : this.txtOutMinMonery.Text.Trim()) + "," + (string.IsNullOrEmpty(this.txtOutMaxMonery.Text.Trim()) ? "50000" : this.txtOutMaxMonery.Text.Trim());
            sysSettingList.Add(sysSetting6);
            //注册赠送活动
            SettingDTO settingDto = new SettingDTO()
            {
                p1 = this.chkopenZengSong.Checked ? "0" : "1",
                p2 = txtNewUserZenSong.Text.Trim(),
                p3 = txtNewUserBeiShu.Text.Trim(),
            };
            var        des         = Newtonsoft.Json.JsonConvert.SerializeObject(settingDto);
            SysSetting sysSetting7 = new SysSetting();

            sysSetting7.Key   = "ZCZSHD";
            sysSetting7.Value = des;
            sysSettingList.Add(sysSetting7);

            double outBili = 5;

            if (double.TryParse(this.txtRechangeMinBili.Text.Trim(), out outBili))
            {
                SysSetting sysSetting8 = new SysSetting();
                sysSetting8.Key   = "chongzhiBili";
                sysSetting8.Value = outBili.ToString();
                sysSettingList.Add(sysSetting8);
            }

            //登录失败时跳转
            SysSetting sysSetting9 = new SysSetting();

            sysSetting9.Key   = "ZXLTPATH";
            sysSetting9.Value = this.txtUrl.Text.Trim();
            sysSettingList.Add(sysSetting9);


            //客服地址
            SysSetting sysSetting10 = new SysSetting();

            sysSetting10.Key   = "KHLJ";
            sysSetting10.Value = this.txtKfAddress.Text.Trim();
            sysSettingList.Add(sysSetting10);

            //提现审核
            SysSetting sysSetting11 = new SysSetting();

            sysSetting11.Key   = "QLZHGZ";
            sysSetting11.Value = this.txtShMonery.Text.Trim();
            sysSettingList.Add(sysSetting11);

            ////摩宝
            SysSetting sysSetting12 = new SysSetting();

            sysSetting12.Key   = "mobao_pay";
            sysSetting12.Value = this.drpMb.SelectedValue;
            sysSettingList.Add(sysSetting12);

            ////智付
            SysSetting sysSetting13 = new SysSetting();

            sysSetting13.Key   = "zhifu_pay";
            sysSetting13.Value = this.drpzhifu.SelectedValue;
            sysSettingList.Add(sysSetting13);

            ////my18
            SysSetting sysSetting14 = new SysSetting();

            sysSetting14.Key   = "my18_pay";
            sysSetting14.Value = this.drpMy18.SelectedValue;
            sysSettingList.Add(sysSetting14);

            ////是否开启提现
            SysSetting sysSetting15 = new SysSetting();

            sysSetting15.Key   = "ti_xian_isopen";
            sysSetting15.Value = this.drptx.SelectedValue;
            sysSettingList.Add(sysSetting15);

            ////关闭提现功能原因
            SysSetting sysSetting16 = new SysSetting();

            sysSetting16.Key   = "ti_xian_shi_bai_info";
            sysSetting16.Value = this.txtTxErrorMsg.Text;
            sysSettingList.Add(sysSetting16);

            ////支付宝充值
            string zfbpath = SaveZfbImage();

            if (!string.IsNullOrEmpty(zfbpath))
            {
                SysSetting sysSetting17 = new SysSetting();
                sysSetting17.Key   = "zhb_rect_url";
                sysSetting17.Value = zfbpath;
                sysSettingList.Add(sysSetting17);
            }

            ////微信充值
            string wxstr = SaveWxImage();

            if (!string.IsNullOrEmpty(wxstr))
            {
                SysSetting sysSetting18 = new SysSetting();
                sysSetting18.Key   = "wx_rect_url";
                sysSetting18.Value = wxstr;
                sysSettingList.Add(sysSetting18);
            }

            if (sysSettingService.Update(sysSettingList))
            {
                JsAlert("保存成功!");
            }
            else
            {
                JsAlert("保存失败!");
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        Image1.ImageUrl = "~/images/106_Seal_Sample.JPG";
        Acc             = Request.QueryString["Acc"].ToString();
        if (Page.IsPostBack == false)
        {
            hf_StartTime.Value = Label8.Text;
            hf_EndTime.Value   = Label9.Text;
            //hf_start.Value = "2015/01/01";

            Dictionary <string, object> d  = new Dictionary <string, object>();
            Lib.DataUtility             du = new Lib.DataUtility();
            d.Add("sid", Request.QueryString["sid"].ToString());
            d.Add("center_code", Request.QueryString["centercode"].ToString());
            //DataTable dt = du.getDataTableByText("SELECT P.PrevSID,P.start1_date,P.end1_date,T.ThisSID,T.start2_date,T.end2_date, N.NextSID,N.start3_date,N.end3_date FROM ( SELECT MAX(A.sid) PrevSID, (select start_date FROM Center_Seal where sid = MAX(A.sid)) start1_date,(select end_date FROM Center_Seal where sid = MAX(A.sid)) end1_date from Center_Seal A where A.sid < @sid and A.center_code = @center_code and A.rank_code=(select rank_code from Center_Seal where sid=@sid)) P CROSS JOIN ( SELECT MAX(A.sid) ThisSID, (select start_date FROM Center_Seal where sid = MAX(A.sid)) start2_date,(select end_date FROM Center_Seal where sid = MAX(A.sid)) end2_date from Center_Seal A where A.sid = @sid and A.center_code = @center_code and A.rank_code=(select rank_code from Center_Seal where sid=@sid)) T CROSS JOIN( SELECT MIN(A.sid) NextSID, (select start_date FROM Center_Seal where sid = MIN(A.sid)) start3_date,(select end_date FROM Center_Seal where sid = MAX(A.sid)) end3_date from Center_Seal A where A.sid > @sid and A.center_code = @center_code and A.rank_code=(select rank_code from Center_Seal where sid=@sid)) N ",d);
            //2016-8-16改用sp
            DataTable dt = du.getDataTableBysp("Ex106_Update_Seal", d);
            //前一筆:PrevSID、start1_date、end1_date
            //當筆:ThisSID、start2_date、end2_date
            //後一筆:NextSID、start3_date、end3_date
            //d.Add("start_date", dt.Rows[0]["start_date"]);

            //沒前面一筆,有當筆,沒有後一筆(010)(最前面一筆,只有一筆)
            if (string.IsNullOrEmpty(dt.Rows[0]["PrevSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["ThisSID"].ToString()) & string.IsNullOrEmpty(dt.Rows[0]["NextSID"].ToString()))
            {
                //設定時間
                PrevSID = dt.Rows[0]["PrevSID"].ToString();
                ThisSID = dt.Rows[0]["ThisSID"].ToString();
                NextSID = dt.Rows[0]["NextSID"].ToString();

                DateTime Now_startTime = (DateTime)dt.Rows[0]["start2_date"];
                Label6.Text   = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox1.Text = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox2.Text = dt.Rows[0]["sing_unit"].ToString();
                TextBox3.Text = dt.Rows[0]["sing_rank"].ToString();
                TextBox4.Text = dt.Rows[0]["sing_name"].ToString();
                old_time      = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                old_unit      = dt.Rows[0]["sing_unit"].ToString();
                old_rank      = dt.Rows[0]["sing_rank"].ToString();
                old_name      = dt.Rows[0]["sing_name"].ToString();
                DateTime Today = DateTime.Now;
                Label8.Text = "106/01/01";
                Label9.Text = Lib.SysSetting.ToRocDateFormat(Today.ToString("yyyy/MM/dd"));
            }

            //沒前面一筆,有當筆,也有後一筆(011)(最前面一筆,有多筆)
            else if (string.IsNullOrEmpty(dt.Rows[0]["PrevSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["ThisSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["NextSID"].ToString()))
            {
                //設定時間
                PrevSID = dt.Rows[0]["PrevSID"].ToString();
                ThisSID = dt.Rows[0]["ThisSID"].ToString();
                NextSID = dt.Rows[0]["NextSID"].ToString();

                DateTime Now_startTime    = (DateTime)dt.Rows[0]["start2_date"];
                DateTime Next_start_date  = (DateTime)dt.Rows[0]["start3_date"];
                DateTime Next2_start_date = Next_start_date.AddDays(-2);
                Label6.Text   = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox1.Text = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox2.Text = dt.Rows[0]["sing_unit"].ToString();
                TextBox3.Text = dt.Rows[0]["sing_rank"].ToString();
                TextBox4.Text = dt.Rows[0]["sing_name"].ToString();
                old_time      = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                old_unit      = dt.Rows[0]["sing_unit"].ToString();
                old_rank      = dt.Rows[0]["sing_rank"].ToString();
                old_name      = dt.Rows[0]["sing_name"].ToString();
                Label8.Text   = "106/01/01";
                Label9.Text   = Lib.SysSetting.ToRocDateFormat(Next2_start_date.ToString("yyyy/MM/dd"));
            }
            //有前面一筆,有當筆,沒後面一筆(110)(最後一筆)
            else if (!string.IsNullOrEmpty(dt.Rows[0]["PrevSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["ThisSID"].ToString()) & string.IsNullOrEmpty(dt.Rows[0]["NextSID"].ToString()))
            {
                //設定時間
                PrevSID = dt.Rows[0]["PrevSID"].ToString();
                ThisSID = dt.Rows[0]["ThisSID"].ToString();
                NextSID = dt.Rows[0]["NextSID"].ToString();

                DateTime Now_startTime    = (DateTime)dt.Rows[0]["start2_date"];
                DateTime Prev_start_date  = (DateTime)dt.Rows[0]["start1_date"];
                DateTime Prev2_start_date = Prev_start_date.AddDays(+2);
                DateTime Today            = DateTime.Now;
                Label6.Text   = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox1.Text = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox2.Text = dt.Rows[0]["sing_unit"].ToString();
                TextBox3.Text = dt.Rows[0]["sing_rank"].ToString();
                TextBox4.Text = dt.Rows[0]["sing_name"].ToString();
                old_time      = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                old_unit      = dt.Rows[0]["sing_unit"].ToString();
                old_rank      = dt.Rows[0]["sing_rank"].ToString();
                old_name      = dt.Rows[0]["sing_name"].ToString();
                Label8.Text   = Lib.SysSetting.ToRocDateFormat(Prev2_start_date.ToString("yyyy/MM/dd"));
                //Label9.Text = Lib.SysSetting.ToRocDateFormat(Today.ToString("yyyy/MM/dd"));
                Label9.Text = "";
            }

            //有三筆,前中後都要改(111)(多筆,剛好在中間)
            else if (!string.IsNullOrEmpty(dt.Rows[0]["PrevSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["ThisSID"].ToString()) & !string.IsNullOrEmpty(dt.Rows[0]["NextSID"].ToString()))//有三筆,前中後都要改
            {
                //設定時間
                PrevSID = dt.Rows[0]["PrevSID"].ToString();
                ThisSID = dt.Rows[0]["ThisSID"].ToString();
                NextSID = dt.Rows[0]["NextSID"].ToString();

                DateTime Now_startTime    = (DateTime)dt.Rows[0]["start2_date"];
                DateTime Prev_start_date  = (DateTime)dt.Rows[0]["start1_date"];
                DateTime Next_start_date  = (DateTime)dt.Rows[0]["start3_date"];
                DateTime Prev2_start_date = Prev_start_date.AddDays(+2);
                DateTime Next2_start_date = Next_start_date.AddDays(-2);
                Label6.Text   = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox1.Text = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                TextBox2.Text = dt.Rows[0]["sing_unit"].ToString();
                TextBox3.Text = dt.Rows[0]["sing_rank"].ToString();
                TextBox4.Text = dt.Rows[0]["sing_name"].ToString();
                old_time      = Lib.SysSetting.ToRocDateFormat(Now_startTime.ToString("yyyy/MM/dd"));
                old_unit      = dt.Rows[0]["sing_unit"].ToString();
                old_rank      = dt.Rows[0]["sing_rank"].ToString();
                old_name      = dt.Rows[0]["sing_name"].ToString();
                Label8.Text   = Lib.SysSetting.ToRocDateFormat(Prev2_start_date.ToString("yyyy/MM/dd"));
                Label9.Text   = Lib.SysSetting.ToRocDateFormat(Next2_start_date.ToString("yyyy/MM/dd"));
            }
            else
            {
                //查無資料
            }
        }

        if (Page.IsPostBack == true)
        {
            string new_time = string.Empty;
            if (CheckDateTimeType(TextBox1.Text) == true & !string.IsNullOrEmpty(TextBox1.Text) & !string.IsNullOrEmpty(TextBox2.Text) & !string.IsNullOrEmpty(TextBox3.Text) & !string.IsNullOrEmpty(TextBox4.Text))
            {
                Label3.Text = null;

                DateTime EndTime;//結束時間

                //2.判斷日期是否在合理範圍
                //轉回西元年
                try
                {
                    DateTime ChangeTime = Lib.SysSetting.ToWorldDate(TextBox1.Text);              //更改的時間
                    DateTime StartTime  = Lib.SysSetting.ToWorldDate(Label8.Text);                //起始時間
                    new_time = Lib.SysSetting.ToRocDateFormat(ChangeTime.ToString("yyyy/MM/dd")); //更改的時間轉為民國作比較
                    if (Label9.Text == "")
                    {
                        EndTime = Lib.SysSetting.ToWorldDate("999/12/31");//結束時間
                    }
                    else
                    {
                        EndTime = Lib.SysSetting.ToWorldDate(Label9.Text);//結束時間
                    }
                    //EndTime = Lib.SysSetting.ToWorldDate(Label9.Text);//結束時間
                    //2016-8-16新增更新簽章單位、級職、姓名
                    string sing_unit = TextBox2.Text;
                    string sing_rank = TextBox3.Text;
                    string sing_name = TextBox4.Text;

                    if (ChangeTime >= StartTime & ChangeTime <= EndTime)
                    {
                        Dictionary <string, object> dd  = new Dictionary <string, object>();
                        Lib.DataUtility             duu = new Lib.DataUtility();
                        dd.Add("PrevSID", PrevSID);
                        dd.Add("ThisSID", ThisSID);
                        dd.Add("NextSID", NextSID);
                        dd.Add("start_date", ChangeTime);              //當筆啟始時間
                        dd.Add("prev_date", (ChangeTime.AddDays(-1))); //上一筆結束時間
                        dd.Add("next_date", (ChangeTime.AddDays(+1))); //下一筆啟始時間
                        //2016-8-16新增更新簽章單位、級職、姓名
                        dd.Add("sing_unit", sing_unit);
                        dd.Add("sing_rank", sing_rank);
                        dd.Add("sing_name", sing_name);

                        //更新圖檔
                        //2016-8-16開始畫印章
                        string sing1_unit = string.Empty;
                        string sing1_rank = string.Empty;
                        string sing1_name = string.Empty;
                        //string jpg_Name = string.Empty;

                        sing1_unit = sing_unit;
                        sing1_rank = sing_rank;
                        sing1_name = sing_name;

                        Font s1_unit = null;                                       //鑑測官-單位
                        Font s1_rank = null;                                       //鑑測官-級職

                        Font seal_font_name = new Font("標楷體", 48, FontStyle.Bold); //姓名
                        if (sing1_unit.Length <= 6)
                        {
                            s1_unit = new Font("標楷體", 34, FontStyle.Bold);//6個字
                        }
                        else if (sing1_unit.Length == 7)
                        {
                            s1_unit = new Font("標楷體", 30, FontStyle.Bold);//7個字
                        }
                        else if (sing1_unit.Length == 8)
                        {
                            s1_unit = new Font("標楷體", 26, FontStyle.Bold);//8個字
                        }
                        else if (sing1_unit.Length == 9)
                        {
                            s1_unit = new Font("標楷體", 24, FontStyle.Bold);//9個字
                        }
                        else if (sing1_unit.Length == 10)
                        {
                            s1_unit = new Font("標楷體", 22, FontStyle.Bold);//10個字
                        }
                        else if (sing1_unit.Length == 11)
                        {
                            s1_unit = new Font("標楷體", 20, FontStyle.Bold);//11個字
                        }
                        else if (sing1_unit.Length == 12)
                        {
                            s1_unit = new Font("標楷體", 18, FontStyle.Bold);//12個字
                        }
                        else
                        {
                            s1_unit = new Font("標楷體", 16, FontStyle.Bold);//超過12個字
                        }
                        //判斷鑑測官-級職 字長度
                        if (sing1_rank.Length <= 6)
                        {
                            s1_rank = new Font("標楷體", 34, FontStyle.Bold);//6個字
                        }
                        else if (sing1_rank.Length == 7)
                        {
                            s1_rank = new Font("標楷體", 30, FontStyle.Bold);//7個字
                        }
                        else if (sing1_rank.Length == 8)
                        {
                            s1_rank = new Font("標楷體", 26, FontStyle.Bold);//8個字
                        }
                        else if (sing1_rank.Length == 9)
                        {
                            s1_rank = new Font("標楷體", 24, FontStyle.Bold);//9個字
                        }
                        else if (sing1_rank.Length == 10)
                        {
                            s1_rank = new Font("標楷體", 22, FontStyle.Bold);//10個字
                        }
                        else if (sing1_rank.Length == 11)
                        {
                            s1_rank = new Font("標楷體", 20, FontStyle.Bold);//11個字
                        }
                        else if (sing1_rank.Length == 12)
                        {
                            s1_rank = new Font("標楷體", 18, FontStyle.Bold);//12個字
                        }
                        else
                        {
                            s1_rank = new Font("標楷體", 16, FontStyle.Bold);//超過12個字
                        }

                        int height = 180;
                        int width  = 480;

                        Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);

                        Graphics g = Graphics.FromImage(bmp);
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                        g.Clear(Color.White);

                        StringFormat stringFormat = new StringFormat();
                        stringFormat.Alignment     = StringAlignment.Center;
                        stringFormat.LineAlignment = StringAlignment.Center;

                        Pen seal_pen = new Pen(Color.Red, 15);

                        g.DrawRectangle(seal_pen, 0, 0, 480, 180);           //鑑測官外框
                        //鑑測章內容
                        SolidBrush   redSB      = new SolidBrush(Color.Red); //字設成紅色
                        Pen          seal_pen2  = new Pen(Color.Red, 5);
                        StringFormat sealFormat = new StringFormat();
                        sealFormat.Alignment     = StringAlignment.Center;
                        sealFormat.LineAlignment = StringAlignment.Center;

                        DrawSpacedText(g, s1_unit, redSB, new Point(3, 30), sing1_unit, 260);
                        DrawSpacedText(g, s1_rank, redSB, new Point(3, 100), sing1_rank, 260);
                        DrawSpacedText(g, seal_font_name, redSB, new Point(245, 60), sing1_name, 240);

                        byte[] bytedata = (byte[])ImageToByte(bmp);
                        dd.Add("img_byte", bytedata);//加入圖檔索引

                        //開始更新,判斷要更新的欄位
                        //只有當筆(010)
                        if (string.IsNullOrEmpty(PrevSID) & !string.IsNullOrEmpty(ThisSID) & string.IsNullOrEmpty(NextSID))
                        {
                            duu.executeNonQueryByText("update Center_Seal set start_date=@start_date,sing_unit=@sing_unit,sing_rank=@sing_rank,sing_name=@sing_name,img_byte=@img_byte where sid=@ThisSID", dd);//更新當筆
                            //2016-9-7更新資料寫入log
                            if (old_time == new_time & old_unit == sing1_unit & old_rank == sing1_rank & old_name == sing1_name)
                            {
                                //都一樣沒更改,不產生log
                            }
                            else
                            {
                                //資料有異動,產生log
                                string event_log = string.Empty;
                                event_log += "[SID:" + ThisSID + "] ";
                                if (old_time != new_time)
                                {
                                    event_log += "啟用時間:" + old_time + "->" + new_time + "。";
                                }
                                if (old_unit != sing1_unit)
                                {
                                    event_log += "單位:" + old_unit + "->" + sing1_unit + "。";
                                }
                                if (old_rank != sing1_rank)
                                {
                                    event_log += "級職:" + old_rank + "->" + sing1_rank + "。";
                                }
                                if (old_name != sing1_name)
                                {
                                    event_log += "姓名:" + old_name + "->" + sing1_name + "。";
                                }

                                SysSetting.AddLog("簽章維護", Acc, event_log, DateTime.Now);
                            }


                            Label3.Text = "簽章更新成功!!";
                            PrevSID     = string.Empty;
                            ThisSID     = string.Empty;
                            NextSID     = string.Empty;
                            //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.close();window.opener.location.reload()", true);
                            //2016-9-12測試成功,先把方法傳回母視窗(刷新列表),再關掉子視窗
                            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside();window.close()", true);
                        }
                        //沒前面一筆,有當筆,也有後一筆(011)(最前面一筆,有多筆)
                        else if (string.IsNullOrEmpty(PrevSID) & !string.IsNullOrEmpty(ThisSID) & !string.IsNullOrEmpty(NextSID))
                        {
                            duu.executeNonQueryByText("update Center_Seal set start_date=@start_date,sing_unit=@sing_unit,sing_rank=@sing_rank,sing_name=@sing_name,img_byte=@img_byte where sid=@ThisSID", dd);//更新當筆
                            //duu.executeNonQueryByText("update Center_Seal set start_date=@next_date where sid=@NextSID", dd);//更新下一筆啟始時間
                            //Response.Redirect(Request.Url.ToString());

                            //2016-9-7更新資料寫入log
                            if (old_time == new_time & old_unit == sing1_unit & old_rank == sing1_rank & old_name == sing1_name)
                            {
                                //都一樣沒更改,不產生log
                            }
                            else
                            {
                                //資料有異動,產生log
                                string event_log = string.Empty;
                                event_log += "[SID:" + ThisSID + "] ";
                                if (old_time != new_time)
                                {
                                    event_log += "啟用時間:" + old_time + "->" + new_time + "。";
                                }
                                if (old_unit != sing1_unit)
                                {
                                    event_log += "單位:" + old_unit + "->" + sing1_unit + "。";
                                }
                                if (old_rank != sing1_rank)
                                {
                                    event_log += "級職:" + old_rank + "->" + sing1_rank + "。";
                                }
                                if (old_name != sing1_name)
                                {
                                    event_log += "姓名:" + old_name + "->" + sing1_name + "。";
                                }

                                SysSetting.AddLog("簽章維護", Acc, event_log, DateTime.Now);
                            }

                            Label3.Text = "簽章更新成功!!";
                            PrevSID     = string.Empty;
                            ThisSID     = string.Empty;
                            NextSID     = string.Empty;
                            //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.close();window.opener.location.reload()", true);
                            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside();window.close()", true);
                        }
                        ////有前面一筆,有當筆,沒後面一筆(110)(最後一筆)//TEST
                        else if (!string.IsNullOrEmpty(PrevSID) & !string.IsNullOrEmpty(ThisSID) & string.IsNullOrEmpty(NextSID))
                        {
                            duu.executeNonQueryByText("update Center_Seal set start_date=@start_date,sing_unit=@sing_unit,sing_rank=@sing_rank,sing_name=@sing_name,img_byte=@img_byte where sid=@ThisSID", dd); //更新當筆
                            duu.executeNonQueryByText("update Center_Seal set end_date=@prev_date where sid=@PrevSID", dd);                                                                                      //更新上一筆結束時間
                            //Response.Redirect(Request.Url.ToString());

                            //2016-9-7更新資料寫入log
                            if (old_time == new_time & old_unit == sing1_unit & old_rank == sing1_rank & old_name == sing1_name)
                            {
                                //都一樣沒更改,不產生log
                            }
                            else
                            {
                                //資料有異動,產生log
                                string event_log = string.Empty;
                                event_log += "[SID:" + ThisSID + "] ";
                                if (old_time != new_time)
                                {
                                    event_log += "啟用時間:" + old_time + "->" + new_time + "。";
                                }
                                if (old_unit != sing1_unit)
                                {
                                    event_log += "單位:" + old_unit + "->" + sing1_unit + "。";
                                }
                                if (old_rank != sing1_rank)
                                {
                                    event_log += "級職:" + old_rank + "->" + sing1_rank + "。";
                                }
                                if (old_name != sing1_name)
                                {
                                    event_log += "姓名:" + old_name + "->" + sing1_name + "。";
                                }

                                SysSetting.AddLog("簽章維護", Acc, event_log, DateTime.Now);
                            }

                            Label3.Text = "簽章更新成功!!";
                            PrevSID     = string.Empty;
                            ThisSID     = string.Empty;
                            NextSID     = string.Empty;
                            //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.close();window.opener.location.reload()", true);
                            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside();window.close()", true);
                        }
                        //有三筆,前中後都要改(111)(多筆,剛好在中間)
                        else if (!string.IsNullOrEmpty(PrevSID) & !string.IsNullOrEmpty(ThisSID) & !string.IsNullOrEmpty(NextSID))
                        {
                            duu.executeNonQueryByText("update Center_Seal set start_date=@start_date,sing_unit=@sing_unit,sing_rank=@sing_rank,sing_name=@sing_name,img_byte=@img_byte where sid=@ThisSID", dd); //更新當筆
                            //duu.executeNonQueryByText("update Center_Seal set start_date=@next_date where sid=@NextSID", dd);//更新下一筆啟始時間
                            duu.executeNonQueryByText("update Center_Seal set end_date=@prev_date where sid=@PrevSID", dd);                                                                                      //更新上一筆結束時間
                            //Response.Redirect(Request.Url.ToString());

                            //2016-9-7更新資料寫入log
                            if (old_time == new_time & old_unit == sing1_unit & old_rank == sing1_rank & old_name == sing1_name)
                            {
                                //都一樣沒更改,不產生log
                            }
                            else
                            {
                                //資料有異動,產生log
                                string event_log = string.Empty;
                                event_log += "[SID:" + ThisSID + "] ";
                                if (old_time != new_time)
                                {
                                    event_log += "啟用時間:" + old_time + "->" + new_time + "。";
                                }
                                if (old_unit != sing1_unit)
                                {
                                    event_log += "單位:" + old_unit + "->" + sing1_unit + "。";
                                }
                                if (old_rank != sing1_rank)
                                {
                                    event_log += "級職:" + old_rank + "->" + sing1_rank + "。";
                                }
                                if (old_name != sing1_name)
                                {
                                    event_log += "姓名:" + old_name + "->" + sing1_name + "。";
                                }

                                SysSetting.AddLog("簽章維護", Acc, event_log, DateTime.Now);
                            }

                            Label3.Text = "簽章更新成功!!";
                            PrevSID     = string.Empty;
                            ThisSID     = string.Empty;
                            NextSID     = string.Empty;
                            //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.close();window.opener.location.reload()", true);
                            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside();window.close()", true);
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        Label3.Text = "日期輸入範圍值錯誤,請查新檢查!!";
                    }
                }
                catch (Exception ex)
                {
                    Label3.Text = "日期格式錯誤";
                }
            }
            else
            {
                Label3.Text = "日期格式錯誤或欄位空白";
            }
        }
    }
示例#19
0
    protected void btn_InqResult_Simple_Click(object sender, EventArgs e)
    {
        string year       = ddl_year.SelectedItem.Text.ToString() + "-";
        string start_date = string.Empty;
        string end_date   = string.Empty;

        switch (ddl_season.SelectedValue)
        {
        case "1":
            start_date = year + "01-01";
            end_date   = year + "03-31";
            break;

        case "2":
            start_date = year + "04-01";
            end_date   = year + "06-30";
            break;

        case "3":
            start_date = year + "07-01";
            end_date   = year + "09-30";
            break;

        case "4":
            start_date = year + "10-01";
            end_date   = year + "12-31";
            break;

        default:
            start_date = year + "01-01";
            end_date   = year + "03-31";
            break;
        }

        Dictionary <string, object> d = new Dictionary <string, object>();

        Lib.DataUtility du = new Lib.DataUtility();
        try
        {
            d.Add("start_date", start_date);
            d.Add("end_date", end_date);
            DataTable dt = new DataTable();
            //2017-11-23使用新的函式,加長timeout為120秒
            dt = du.getDataTableBysp_BigData(@"Ex108_GetResultByDate_Simple", d);
            if (dt.Rows.Count > 0)
            {
                string svPath = "Result(" + start_date + "_" + end_date + ")-exl.csv";
                Save_csv_toClient(dt, svPath, true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "alert('" + "查無資料!!" + "')", true);
            }
        }
        catch (Exception ex)
        {
            //記錄錯誤訊息
            SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString());
            ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "alert('" + ex.Message + "')", true);
        }
    }
示例#20
0
 /// <summary>
 /// 设置系统参数序列化
 /// </summary>
 /// <param name="set"></param>
 public static void SetSetting(SysSetting set)
 {
     Voodoo.IO.XML.SaveSerialize(set, settingPath);
 }
示例#21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["account"] != null)
        {
            Account a = (Account)Session["account"];
            if (a.Role != ((int)SysSetting.Role.admin_hq).ToString())
            {
                Response.Redirect("~/index.aspx");
            }
            else
            {
                Check_memo = false;
                Sid        = Request.QueryString["sid"].ToString();
                if (Page.IsPostBack == false)//剛開始載入頁面
                {
                    Dictionary <string, object> d  = new Dictionary <string, object>();
                    Lib.DataUtility             du = new Lib.DataUtility();
                    d.Add("sid", Sid);
                    DataTable dt = du.getDataTableBysp("Ex108_GetResultDataBySid", d);
                    if (dt.Rows.Count > 0)
                    {
                        //個人基本資料
                        if (!string.IsNullOrEmpty(dt.Rows[0]["id"].ToString()))
                        {
                            Id = dt.Rows[0]["id"].ToString();
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[0]["name"].ToString()))
                        {
                            Name             = dt.Rows[0]["name"].ToString();
                            txb_Name.Text    = Name;
                            Old_Name         = Name;
                            lab_OldName.Text = "(" + Old_Name + ")";
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[0]["birth"].ToString()))
                        {
                            Birth             = dt.Rows[0]["birth"].ToString();
                            txb_Birth.Text    = Birth;
                            Old_Birth         = Birth;
                            lab_OldBirth.Text = "(" + Old_Birth + ")";
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[0]["age"].ToString()))
                        {
                            Age             = dt.Rows[0]["age"].ToString();
                            txb_Age.Text    = Age;
                            Old_Age         = Age;
                            lab_OldAge.Text = "(" + Age + ")";
                        }
                        //檢查項次欄位
                        if (!string.IsNullOrEmpty(dt.Rows[0]["memo"].ToString()))
                        {
                            Check_memo = true;
                            Memo       = dt.Rows[0]["memo"].ToString();
                        }

                        //項次名稱
                        //項次1
                        if (!string.IsNullOrEmpty(dt.Rows[0]["sit_ups_name"].ToString()))
                        {
                            ItemName1           = dt.Rows[0]["sit_ups_name"].ToString();
                            lab_ItemScore1.Text = "(5)" + ItemName1 + "(成績)";
                            if (Check_memo == true)
                            {
                                if (Memo.Substring(0, 1) == "F" || Memo.Substring(0, 1) == "G" || Memo.Substring(0, 1) == "J")
                                {
                                    lab_Item1.Text = "(4)" + ItemName1 + Sec;
                                }
                                else
                                {
                                    lab_Item1.Text = "(4)" + ItemName1 + Count;
                                }
                            }
                            else
                            {
                                lab_Item1.Text = "(4)" + ItemName1 + "(次/秒數)";
                            }
                        }
                        //項次2
                        if (!string.IsNullOrEmpty(dt.Rows[0]["push_ups_name"].ToString()))
                        {
                            ItemName2           = dt.Rows[0]["push_ups_name"].ToString();
                            lab_ItemScore2.Text = "(7)" + ItemName2 + "(成績)";
                            if (Check_memo == true)
                            {
                                if (Memo.Substring(1, 1) == "F" || Memo.Substring(1, 1) == "G" || Memo.Substring(1, 1) == "J")
                                {
                                    lab_Item2.Text = "(6)" + ItemName2 + Sec;
                                }
                                else
                                {
                                    lab_Item2.Text = "(6)" + ItemName2 + Count;
                                }
                            }
                            else
                            {
                                lab_Item2.Text = "(6)" + ItemName2 + "(次/秒數)";
                            }
                        }
                        //項次3
                        if (!string.IsNullOrEmpty(dt.Rows[0]["run_name"].ToString()))
                        {
                            ItemName3           = dt.Rows[0]["run_name"].ToString();
                            lab_ItemScore3.Text = "(9)" + ItemName3 + "(成績)";
                            if (Check_memo == true)
                            {
                                if (Memo.Substring(2, 1) == "0" || Memo.Substring(2, 1) == "F" || Memo.Substring(2, 1) == "G" || Memo.Substring(2, 1) == "J")
                                {
                                    lab_Item3.Text = "(8)" + ItemName3 + Sec;
                                }
                                else
                                {
                                    lab_Item3.Text = "(8)" + ItemName3 + Count;
                                }
                            }
                            else
                            {
                                lab_Item3.Text = "(8)" + ItemName3 + "(次/秒數)";
                            }
                        }
                        //項次次數及成績
                        //項次1
                        if (!string.IsNullOrEmpty(dt.Rows[0]["sit_ups_score"].ToString()))
                        {
                            ItemScore1     = dt.Rows[0]["sit_ups_score"].ToString();
                            Old_ItemScore1 = ItemScore1;
                            if (ItemScore1 == "999")
                            {
                                lab_OldItem1.Text      = "(未完測)";
                                lab_OldItemScore1.Text = "(未完測)";
                            }
                            else
                            {
                                Old_ItemScore1         = ItemScore1;
                                txb_ItemScore1.Text    = ItemScore1;
                                lab_OldItemScore1.Text = "(" + Old_ItemScore1 + ")";
                            }
                            //項次1次/秒數
                            if (!string.IsNullOrEmpty(dt.Rows[0]["sit_ups"].ToString()))
                            {
                                Item1             = dt.Rows[0]["sit_ups"].ToString();
                                Old_Item1         = Item1;
                                txb_Item1.Text    = Item1;
                                lab_OldItem1.Text = "(" + Old_Item1 + ")";
                            }
                            else
                            {
                                Item1     = string.Empty;
                                Old_Item1 = string.Empty;
                            }
                        }
                        else
                        {
                            ItemScore1             = string.Empty;
                            Old_ItemScore1         = string.Empty;
                            Item1                  = string.Empty;
                            Old_Item1              = string.Empty;
                            lab_OldItem1.Text      = "(未測驗)";
                            lab_OldItemScore1.Text = "(未測驗)";
                        }

                        //項次2
                        if (!string.IsNullOrEmpty(dt.Rows[0]["push_ups_score"].ToString()))
                        {
                            ItemScore2     = dt.Rows[0]["push_ups_score"].ToString();
                            Old_ItemScore2 = ItemScore2;
                            if (ItemScore2 == "999")
                            {
                                lab_OldItem2.Text      = "(未完測)";
                                lab_OldItemScore2.Text = "(未完測)";
                            }
                            else
                            {
                                Old_ItemScore2         = ItemScore2;
                                txb_ItemScore2.Text    = ItemScore2;
                                lab_OldItemScore2.Text = "(" + Old_ItemScore2 + ")";
                            }
                            //項次2次/秒數
                            if (!string.IsNullOrEmpty(dt.Rows[0]["push_ups"].ToString()))
                            {
                                Item2             = dt.Rows[0]["push_ups"].ToString();
                                Old_Item2         = Item2;
                                txb_Item2.Text    = Item2;
                                lab_OldItem2.Text = "(" + Old_Item2 + ")";
                            }
                            else
                            {
                                Item2     = string.Empty;
                                Old_Item2 = string.Empty;
                            }
                        }
                        else
                        {
                            ItemScore2             = string.Empty;
                            Old_ItemScore2         = string.Empty;
                            Item2                  = string.Empty;
                            Old_Item2              = string.Empty;
                            lab_OldItem2.Text      = "(未測驗)";
                            lab_OldItemScore2.Text = "(未測驗)";
                        }
                        //項次3
                        if (!string.IsNullOrEmpty(dt.Rows[0]["run_score"].ToString()))
                        {
                            ItemScore3     = dt.Rows[0]["run_score"].ToString();
                            Old_ItemScore3 = ItemScore3;
                            if (ItemScore3 == "9999")
                            {
                                lab_OldItem3.Text      = "(未完測)";
                                lab_OldItemScore3.Text = "(未完測)";
                            }
                            else
                            {
                                Old_ItemScore3         = ItemScore3;
                                txb_ItemScore3.Text    = ItemScore3;
                                lab_OldItemScore3.Text = "(" + Old_ItemScore3 + ")";
                            }
                            //項次3次/秒數
                            if (!string.IsNullOrEmpty(dt.Rows[0]["run"].ToString()))
                            {
                                Item3             = dt.Rows[0]["run"].ToString();
                                Old_Item3         = Item3;
                                txb_Item3.Text    = Item3;
                                lab_OldItem3.Text = "(" + Old_Item3 + ")";
                            }
                            else
                            {
                                Item3     = string.Empty;
                                Old_Item3 = string.Empty;
                            }
                        }
                        else
                        {
                            ItemScore3             = string.Empty;
                            Old_ItemScore3         = string.Empty;
                            Item3                  = string.Empty;
                            Old_Item3              = string.Empty;
                            lab_OldItem3.Text      = "(未測驗)";
                            lab_OldItemScore3.Text = "(未測驗)";
                        }

                        //總評
                        if (!string.IsNullOrEmpty(dt.Rows[0]["status"].ToString()))
                        {
                            Status = dt.Rows[0]["status"].ToString();
                            if (Status == "202")
                            {
                                ddl_Status.SelectedIndex = 0;
                            }
                            else
                            {
                                ddl_Status.SelectedIndex = 1;
                            }
                            Old_Status         = Status;
                            lab_OldStatus.Text = (Status == "202") ? "(合格)" : "(不合格)";
                        }
                    }
                }
                else//提交資料後回傳
                {
                    Dictionary <string, object> d  = new Dictionary <string, object>();
                    Lib.DataUtility             du = new Lib.DataUtility();
                    Name  = txb_Name.Text.Trim();
                    Birth = txb_Birth.Text.Trim();
                    Age   = txb_Age.Text.Trim();
                    d.Add("sid", Sid);
                    d.Add("name", Name);
                    d.Add("birth", Birth);
                    d.Add("age", Age);
                    //項次1次/秒數
                    if (!string.IsNullOrEmpty(txb_Item1.Text))
                    {
                        Item1 = txb_Item1.Text.Trim();
                        d.Add("sit_ups", Item1);
                    }
                    else
                    {
                        Item1 = string.Empty;
                        d.Add("sit_ups", DBNull.Value);
                    }
                    //項次1成績
                    if (!string.IsNullOrEmpty(txb_ItemScore1.Text))
                    {
                        ItemScore1 = txb_ItemScore1.Text.Trim();
                        d.Add("sit_ups_score", ItemScore1);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Old_ItemScore1) && Old_ItemScore3 == "999")
                        {
                            ItemScore1 = Old_ItemScore1;
                            d.Add("sit_ups_score", ItemScore1);
                        }
                        else
                        {
                            ItemScore1 = string.Empty;
                            d.Add("sit_ups_score", DBNull.Value);
                        }
                    }
                    //項次2次/秒數
                    if (!string.IsNullOrEmpty(txb_Item2.Text))
                    {
                        Item2 = txb_Item2.Text.Trim();
                        d.Add("push_ups", Item2);
                    }
                    else
                    {
                        Item2 = string.Empty;
                        d.Add("push_ups", DBNull.Value);
                    }
                    //項次2成績
                    if (!string.IsNullOrEmpty(txb_ItemScore2.Text))
                    {
                        ItemScore2 = txb_ItemScore2.Text.Trim();
                        d.Add("push_ups_score", ItemScore2);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Old_ItemScore2) && Old_ItemScore2 == "999")
                        {
                            ItemScore2 = Old_ItemScore2;
                            d.Add("push_ups_score", ItemScore2);
                        }
                        else
                        {
                            ItemScore2 = string.Empty;
                            d.Add("push_ups_score", DBNull.Value);
                        }
                    }
                    //項次3次/秒數
                    if (!string.IsNullOrEmpty(txb_Item3.Text))
                    {
                        Item3 = txb_Item3.Text.Trim();
                        d.Add("run", Item3);
                    }
                    else
                    {
                        Item3 = string.Empty;
                        d.Add("run", DBNull.Value);
                    }
                    //項次3成績
                    if (!string.IsNullOrEmpty(txb_ItemScore3.Text))
                    {
                        ItemScore3 = txb_ItemScore3.Text.Trim();
                        d.Add("run_score", ItemScore3);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Old_ItemScore3) && Old_ItemScore3 == "9999")
                        {
                            ItemScore3 = Old_ItemScore3;
                            d.Add("run_score", ItemScore3);
                        }
                        else
                        {
                            ItemScore3 = string.Empty;
                            d.Add("run_score", DBNull.Value);
                        }
                    }
                    //總評
                    if (ddl_Status.SelectedIndex == 0)
                    {
                        Status = "202";
                    }
                    else if (ddl_Status.SelectedIndex == 1)
                    {
                        Status = "203";
                    }
                    else
                    {
                        Status = Old_Status;
                    }
                    d.Add("status", Status);

                    try
                    {
                        //更新資料
                        du.executeNonQueryBysp("Ex108_UpdateResultData", d);
                        //寫入log
                        UpdateLog = string.Empty;
                        if (!string.IsNullOrEmpty(Sid))
                        {
                            UpdateLog += "sid-" + Sid + ',';
                        }
                        if (!string.IsNullOrEmpty(Id))
                        {
                            UpdateLog += "id-" + Id + ',';
                        }
                        if (Old_Name != Name)
                        {
                            UpdateLog += "名[" + Old_Name + "," + Name + "]";
                        }
                        if (Old_Birth != Birth)
                        {
                            UpdateLog += "生[" + Old_Birth + "," + Birth + "]";
                        }
                        if (Old_Age != Age)
                        {
                            UpdateLog += "歲[" + Old_Age + "," + Age + "]";
                        }
                        UpdateLog += "項1[" + Old_ItemScore1 + "," + ItemScore1 + "]項2[" + Old_ItemScore2 + "," + ItemScore2 + "]項3[" + Old_ItemScore3 + "," + ItemScore3 + "]總[" + ((Old_Status == "202") ? "合格" : "不合格") + "," + ((Status == "202") ? "合格" : "不合格") + "]";
                        SysSetting.AddLog("成績補正", a.AccountName, UpdateLog, DateTime.Now);
                        //回傳成功
                        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside_r('ok');window.close()", true);
                    }
                    catch (Exception ex)
                    {
                        //記錄錯誤訊息
                        SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString());
                        //回傳失敗
                        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside_r('Err');window.close()", true);
                    }
                }
            }
        }
        if (Session["account"] == null && Session["player"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
    }
示例#22
0
        /// <summary>
        /// 实现文件上传到服务器保存,并生成缩略图
        /// </summary>
        /// <param name="fileName">文件名称</param>
        /// <param name="fileBuffers">文件字节流</param>
        private void UploadFile(string fileName, byte[] fileBuffers)
        {
            //判断文件是否为空
            if (string.IsNullOrEmpty(fileName))
            {
                Log4NetHelper.Info("文件名不能为空");
                throw new Exception("文件名不能为空");
            }

            //判断文件是否为空
            if (fileBuffers.Length < 1)
            {
                Log4NetHelper.Info("文件不能为空");
                throw new Exception("文件不能为空");
            }

            YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
            SysSetting        sysSetting        = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
            string            folder            = DateTime.Now.ToString("yyyyMMdd");

            _filePath = _hostingEnvironment.WebRootPath;
            var _tempfilepath = sysSetting.Filepath;

            if (!string.IsNullOrEmpty(_belongApp))
            {
                _tempfilepath += "/" + _belongApp;
            }
            if (!string.IsNullOrEmpty(_belongAppId))
            {
                _tempfilepath += "/" + _belongAppId;
            }
            if (sysSetting.Filesave == "1")
            {
                _tempfilepath = _tempfilepath + "/" + folder + "/";
            }
            if (sysSetting.Filesave == "2")
            {
                DateTime date = DateTime.Now;
                _tempfilepath = _tempfilepath + "/" + date.Year + "/" + date.Month + "/" + date.Day + "/";
            }

            var uploadPath = _filePath + "/" + _tempfilepath;

            if (sysSetting.Fileserver == "localhost")
            {
                if (!Directory.Exists(uploadPath))
                {
                    Directory.CreateDirectory(uploadPath);
                }
            }
            string ext         = Path.GetExtension(fileName).ToLower();
            string newName     = GuidUtils.CreateNo();
            string newfileName = newName + ext;

            using (var fs = new FileStream(uploadPath + newfileName, FileMode.Create))
            {
                fs.Write(fileBuffers, 0, fileBuffers.Length);
                fs.Close();
                //生成缩略图
                if (ext.Contains(".jpg") || ext.Contains(".jpeg") || ext.Contains(".png") || ext.Contains(".bmp") || ext.Contains(".gif"))
                {
                    string thumbnailName = newName + "_" + sysSetting.Thumbnailwidth + "x" + sysSetting.Thumbnailheight + ext;
                    ImgHelper.MakeThumbnail(uploadPath + newfileName, uploadPath + thumbnailName, sysSetting.Thumbnailwidth.ToInt(), sysSetting.Thumbnailheight.ToInt());
                    _dbThumbnail = _tempfilepath + thumbnailName;
                }
                _dbFilePath = _tempfilepath + newfileName;
            }
        }
示例#23
0
        public async Task <IHttpActionResult> PutSysSetting(int id, SysSetting sysSetting)
        {
            #region Проверяем Логин и Пароль + Изменяем строку соединения + Права + Разные Функции

            //Получаем Куку
            System.Web.HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies["CookieIPOL"];
            int iLanguage = Convert.ToInt32(authCookie["CookieL"]) - 1;

            // Проверяем Логин и Пароль
            Classes.Account.Login.Field field = await Task.Run(() => login.Return(authCookie, true));

            if (!field.Access)
            {
                return(Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg10)));
            }

            //Изменяем строку соединения
            db = new DbConnectionSklad(connectionString.Return(field.DirCustomersID, null, true));

            //Права (1 - Write, 2 - Read, 3 - No Access)
            int iRight = await Task.Run(() => accessRight.Access(connectionString.Return(field.DirCustomersID, null, true), field.DirEmployeeID, "RightSysSettings"));

            if (iRight != 1)
            {
                return(Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg57(0))));
            }

            //Разные Функции
            function.NumberDecimalSeparator();

            #endregion

            #region Проверки

            if (!ModelState.IsValid)
            {
                return(Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg91)));
            }

            //Подстановки - некоторые поля надо заполнить, если они не заполены (Юридические реквизиты)
            sysSetting.Substitute();

            #endregion


            #region Сохранение

            try
            {
                db.Entry(sysSetting).State = EntityState.Modified;
                await db.SaveChangesAsync();


                #region 6. JourDisp *** *** *** *** *** *** *** *** *** *

                sysJourDisp.DirDispOperationID = 7; //Изменение настроек
                sysJourDisp.DirEmployeeID      = field.DirEmployeeID;
                sysJourDisp.ListObjectID       = ListObjectID;
                sysJourDisp.TableFieldID       = 1;
                sysJourDisp.Description        = "";
                try { sysJourDispsController.mPutPostSysJourDisps(db, sysJourDisp, EntityState.Added); } catch (Exception ex) { }

                #endregion


                dynamic collectionWrapper = new
                {
                    ID = sysSetting.SysSettingsID
                };
                return(Ok(returnServer.Return(true, collectionWrapper)));
            }
            catch (Exception ex)
            {
                return(Ok(returnServer.Return(false, exceptionEntry.Return(ex))));
            }

            #endregion
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["account"] != null)
     {
         Account a = (Account)Session["account"];
         if (a.Role != ((int)SysSetting.Role.admin_hq).ToString())
         {
             Response.Redirect("~/index.aspx");
         }
         else
         {
             Sid = Request.QueryString["sid"].ToString();
             if (Page.IsPostBack == false)//剛開始載入頁面
             {
                 Dictionary <string, object> d  = new Dictionary <string, object>();
                 Lib.DataUtility             du = new Lib.DataUtility();
                 d.Add("value", Sid);
                 d.Add("type", "sid");
                 DataTable dt = du.getDataTableBysp("Ex108_GetPlayerData", d);
                 if (dt.Rows.Count > 0)
                 {
                     if (!string.IsNullOrEmpty(dt.Rows[0]["name"].ToString()))
                     {
                         Name             = dt.Rows[0]["name"].ToString();
                         txb_Name.Text    = Name;
                         Old_Name         = Name;
                         lab_OldName.Text = "(" + Old_Name + ")";
                     }
                     if (!string.IsNullOrEmpty(dt.Rows[0]["id"].ToString()))
                     {
                         Id             = dt.Rows[0]["id"].ToString();
                         txb_Id.Text    = Id;
                         Old_Id         = Id;
                         lab_OldId.Text = "(" + Old_Id + ")";
                     }
                     if (!string.IsNullOrEmpty(dt.Rows[0]["birth"].ToString()))
                     {
                         Birth             = dt.Rows[0]["birth"].ToString();
                         txb_Birth.Text    = Birth;
                         Old_Birth         = Birth;
                         lab_OldBirth.Text = "(" + Old_Birth + ")";
                     }
                     if (!string.IsNullOrEmpty(dt.Rows[0]["mail"].ToString()))
                     {
                         Mail             = dt.Rows[0]["mail"].ToString();
                         txb_Mail.Text    = Mail;
                         Old_Mail         = Mail;
                         lab_OldMail.Text = "(" + Old_Mail + ")";
                     }
                     if (!string.IsNullOrEmpty(dt.Rows[0]["password"].ToString()))
                     {
                         Password             = dt.Rows[0]["password"].ToString();
                         txb_Password.Text    = Password;
                         Old_Password         = Password;
                         lab_OldPassword.Text = "(" + Old_Password + ")";
                     }
                 }
             }
             else//提交資料後回傳
             {
                 Dictionary <string, object> d  = new Dictionary <string, object>();
                 Lib.DataUtility             du = new Lib.DataUtility();
                 Name  = txb_Name.Text;
                 Id    = txb_Id.Text.Trim();
                 Birth = txb_Birth.Text.Trim();
                 Mail  = txb_Mail.Text.Trim();
                 d.Add("sid", Sid);
                 d.Add("name", Name);
                 d.Add("id", Id);
                 d.Add("birth", Birth);
                 d.Add("mail", Mail);
                 d.Add("password", Password);
                 try
                 {
                     //更新資料
                     du.executeNonQueryBysp("Ex108_UpdatePlayerData", d);
                     //寫入log
                     UpdateLog = string.Empty;
                     if (!string.IsNullOrEmpty(Sid))
                     {
                         UpdateLog += "sid-" + Sid + ",";
                     }
                     if (Old_Name != Name)
                     {
                         UpdateLog += "名[" + Old_Name + "," + Name + "]";
                     }
                     if (Old_Id != Id)
                     {
                         UpdateLog += "證[" + Old_Id + "," + Id + "]";
                     }
                     if (Old_Birth != Birth)
                     {
                         UpdateLog += "生[" + Old_Birth + "," + Birth + "]";
                     }
                     if (Old_Mail != Mail)
                     {
                         UpdateLog += "郵[" + Old_Mail + "," + Mail + "]";
                     }
                     if (Old_Password != Password)
                     {
                         UpdateLog += "密[" + Old_Password + "," + Password + "]";
                     }
                     if (!string.IsNullOrEmpty(UpdateLog))
                     {
                         SysSetting.AddLog("基本資料異動", a.AccountName, UpdateLog, DateTime.Now);
                     }
                     //回傳成功
                     ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside('" + Id + "');window.close()", true);
                 }
                 catch (Exception ex)
                 {
                     //記錄錯誤訊息
                     SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString());
                     //回傳失敗
                     ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", "window.opener.outside('Err');window.close()", true);
                 }
             }
         }
     }
     if (Session["account"] == null && Session["player"] == null)
     {
         Response.Redirect("~/Login.aspx");
     }
 }
示例#25
0
 public object InsertUpdateSysSetting(SysSetting sysSetting)
 {
     return(_sysSettingRepository.InsertUpdateSysSetting(sysSetting));
 }
示例#26
0
 public void UpdateUserSystemSettings(SysSetting userSystemSettings)
 {
     _command.ActiveUser = ActiveUser;
     _command.UpdateUserSystemSettings(userSystemSettings);
 }
示例#27
0
 public static void UpdateUserSystemSettings(SysSetting userSystemSettings)
 {
     _commands.UpdateUserSystemSettings(ActiveUser, userSystemSettings);
 }
示例#28
0
        public Task Execute(IJobExecutionContext context)
        {
            DateTime          dateTime          = DateTime.Now;
            YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
            SysSetting        sysSetting        = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
            Stopwatch         stopwatch         = new Stopwatch();

            stopwatch.Start();
            AbstractTrigger trigger     = (context as JobExecutionContextImpl).Trigger as AbstractTrigger;
            string          sqlWhere    = string.Format("Id='{0}' and GroupName='{1}'", trigger.Name, trigger.Group);
            TaskManager     taskManager = iService.GetWhere(sqlWhere);

            if (taskManager == null)
            {
                FileQuartz.WriteErrorLog($"任务不存在");
                return(Task.Delay(1));
            }
            try
            {
                string msg = $"开始时间:{dateTime.ToString("yyyy-MM-dd HH:mm:ss ffff")}";
                //记录任务执行记录
                iService.RecordRun(taskManager.Id, JobAction.开始, true, msg);
                //初始化任务日志
                FileQuartz.InitTaskJobLogPath(taskManager.Id);
                var jobId = context.MergedJobDataMap.GetString("OpenJob");
                //todo:这里可以加入自己的自动任务逻辑
                Log4NetHelper.Info(DateTime.Now.ToString() + "执行任务");


                stopwatch.Stop();
                string content = $"结束时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")} 共耗时{stopwatch.ElapsedMilliseconds} 毫秒\r\n";
                iService.RecordRun(taskManager.Id, JobAction.结束, true, content);
                if ((MsgType)taskManager.SendMail == MsgType.All)
                {
                    string emailAddress = sysSetting.Email;
                    if (!string.IsNullOrEmpty(taskManager.EmailAddress))
                    {
                        emailAddress = taskManager.EmailAddress;
                    }

                    List <string> recipients = new List <string>();
                    recipients = emailAddress.Split(",").ToList();
                    var mailBodyEntity = new MailBodyEntity()
                    {
                        Body       = msg + content + ",请勿回复本邮件",
                        Recipients = recipients,
                        Subject    = taskManager.TaskName
                    };
                    SendMailHelper.SendMail(mailBodyEntity);
                }
            }
            catch (Exception ex)
            {
                stopwatch.Stop();
                string content = $"结束时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")} 共耗时{stopwatch.ElapsedMilliseconds} 毫秒\r\n";
                iService.RecordRun(taskManager.Id, JobAction.结束, false, content + ex.Message);
                FileQuartz.WriteErrorLog(ex.Message);
                if ((MsgType)taskManager.SendMail == MsgType.Error || (MsgType)taskManager.SendMail == MsgType.All)
                {
                    string emailAddress = sysSetting.Email;
                    if (!string.IsNullOrEmpty(taskManager.EmailAddress))
                    {
                        emailAddress = taskManager.EmailAddress;
                    }

                    List <string> recipients = new List <string>();
                    recipients = emailAddress.Split(",").ToList();
                    var mailBodyEntity = new MailBodyEntity()
                    {
                        Body       = "处理失败," + ex.Message + ",请勿回复本邮件",
                        Recipients = recipients,
                        Subject    = taskManager.TaskName
                    };
                    SendMailHelper.SendMail(mailBodyEntity);
                }
            }

            return(Task.Delay(1));
        }
示例#29
0
        /// <summary>
        /// 执行远程接口url的定时任务
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public Task Execute(IJobExecutionContext context)
        {
            YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
            SysSetting        sysSetting        = yuebonCacheHelper.Get("SysSetting").ToJson().ToObject <SysSetting>();
            Stopwatch         stopwatch         = new Stopwatch();

            stopwatch.Start();
            AbstractTrigger trigger     = (context as JobExecutionContextImpl).Trigger as AbstractTrigger;
            string          sqlWhere    = string.Format("Id='{0}' and GroupName='{1}'", trigger.Name, trigger.Group);
            TaskManager     taskManager = iService.GetWhere(sqlWhere);
            string          httpMessage = "";

            if (taskManager == null)
            {
                FileQuartz.WriteErrorLog($"任务不存在");
                return(Task.Delay(1));
            }
            FileQuartz.InitTaskJobLogPath(taskManager.Id);
            string msg = $"开始时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")}";

            //记录任务执行记录
            iService.RecordRun(taskManager.Id, JobAction.开始, true, msg);
            if (string.IsNullOrEmpty(taskManager.JobCallAddress) || taskManager.JobCallAddress == "/")
            {
                FileQuartz.WriteErrorLog($"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")}未配置任务地址,");
                iService.RecordRun(taskManager.Id, JobAction.结束, false, "未配置任务地址");
                return(Task.Delay(1));
            }
            try
            {
                Dictionary <string, string> header = new Dictionary <string, string>();
                if (!string.IsNullOrEmpty(taskManager.JobCallParams))
                {
                    httpMessage = HttpRequestHelper.HttpPost(taskManager.JobCallAddress, taskManager.JobCallParams, null, header);
                }
                else
                {
                    httpMessage = HttpRequestHelper.HttpGet(taskManager.JobCallAddress);
                }
                stopwatch.Stop();
                string content = $"结束时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")} 共耗时{stopwatch.ElapsedMilliseconds} 毫秒,消息:{httpMessage??"OK"}\r\n";
                iService.RecordRun(taskManager.Id, JobAction.结束, true, content);
                if ((MsgType)taskManager.SendMail == MsgType.All)
                {
                    string emailAddress = sysSetting.Email;
                    if (!string.IsNullOrEmpty(taskManager.EmailAddress))
                    {
                        emailAddress = taskManager.EmailAddress;
                    }

                    List <string> recipients = new List <string>();
                    recipients = taskManager.EmailAddress.Split(",").ToList();
                    //recipients.Add(taskManager.EmailAddress);
                    var mailBodyEntity = new MailBodyEntity()
                    {
                        Body       = content + "\n\r请勿直接回复本邮件!",
                        Recipients = recipients,
                        Subject    = taskManager.TaskName,
                    };
                    SendMailHelper.SendMail(mailBodyEntity);
                }
            }
            catch (Exception ex)
            {
                stopwatch.Stop();
                string content = $"结束时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff")} 共耗时{stopwatch.ElapsedMilliseconds} 毫秒\r\n";
                iService.RecordRun(taskManager.Id, JobAction.结束, false, content + ex.Message);
                FileQuartz.WriteErrorLog(ex.Message);
                if ((MsgType)taskManager.SendMail == MsgType.Error || (MsgType)taskManager.SendMail == MsgType.All)
                {
                    string emailAddress = sysSetting.Email;
                    if (!string.IsNullOrEmpty(taskManager.EmailAddress))
                    {
                        emailAddress = taskManager.EmailAddress;
                    }
                    List <string> recipients = new List <string>();
                    recipients = emailAddress.Split(",").ToList();
                    var mailBodyEntity = new MailBodyEntity()
                    {
                        Body       = ex.Message + "\n\r请勿直接回复本邮件!",
                        Recipients = recipients,
                        Subject    = taskManager.TaskName,
                    };
                    SendMailHelper.SendMail(mailBodyEntity);
                }
            }

            return(Task.Delay(1));
        }
示例#30
0
        public object InsertUpdateSysSetting(SysSetting sysSetting)
        {
            SqlParameter outputStatus, outputID = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[InsertUpdateSysSetting]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@IsUpdate", SqlDbType.Bit).Value = sysSetting.IsUpdate;
                        if (sysSetting.ID == Guid.Empty)
                        {
                            cmd.Parameters.AddWithValue("@ID", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = sysSetting.ID;
                        }
                        cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value            = sysSetting.Name.Replace("-", "_ ");
                        cmd.Parameters.Add("@Value", SqlDbType.VarChar).Value           = sysSetting.Value;
                        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = sysSetting.PSASysCommon.CreatedBy;
                        cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value    = sysSetting.PSASysCommon.CreatedDate;
                        cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = sysSetting.PSASysCommon.UpdatedBy;
                        cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value    = sysSetting.PSASysCommon.UpdatedDate;
                        outputStatus           = cmd.Parameters.Add("@Status", SqlDbType.SmallInt);
                        outputStatus.Direction = ParameterDirection.Output;
                        outputID           = cmd.Parameters.Add("@IDOut", SqlDbType.UniqueIdentifier);
                        outputID.Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();
                    }
                }
                switch (outputStatus.Value.ToString())
                {
                case "0":
                    throw new Exception(sysSetting.IsUpdate ? _appConstant.UpdateFailure : _appConstant.InsertFailure);

                case "1":
                    sysSetting.ID = Guid.Parse(outputID.Value.ToString());
                    return(new
                    {
                        Code = outputID.Value.ToString(),
                        Status = outputStatus.Value.ToString(),
                        Message = sysSetting.IsUpdate ? _appConstant.UpdateSuccess : _appConstant.InsertSuccess
                    });

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(new
            {
                ID = sysSetting.ID,
                Status = outputStatus.Value.ToString(),
                Message = sysSetting.IsUpdate ? _appConstant.UpdateSuccess : _appConstant.InsertSuccess
            });
        }
示例#31
0
    protected void submit_Click(object sender, EventArgs e)
    {
        try
        {
            if (loginType.SelectedValue == "advance")
            {
                Account a = new Account(txtName.Text.Trim(), txtPwd.Text.Trim(), Request.UserHostAddress.ToString());

                // 2010/01/19 edit by angus
                if (a.IsValid)
                {
                    if (a.IsIPLock)
                    {
                        Session["account"] = a;
                        SysSetting.AddLog("登入", a.AccountName, "進階使用者登入成功,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                        Response.Redirect("~/Index.aspx", false);
                    }
                    else
                    {
                        SysSetting.AddLog("登入", txtName.Text, "進階使用者登入IP錯誤,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('登入之電腦IP錯誤 !!!')", true);
                    }
                }
                else
                {
                    txtPwd.Text = "";
                    SysSetting.AddLog("登入", txtName.Text, "進階使用者登入密碼驗證失敗,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('帳號密碼驗證失敗 !!!')", true);
                }
            }
            else if (loginType.SelectedValue == "user")
            {
                Lib.Player player = new Player(txtName.Text.Trim(), txtPwd.Text.Trim(), "password");
                if (player.IsExist)
                {
                    if (player.IsValid)
                    {
                        Session["player"] = player;
                        Lib.SysSetting.AddLog("登入", player.ID, "一般受測人員登入成功,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                        //Response.Redirect("~/Index.aspx",false);
                        if (player.IsMustReSetPassword == false)
                        {
                            Response.Redirect("~/Index.aspx", false);
                        }
                        else
                        {
                            Response.Redirect("~/NewPassword.aspx", false);
                        }
                    }
                    if (!player.IsValid)
                    {
                        txtPwd.Text = "";
                        Lib.SysSetting.AddLog("登入", txtName.Text, "一般受測人員登入失敗,帳號密碼錯誤,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('身分證字號或生日錯誤');", true);
                    }
                }
                if (!player.IsExist)
                {
                    txtName.Text = "";
                    txtPwd.Text  = "";
                    Lib.SysSetting.AddLog("登入", txtName.Text, "一般受測人員登入失敗,帳號不存在,登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('您輸入的帳號不存在');", true);
                }
            }
        }
        catch (Exception ex)
        {
            Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString());
            Lib.SysSetting.AddLog("登入", "system", ex.Message + "登入IP : " + Request.UserHostAddress.ToString(), DateTime.Now);
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('資料輸入錯誤');", true);
        }
    }
示例#32
0
 public async Task <IHttpActionResult> PostSysSetting(SysSetting sysSetting)
 {
     return(Ok(returnServer.Return(false, Classes.Language.Sklad.Language.msg57(0))));
 }
示例#33
0
            static SysSetting()
            {
                ServiceItems = new SysSetting() { Name = "服务条款", Code = "ServiceItems" };

                Hotline = new SysSetting() { Name = "服务热线", Code = "Hotline" };

                VoiceMailBox = new SysSetting() { Name = "语音热线", Code = "VoiceMailBox" };

                Address = new SysSetting() { Name = "联系地址", Code = "Address" };

                Post = new SysSetting() { Name = "邮政编码", Code = "Post" };

                Email = new SysSetting() { Name = "邮箱", Code = "Email" };
            }