Esempio n. 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        model.flag_name = KillSqlIn.Form_ReplaceByString(Request.Form["txtTitle"], 200);

        //string BackUrl = "CategoryTree.aspx";

        if (_id != "0")
        {
            model.flag_id = _id;
            bll.Update(model);
            ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('修改成功!');layer_close_refresh();</script>");
            //JSUtility.AlertAndRedirect("修改成功!", BackUrl);

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (" + _ACid + ")";
            //string function = "修改";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
        else
        {
            model.if_use  = 1;
            model.flag_id = IdCreator.CreateId("T_Base_Flag", "flag_id");
            bll.Add(model);
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (select top 1 CategoryId from T_Category order by CategoryId desc)";
            //string function = "添加";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
    }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FillFeild();
        if (_id != "0")
        {
            bll.Update(model);
            ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('修改成功!');layer_close_refresh();</script>");
            //JSUtility.AlertAndRedirect("修改成功!", BackUrl);

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (" + _ACid + ")";
            //string function = "修改";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
        else
        {
            bll.Add(model);
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (select top 1 CategoryId from T_Category order by CategoryId desc)";
            //string function = "添加";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
    }
Esempio n. 3
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (_Pid != "SysError")
     {
         if (!_Pid.Equals(model.area_id))
         {
             bll.UpdateId(model.area_id, _Pid);                             //先更新编号
         }
         if (bll.Update(model))
         {
             adohelper.ExecuteSqlNonQuery("update T_Base_Area set ishot=" + (this.cbHot.Checked ? "1" : "0") + " where area_id='" + model.area_id + "'");
             this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
         }
     }
     else
     {
         model.area_id = IdCreator.CreateId("T_Base_Area", "area_id");
         if (bll.Add(model))
         {
             adohelper.ExecuteSqlNonQuery("update T_Base_Area set ishot=" + (this.cbHot.Checked ? "1" : "0") + " where area_id='" + model.area_id + "'");
             JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
         }
     }
 }
Esempio n. 4
0
    /// <summary>
    /// 确定提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        model.Title       = KillSqlIn.Form_ReplaceByString(this.txtTitle.Text, 100);
        model.DisplayMode = Convert.ToInt32(this.RadioButtonList1.SelectedValue);
        model.CategoryId  = Convert.ToInt32(this.DrCategory.SelectedValue);
        model.Link        = KillSqlIn.Form_ReplaceByString(this.txtLink.Text.Trim(), 100);
        model.sort        = Convert.ToInt32(KillSqlIn.Form_ReplaceByString(this.txtSort.Text, 10));
        model.StartTime   = !string.IsNullOrEmpty(this.txtStartTime.Text) ? Convert.ToDateTime(this.txtStartTime.Text) : System.DateTime.Now;
        model.EndTime     = !string.IsNullOrEmpty(this.txtEndTime.Text) ? Convert.ToDateTime(this.txtEndTime.Text) : System.DateTime.Now.AddDays(7);
        #region 保存图片
        if (!this.picUpload.Value.Equals(""))
        {
            string FileTZM = this.picUpload.PostedFile.FileName.Substring(this.picUpload.PostedFile.FileName.LastIndexOf(".") + 1);//得到文件的扩展名

            if (!IsPic(FileTZM.ToLower()))
            {
                JSUtility.Alert("上传图片格式不正确!");
                return;
            }
            if (this.picUpload.PostedFile.ContentLength > 1048576)
            {
                JSUtility.Alert("上传图片过大!");
                return;
            }
            Random rnd            = new Random();
            string UpLoadFileTime = DateTime.Now.ToString("HHmmss") + rnd.Next(9999).ToString("0000"); //生成一个新的数图片名称
            string fileName       = UpLoadFileTime + "." + FileTZM;                                    //产生上传图片的名称
            if (!Directory.Exists(Request.MapPath("~/upload/Link/")))
            {
                Directory.CreateDirectory(Request.MapPath("~/upload/Link/"));
            }
            string Url = Request.MapPath("~/upload/Link/" + fileName);
            picUpload.PostedFile.SaveAs(Url);
            model.Image = "/upload/Link/" + fileName;
        }
        else
        {
            model.Image = ViewState["Image"] == null ? "" : ViewState["Image"].ToString();
        }
        #endregion
        if (_Pid != "SysError")
        {
            model.AdId = Convert.ToInt32(_Pid);
            if (bll.Update(model))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            if (bll.Add(model) != 0)
            {
                JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
            }
        }
    }
Esempio n. 5
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (_Pid != "SysError")
     {
         if (bll.Update(model))
         {
             this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
         }
     }
     else
     {
         if (bll.Add(model) != null)
         {
             JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
         }
     }
 }
