Ejemplo n.º 1
0
 protected void btnsubmit_Click(object sender, EventArgs e)
 {
     try
     {
         WebSet item = new WebSet();
         item.WebName        = txtname.Value;
         item.WebEmail       = txtemail.Value;
         item.WebKeywords    = txtkey.Value;
         item.WebDescription = txtdesc.Value;
         item.WebCopyright   = txtcopyright.Value;
         item.WebTel         = txttel.Value;
         item.WebFax         = txtfax.Value;
         item.WebAddress     = webset.WebAddress;
         item.Logo           = webset.Logo;
         item.WebUrl         = webset.WebUrl;
         item.EmailLoginName = txtemail.Value;
         item.EmailLoginPass = txt_password.Value != "" ? txt_password.Value : item.EmailLoginPass;
         item.SmtpServer     = txt_email_smtp.Value;
         item.CookieName     = webset.CookieName;
         item.ServiceQQ      = webset.ServiceQQ;
         item.HotDistrict    = txthotdistrict.Value;
         new WebSetBLL().saveConifg(item, Utils.GetXmlMapPath("Configpath"));
         base.JscriptPrint("系统设置成功!", "setting.aspx", "Success");
     }
     catch
     {
         base.JscriptMsg(350, 280, "错误提示", "<b>文件写入失败!</b>请检查是否有写入权限,如果没有,请联系管理员开启写入该文件的权限!", "setting.aspx", "Error");
     }
 }
Ejemplo n.º 2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        #region
        WebSet model = new WebSet();
        model.openOrcloseWeb   = RadioBtnOpenOrClose.SelectedValue.ToInt();
        model.Website          = TbWebSite.Text;
        model.WebName          = TbWebName.Text;
        model.Email            = TbMail.Text;
        model.Address          = TbAddress.Text;
        model.ZipCode          = TbZipCode.Text;
        model.Phone            = TbPhone.Text;
        model.Copyright        = TbCopyright.Text;
        model.DuplicateWebpage = RadioBtnDuplicateWebpage.SelectedValue;
        model.ICP         = TbIcp.Text;
        model.KeyWord     = TbKeyWord.Text;
        model.Description = TbDescirption.Text;
        model.Fax         = TbFax.Text;
        model.TQ          = TbTQ.Text;

        model.WaterMarkType       = RadioWaterMarkType.SelectedValue.ToInt();
        model.WaterMarkTxt        = TbWaterMarkTxt.Text;
        model.WaterMarkPicUrl     = WaterMarkPic.Url;
        model.WaterMarkHorizontal = RadioHorizontal.SelectedValue;
        model.WaterMarkVertical   = RadioVertical.SelectedValue;

        MyXmlSerializer <WebSet> .Set(model, fileUrl);

        MessageDiv.InnerHtml = YK.Common.CommonClass.Alert("数据修改成功!");
        #endregion
    }
Ejemplo n.º 3
0
        public static List <BookEntity> GetBookUpdateChapterList(string html)
        {
            List <BookEntity> list = new List <BookEntity>();

            html = html.Replace("\r", "").Replace("\t", "").Replace("\n", "");
            MatchCollection matches = Regex.Matches(html, "<div class=\"main-html\".*?class=\"xt1.*?</div>");

            foreach (var item in matches)
            {
                MatchCollection matches2 = Regex.Matches(item.ToString(), "<a href.*?</a>");
                BookEntity      t_entity = new BookEntity();
                t_entity.NewestChapterUrl = Regex.Match(matches2[0].ToString(), "(?<=&chapterurl=).*?(?=\")").ToString();

                bool value = WebSet.CheckUrl(t_entity.NewestChapterUrl);
                if (!value)
                {
                    continue;
                }
                t_entity.NewestChapterName = Regex.Match(matches2[0].ToString(), "(?<=alt=\").*?(?=\")").ToString();

                //  t_entity.ChapterName = Regex.Replace(matches2[0].ToString(), "<.*?>", "").ToString();
                t_entity.LyWeb = Regex.Replace(matches2[1].ToString(), "<.*?>", "").ToString();

                Match match2 = Regex.Match(item.ToString(), "(?<=<.*?class=\"xt1\">).*?(?=</div>)");
                t_entity.UpdateTime = match2.ToString();

                list.Add(t_entity);
            }

            return(list);
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebSet model = MyXmlSerializer <WebSet> .Get(fileUrl);

            RadioBtnOpenOrClose.SelectedValue = model.openOrcloseWeb.ToString();
            TbWebSite.Text   = model.Website;
            TbWebName.Text   = model.WebName;
            TbMail.Text      = model.Email;
            TbAddress.Text   = model.Address;
            TbZipCode.Text   = model.ZipCode;
            TbPhone.Text     = model.Phone;
            TbCopyright.Text = model.Copyright;
            RadioBtnDuplicateWebpage.SelectedValue = model.DuplicateWebpage;
            TbIcp.Text         = model.ICP;
            TbKeyWord.Text     = model.KeyWord;
            TbDescirption.Text = model.Description;
            TbFax.Text         = model.Fax;
            TbTQ.Text          = model.TQ;

            RadioWaterMarkType.SelectedValue = model.WaterMarkType.ToStr();
            TbWaterMarkTxt.Text           = model.WaterMarkTxt;
            WaterMarkPic.Url              = model.WaterMarkPicUrl;
            RadioHorizontal.SelectedValue = model.WaterMarkHorizontal;
            RadioVertical.SelectedValue   = model.WaterMarkVertical;
        }
    }
Ejemplo n.º 5
0
 public WebSet saveConifg(WebSet mode, string configFilePath)
 {
     lock (lockHelper)
     {
         SerializationHelper.Save(mode, configFilePath);
     }
     return(mode);
 }
Ejemplo n.º 6
0
        public WebSet loadConfig(string configFilePath)
        {
            WebSet Cache_Webset = HttpContext.Current.Cache["Cache_Webset"] as WebSet;

            if (Cache_Webset == null)
            {
                CacheDependency dependency = new CacheDependency(configFilePath);
                HttpContext.Current.Cache.Add("Cache_Webset", dal.loadConfig(configFilePath), dependency, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0), CacheItemPriority.Default, null);
                Cache_Webset = HttpContext.Current.Cache["Cache_Webset"] as WebSet;
            }
            return(Cache_Webset);
        }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string path = Server.MapPath("~/App_Data/WebSet/WebSet.xml");

        webSet = MyXmlSerializer <WebSet> .Get(path);
    }
Ejemplo n.º 8
0
 public BasePage()
 {
     webset = new WebSetBLL().loadConfig(Utils.GetXmlMapPath("Configpath"));
 }
Ejemplo n.º 9
0
        private void Of_bind_Goods()
        {
            int li_PageIndex = 1;

            try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); }
            catch { }

            string ls_SQL = @"select isnull((select ThumbnaiIimg from Goodsno_picture where Goo_code=goodsno.goo_code),'img/error.png')as ThumbnaiIimg,
                            goodsno.goo_code,goodsno.goo_no,goodsno.specnum,goodsno.Goo_Type,goodsno.Goo_Mate,goodsno.goo_name,0.00 as UserPrice,goodsno.Spec,
                            goodsno.Content,goodsno.Goo_unit,goodsno.getdetail_memo,0 as num,0 as piece
                            from goodsno,goodmate,goodtype where 1=1 
                            and goo_type=typeno and goo_mate*=matecode and goodsno.isweb='Y'  and goodtype.isweb='Y' and goodmate.isweb='Y'";

            ls_SQL += WebSet.GetShowGood_SQL("all");
            n_findby_dw lnv_find = new n_findby_dw();

            lnv_find.of_setSQL(ls_SQL);
            lnv_find.of_SetOr("Txt_GoodNo", "goo_no", "like", Txt_GoodNo.Text);
            lnv_find.of_SetOr("Txt_GoodNo", "GyNo", "like", Txt_GoodNo.Text);
            lnv_find.of_SetOr("Txt_GoodNo", "goo_name", "like", Txt_GoodNo.Text);
            lnv_find.of_SetOr("Txt_GoodNo", "barcode", "like", Txt_GoodNo.Text);
            lnv_find.of_SetOr("Txt_GoodNo", "content", "like", Txt_GoodNo.Text);
            lnv_find.of_SetOr("Txt_GoodNo", "CAST(saleprice as varchar(50))", "like", Txt_GoodNo.Text);
            lnv_find.of_SetCol("goo_mate", "goodsno.goo_mate", "=", DDL_GooMate.SelectedValue.Trim());
            lnv_find.of_SetCol("goo_type", "goodsno.goo_type", "=", DDL_GooType.SelectedValue.Trim());

            int       count     = 0;
            DataTable ldt_Goods = lnv_find.Of_GetPageDataTable("goodsno.goo_code", gi_PageSize, li_PageIndex, ref count);//PageDAL.Page(Page, baseclass.GysoftParameter.ChangeParameter(ll_Pa), out count);

            Log.WriteTextLog("Dw_OrderCarSql", "Log", lnv_find.AllSQL + "  sql=" + ls_SQL, 9);
            if (li_PageIndex == 1)
            {
                if (count % gi_PageSize != 0)
                {
                    Lbl_PageCount.Text = ((count / gi_PageSize) + 1).ToString();
                }
                else
                {
                    Lbl_PageCount.Text = (count / gi_PageSize).ToString();
                }
            }

            #region 添加价格和采购量
            Hashtable Hash = Shoping.GetHash();
            for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++)
            {
                string ls_Price = UserInfo.ShowGoo_price(ldt_Goods.Rows[li_Rows]["goo_code"],
                                                         ldt_Goods.Rows[li_Rows]["getdetail_memo"]);
                Decimal lde_Price = 0;
                try { lde_Price = Convert.ToDecimal(ls_Price); }
                catch
                {
                    ldt_Goods.Rows[li_Rows]["UserPrice"] = 0.00;
                    continue;
                }
                ldt_Goods.Rows[li_Rows]["UserPrice"] = lde_Price;
                if (Hash.ContainsKey(ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()))
                {
                    try
                    {
                        Decimal num    = Convert.ToDecimal(Hash[ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()]);
                        int     li_num = Convert.ToInt32(Decimal.Round(num, 0));
                        ldt_Goods.Rows[li_Rows]["num"]   = li_num;
                        ldt_Goods.Rows[li_Rows]["piece"] = li_num / Convert.ToDecimal(ldt_Goods.Rows[li_Rows]["specnum"]);
                    }
                    catch {
                        ldt_Goods.Rows[li_Rows]["num"]   = 0;
                        ldt_Goods.Rows[li_Rows]["piece"] = 0;
                    }
                }
            }
            #endregion

            if (Convert.ToInt32(Lbl_PageCount.Text) > 1)
            {
                Pages.Visible = true;
            }
            else
            {
                Pages.Visible = false;
            }


            Rep_GoodsNo.DataSource = ldt_Goods;
            Rep_GoodsNo.DataBind();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GoodsNoModel GetEditModel(string Goo_code, bool is_GyNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 ");
            strSql.Append("goo_no,goo_name,goo_code,goo_type,goo_mate,Webtype,webimageBath,webimageBath2,webimageBath3,spec,");
            strSql.Append("Webmemo,WebIntegral,Content,isnull(Specnum,0) as Specnum,Getdetail_Memo,");
            strSql.Append("isnull(isweb,'" + WebSet.GetMySetGoodsIsWeb() + "') as isweb");
            strSql.Append(" from GoodsNo where isnull(visible,'Y')='Y' ");
            if (is_GyNo)
            {
                strSql.Append(" and GyNo = @goo_code ");
            }
            else
            {
                strSql.Append(" and goo_code = @goo_code ");
            }

            string ls_typeid = UserInfo.GetCussaleItem();

            if (ls_typeid != "")
            {
                strSql.Append(" and goo_type in (" + ls_typeid + ") ");
            }
            GysoftParameter[] parameters =
            {
                new GysoftParameter("@goo_code", Goo_code)
            };

            GoodsNoModel model = new GoodsNoModel();
            DataTable    dt    = SqlHelper.ExecuteDataTable(CommandType.Text, strSql.ToString(), parameters);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            model.Goo_no       = dt.Rows[0]["goo_no"].ToString().Trim();
            model.Goo_name     = dt.Rows[0]["goo_name"].ToString().Trim();
            model.Goo_code     = dt.Rows[0]["goo_code"].ToString().Trim();
            model.Goo_type     = dt.Rows[0]["Goo_type"].ToString().Trim();
            model.Goo_mate     = dt.Rows[0]["goo_mate"].ToString().Trim();
            model.Goo_Category = dt.Rows[0]["Webtype"].ToString().Trim();

            model.Goo_image  = dt.Rows[0]["webimageBath"].ToString();
            model.Goo_image2 = dt.Rows[0]["webimageBath2"].ToString();
            model.Goo_image3 = dt.Rows[0]["webimageBath3"].ToString();

            model.Goo_spec = dt.Rows[0]["spec"].ToString().Trim();

            model.Webmemo = dt.Rows[0]["Webmemo"].ToString().Trim();

            if (dt.Rows[0]["WebIntegral"].ToString() != "")
            {
                model.WebIntegral = Convert.ToInt32(dt.Rows[0]["WebIntegral"]);
            }
            else
            {
                model.WebIntegral = 0;
            }
            model.Content = dt.Rows[0]["Content"].ToString().Trim();
            if (dt.Rows[0]["Specnum"].ToString().Trim() != "")
            {
                model.Specnum = Convert.ToDecimal(dt.Rows[0]["Specnum"]);
            }
            model.Getdetail_Memo = dt.Rows[0]["Getdetail_Memo"].ToString().Trim();

            model.IsWeb = dt.Rows[0]["isweb"].ToString().Trim();


            return(model);
        }