Esempio n. 6
0
    /// <summary>
    /// 确定提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strError = Validates();

        if (strError != "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('" + strError + "');</script>");
            return;
        }
        model.CategoryId  = Convert.ToInt32(this.ddlType.SelectedValue);
        model.Titie       = SafeRequest.GetFormString("txtTitle");
        model.ReleaseDate = Convert.ToDateTime(this.txtReleaseDate.Text.Trim());
        model.AddedDate   = System.DateTime.Now;
        model.ExpireDate  = System.DateTime.Now;
        model.Body        = SafeRequest.GetFormString("fckBody");
        model.Approved    = SafeRequest.GetFormInt("radioApproved", 0);
        model.AddedUserId = Convert.ToInt32(this.UserId);//默认登录进来人的编号
        if (_Pid != "")
        {
            model.ArticleId = Convert.ToInt32(_Pid);
            if (bll.Update(model))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            int ret = bll.Add(model);
            if (ret == -2)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<Script>alert('该类别只允许添加1篇文章,请到列表中查找然后修改!');</Script>");
            }
            else
            {
                if (ret > 0)
                {
                    JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
                }
            }
        }
    }
Esempio n. 7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DataSet ds = new MemberInfoBLL().GetList("memberName='" + this.txtMemberId.Value + "'");
        int     id = 0;

        if (ds.Tables[0].Rows.Count > 0)
        {
            id = Convert.ToInt32(ds.Tables[0].Rows[0]["memberId"].ToString());
        }
        model.memberId  = id;// Convert.ToInt32(KillSqlIn.Form_ReplaceByString(this.txtMemberId.Value, 10));
        model.money     = Convert.ToDecimal(KillSqlIn.Form_ReplaceByString(this.txtMoney.Text, 10));
        model.moneyType = KillSqlIn.Form_ReplaceByString(this.ddlMoneyType.SelectedValue, 20);
        model.remarks   = KillSqlIn.Form_ReplaceByString(this.txtRemarks.Text, 200);
        model.addPerson = KillSqlIn.Form_ReplaceByString(this.txtAddPerson.Text, 20);
        model.addTime   = Convert.ToDateTime(this.txtReleaseDate.Value.Trim());
        model.shFlag    = 0;

        string BackUrl = "MemberCZRecordList.aspx?PageIndex=" + PageIndex + "";

        if (_mid != "")
        {
            model.sysnumber = _mid;
            bll.Update(model);

            /*日志归档*/
            string sql = @"select l.memberId as title from T_Member_AccountRecord l where sysnumber='" + this._mid + "'";
            PubFunction.InsertLog("业务管理", "会员列表", "会员充值列表", "修改", sql, _mid);

            JSUtility.AlertAndRedirect("修改成功!", BackUrl);
        }
        else
        {
            int i = bll.Add(model);
            /*日志归档*/
            string sql = @"select l.memberId as title from T_Member_AccountRecord l where sysnumber='" + i.ToString() + "'";
            PubFunction.InsertLog("业务管理", "会员列表", "会员充值列表", "添加", sql, i.ToString());
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
        }
    }
Esempio n. 8
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (_Pid != "SysError")
     {
         if (!_Pid.Equals(model.Market_id))
         {
             bll.UpdateId(model.Market_id, _Pid);                               //先更新编号
         }
         if (bll.Update(model))
         {
             this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
         }
     }
     else
     {
         model.Market_id = IdCreator.CreateId("T_Base_Market", "Market_id");
         if (bll.Add(model))
         {
             JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
         }
     }
 }
Esempio n. 9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        model.CategoryName     = KillSqlIn.Form_ReplaceByString(Request.Form["txtTitle"], 200);
        model.Sort             = Convert.ToInt32(KillSqlIn.Form_ReplaceByNumber(Request.Form["txtSort"], 4));
        model.AddedUserId      = Convert.ToInt32(_userId);
        model.AddedDate        = Convert.ToDateTime(this.txtAddDate.Text);
        model.ParentCategoryId = Convert.ToInt32(this.ddlParentCategory.SelectedValue);
        model.Type             = 0;//0:文章  1:新闻

        //string BackUrl = "CategoryTree.aspx";

        if (_ACid != "0")
        {
            model.CategoryId = Convert.ToInt32(_ACid);
            bll.Update(model);
            ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('修改成功!');layer_close_refresh();</script>");
            //JSUtility.AlertAndRedirect("修改成功!", BackUrl);

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (" + _ACid + ")";
            //string function = "修改";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
        else
        {
            model.AddedDate = DateTime.Now;
            int id = bll.Add(model);
            bll.UpdateCategoryPermission(id.ToString());
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());

            /*日志归档*/
            //string sql1 = @"select Title as title from dbo.T_Category  where CategoryId = (select top 1 CategoryId from T_Category order by CategoryId desc)";
            //string function = "添加";
            //PubFunction.InsertLog1("文章类别管理", sql1, function);
        }
    }
Esempio n. 10
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (_Pid != "SysError")
     {
         if (!this.hidBuildingsId.Value.Equals(ViewState["Building_id"].ToString())) //修改了小区
         {
             if (this.hidBuildingsId.Value.Contains("|"))                            //修改为多个小区,实为添加
             {
                 string[] ids = this.hidBuildingsId.Value.Split('|');
                 foreach (string s in ids)
                 {
                     if (bll.GetList(" Building_id = '" + s + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                     {
                         model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
                         model.Building_id         = s;
                         if (bll.Add(model))
                         {
                             this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                         }
                     }
                 }
             }
             else//修改为一个小区
             {
                 if (bll.GetList(" Building_id = '" + this.hidBuildingsId.Value + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                 {//修改的新关系不存在
                     model.BuildingToMarket_id = ViewState["id"].ToString();
                     model.Building_id         = this.hidBuildingsId.Value;
                     if (bll.Update(model))
                     {
                         this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                     }
                 }
                 else
                 {
                     this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('该关系已经存在!');</script>");
                 }
             }
         }
         else
         {
             model.BuildingToMarket_id = ViewState["id"].ToString();
             model.Building_id         = this.hidBuildingsId.Value;
             if (bll.Update(model))
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
             }
         }
     }
     else
     {
         string BuildingsId = this.hidBuildingsId.Value;
         if (BuildingsId.Contains("|"))
         {
             string[] ids = BuildingsId.Split('|');
             foreach (string s in ids)
             {
                 if (bll.GetList(" Building_id = '" + s + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                 {
                     model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
                     model.Building_id         = s;
                     if (bll.Add(model))
                     {
                         JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
                     }
                 }
             }
         }
         else
         {
             model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
             model.Building_id         = BuildingsId;
             if (bll.Add(model))
             {
                 JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
             }
         }
     }
 }
Esempio n. 11
0
    /// <summary>
    /// 确定提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strError = Validates();

        if (!string.IsNullOrEmpty(strError))
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('" + strError + "');</script>");
            return;
        }
        model.CategoryId      = Convert.ToInt32(this.ddlType.SelectedValue);
        model.Title           = SafeRequest.GetFormString("txtTitle");
        model.SubHead         = SafeRequest.GetFormString("txtSubHead");
        model.PublicationUnit = SafeRequest.GetFormString("txtUnit");
        model.FromSource      = SafeRequest.GetFormString("txtFromSouce");
        // model.KeyWord = SafeRequest.GetFormString("txtKeyWord");
        model.ReleaseDate  = !string.IsNullOrEmpty(this.txtReleaseDate.Text.Trim()) ? Convert.ToDateTime(this.txtReleaseDate.Text.Trim()) : System.DateTime.Now;
        model.IsTop        = 0; //SafeRequest.GetFormInt("radioTopList", 0);
        model.IndexCommend = 0; //SafeRequest.GetFormInt("radioIndexCommentList", 0);
        model.HotPic       = SafeRequest.GetFormString("radioHotList");
        model.HotDays      = SafeRequest.GetFormInt("txtHotDays", 3);
        //model.ArticleType = SafeRequest.GetFormInt("radioArticleTypeList", 0);
        model.Body = this.fckBody.Text;

        //追加底部
        if (cbFooter.Checked)
        {
            if (model.Body.IndexOf("start_auto_footer") == -1 && model.Body.IndexOf("end_auto_footer") == -1)
            {
                string autoFooter = "<!--start_auto_footer-->" + this.fckBodyFooter.Text + "<!--end_auto_footer-->";
                model.Body = model.Body + autoFooter;
            }
            //写入缓存
            NG.CachHelper.Redis.RedisHelper redis = new NG.CachHelper.Redis.RedisHelper();
            redis.SetStringCash("News_Footer", this.fckBodyFooter.Text);
            redis.Close();
        }

        //   model.IsComment = 0;// SafeRequest.GetFormInt("radioIsComment", 0);
        model.Approved   = SafeRequest.GetFormInt("radioApproved", 0);
        model.Sort       = SafeRequest.GetFormInt("txtSort", 99);
        model.AddedDate  = System.DateTime.Now;
        model.ExpireDate = System.DateTime.Now;
        model.ViewCount  = 0;
        // model.IsScrool = 0;
        // model.AddedUserId = Convert.ToInt32(_userId);//默认登录进来人的编号
        model.AddedUserId = 1;
        //~/upload/News/
        #region 保存图片
        if (!this.picUpload.Value.Equals("") && this.picUpload.PostedFile.ContentLength > 10)
        {
            string FileTZM = this.picUpload.PostedFile.FileName.Substring(this.picUpload.PostedFile.FileName.LastIndexOf(".") + 1);//得到文件的扩展名

            if (!IsPic(FileTZM.ToLower()))
            {
                JSUtility.Alert("上传图片格式不正确!");
                return;
            }
            if (this.picUpload.PostedFile.ContentLength > 1048576)
            {
                JSUtility.Alert("上传图片过大!");
                return;
            }
            Random rnd            = new Random();
            string UpLoadFileTime = DateTime.Now.ToString("yyMMddHHmmss") + rnd.Next(9999).ToString("0000"); //生成一个新的数图片名称
            string fileName       = UpLoadFileTime + "." + FileTZM;                                          //产生上传图片的名称
            if (!Directory.Exists(Request.MapPath("~/upload/News/")))
            {
                Directory.CreateDirectory(Request.MapPath("~/upload/News/"));
            }
            string Url = Request.MapPath("~/upload/News/" + fileName);
            picUpload.PostedFile.SaveAs(Url);
            model.ImgLink = "/upload/News/" + fileName;
        }
        else
        {
            model.ImgLink = ViewState["ImgLink"].ToString();
        }
        #endregion


        if (_Pid != "")
        {
            model.NewsID = _Pid;
            if (bll.Update(model))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            model.NewsID = IdCreator.CreateId("T_News", "NewsId");
            if (bll.Add(model))
            {
                JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
            }
        }
    }
Esempio n. 12
0
    //保存
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        model.Title       = SafeRequest.GetFormString("txtTitle");
        model.DisplayMode = SafeRequest.GetFormInt("RadioButtonList1", 0);
        model.CategoryId  = SafeRequest.GetFormInt("DrCategory", 0);
        model.Link        = txtLink.Text.Trim();
        model.Sort        = SafeRequest.GetFormInt("txtSort", 0);

        #region 保存图片
        if (!this.picUpload.Value.Equals(""))
        {
            string UploadFileLastName = this.picUpload.PostedFile.FileName.Substring(this.picUpload.PostedFile.FileName.LastIndexOf(".") + 1);//得到文件的扩展名

            if (!PubFunction.IsPic(UploadFileLastName))
            {
                JSUtility.Alert("上传图片格式不正确!");
                return;
            }
            Random rnd            = new Random();
            string UpLoadFileTime = DateTime.Now.ToString("HHmmss") + rnd.Next(9999).ToString("0000"); //生成一个新的数图片名称
            string fileName       = UpLoadFileTime + "." + UploadFileLastName;                         //产生上传图片的名称

            string SaveFile = DateTime.Now.ToString("yyyy/MM/dd/").Replace("-", "/");

            #region 设置保存的路径
            string SevedDirectory = System.Web.VirtualPathUtility.Combine(mainPath, SaveFile);
            string phydic         = MapPath(SevedDirectory);

            if (!System.IO.Directory.Exists(phydic))
            {
                System.IO.Directory.CreateDirectory(phydic);
            }
            #endregion

            this.picUpload.PostedFile.SaveAs(phydic + "" + fileName);
            string fckimg = string.Empty;
            string source = string.Empty;
            fckimg = "<a href='" + this.ResolveUrl(SevedDirectory + fileName) + "' target='_blank'  id='upannexx'>" + fileName + "</a>";
            source = this.ResolveUrl(SevedDirectory + fileName);

            model.Image = SaveFile + fileName;
        }
        else
        {
            model.Image = ViewState["ImgLink"].ToString();
        }

        #endregion

        string BackUrl = "LinkList.aspx?PageIndex=" + PageIndex;

        if (_Lid != "0")
        {
            model.LinkId = Convert.ToInt32(_Lid);
            bll.Update(model);
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");

            //状态
            if (Session["LinkStatus_Hashtable"] != null)
            {
                Hashtable hTable = (Hashtable)Session["LinkStatus_Hashtable"];
                hTable["ReadSessionStatus"]     = "1";
                Session["LinkStatus_Hashtable"] = hTable;
            }

            /*日志归档*/
            string sql = @"select l.title from T_link l where linkid=" + this._Lid + "";
            PubFunction.InsertLog("其它管理", "友情链接", "友情链接列表", "修改", sql, _Lid);
        }
        else
        {
            int i = bll.Add(model);
            JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());


            /*日志归档*/
            string sql = @"select l.title from T_link l where linkid=" + i.ToString() + "";
            PubFunction.InsertLog("其它管理", "友情链接", "友情链接列表", "添加", sql, i.ToString());
        }
    }