Ejemplo n.º 11
0
 public WebSet saveConifg(WebSet mode, string configFilePath)
 {
     return(dal.saveConifg(mode, configFilePath));
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 文字水印
        /// </summary>
        /// <param name="path">加水印图片的物理路径</param>
        public static void TxtWaterMark(string path)
        {
            string fileUrl = HttpContext.Current.Server.MapPath("~/App_Data/WebSet/WebSet.xml");
            WebSet webset  = MyXmlSerializer <YK.Model.WebSet> .Get(fileUrl);

            Color[]  color    = { Color.Black, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.DarkBlue };
            string[] font     = { "Times New Roman", "MS Mincho", "Book Antiqua", "Gungsuh", "PMingLiU", "Impact" };
            int      fontSize = 14;
            string   txt      = webset.WaterMarkTxt;
            Random   rnd      = new Random();

            System.Drawing.Image image = System.Drawing.Image.FromFile(path);
            int width  = image.Width;
            int height = image.Height;

            Bitmap   bmp = new Bitmap(image, width, height);
            Graphics g   = Graphics.FromImage(bmp);
            //g.Clear(Color.White);

            //坐标值
            int x = 0, y = 0;

            switch (webset.WaterMarkHorizontal)
            {
            case "left":
                x = 0;
                break;

            case "center":
                x = (width - 20 * (txt.Length)) / 2;
                break;

            case "right":
                x = width - 20 * (txt.Length) - 10;
                break;
            }

            switch (webset.WaterMarkVertical)
            {
            case "top":
                y = 0 + 10;     //向下移动10像素好看些
                break;

            case "middle":
                y = height / 2 - fontSize;
                break;

            case "bottom":
                y = height - 14;
                break;
            }

            // 画验证码
            for (int i = 0; i < txt.Length; i++)
            {
                string fnt = font[rnd.Next(font.Length)];
                Font   ft  = new Font(fnt, fontSize, FontStyle.Bold);
                Color  clr = color[rnd.Next(color.Length)];
                g.DrawString(txt[i].ToString(), ft, new SolidBrush(clr), (float)i * 20 + x, y);
            }

            MemoryStream ms = new MemoryStream();

            bmp.Save(ms, ImageFormat.Png);

            #region 保存加水印的图片

            string testPath = HttpContext.Current.Server.MapPath("~/test2.jpg");
            byte[] imgData  = ms.ToArray();
            if (File.Exists(testPath))
            {
                File.Delete(testPath);
            }
            FileStream fs = new FileStream(testPath, FileMode.Create, FileAccess.Write);
            if (fs != null)
            {
                fs.Write(imgData, 0, imgData.Length);
                fs.Close();
            }

            #endregion

            g.Dispose();
            bmp.Dispose();
            image.Dispose();
        }