Example #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);
        }
    }
Example #2
0
 protected void FillFeild()
 {
     if (_id != "0")
     {
         model            = bll.GetModel(this._id);
         model.templateId = this._id;
     }
     else
     {
         model.templateId = IdCreator.CreateId("T_ShortMessage_Template", "templateId");
         model.isUse      = 1;
     }
     model.flag       = this.ddlParentCategory.SelectedValue;   //标识
     model.supplierId = this.ddlSupplierCategory.SelectedValue; //供应商
     if (!string.IsNullOrEmpty(model.supplierId))
     {
         ShortMsgSupModel modelSup = new ShortMsgSupBll().GetModel(model.supplierId);
         if (modelSup != null)
         {
             model.supplierFlag = modelSup.flag;
         }
     }
     model.templateCode  = KillSqlIn.Form_ReplaceByString(Request.Form["txtCode"], 200);
     model.templateParam = KillSqlIn.Form_ReplaceByString(Request.Form["txtParam"], 200);
 }
Example #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());
         }
     }
 }
Example #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            List <SqlParameter> p = new List <SqlParameter>();
            p.Add(new SqlParameter("@activity_title", activity_title.Value));
            p.Add(new SqlParameter("@activity_desc", activity_desc.Value));
            p.Add(new SqlParameter("@activity_status", activity_status.SelectedValue));
            p.Add(new SqlParameter("@remarks", remarks.Value));
            p.Add(new SqlParameter("@if_approved", if_approved.SelectedValue));
            p.Add(new SqlParameter("@manager_id", manager_id.Value));
            p.Add(new SqlParameter("@job_ids", job_ids.Value));
            p.Add(new SqlParameter("@activity_person", activity_person.Value));

            if (string.IsNullOrWhiteSpace(activity_id.Value))
            {
                string id = IdCreator.CreateId("t_activity_info", "activity_id");
                //add
                p.Add(new SqlParameter("@activity_id", id));
                p.Add(new SqlParameter("@create_time", DateTime.Now));
                p.Add(new SqlParameter("@create_person", this.TrueName));

                string sql    = "insert into t_activity_info(activity_id,activity_title,activity_desc,activity_status,create_time,create_person,if_approved,manager_id,job_ids,activity_person,remarks) values(@activity_id,@activity_title,@activity_desc,@activity_status,@create_time,@create_person,@if_approved,@manager_id,@job_ids,@activity_person,@remarks);";
                int    result = ado.ExecuteSqlNonQuery(sql, p.ToArray());

                if (result == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('新增成功');layer_close_refresh();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('新增失败');</script>");
                }
            }
            else
            {
                //update
                p.Add(new SqlParameter("@activity_id", activity_id.Value));

                string sql    = "update t_activity_info set activity_title=@activity_title,activity_desc=@activity_desc,activity_status=@activity_status,remarks=@remarks,if_approved=@if_approved,manager_id=@manager_id,job_ids=@job_ids,activity_person=@activity_person where activity_id=@activity_id;";
                int    result = ado.ExecuteSqlNonQuery(sql, p.ToArray());

                if (result == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改失败');</script>");
                }
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('提交失败');</script>");
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            List <SqlParameter> p = new List <SqlParameter>();
            p.Add(new SqlParameter("@node_sn", node_sn.Value));
            p.Add(new SqlParameter("@node_name", node_name.Value));
            p.Add(new SqlParameter("@yb_value", yb_value.Value));
            p.Add(new SqlParameter("@jyz_value_set", jyz_value_set.Value));
            p.Add(new SqlParameter("@cs_value_set", cs_value_set.Value));
            p.Add(new SqlParameter("@rq_value_set", rq_value_set.Value));
            p.Add(new SqlParameter("@node_para", node_para.Value));
            p.Add(new SqlParameter("@remarks", remarks.Value));
            p.Add(new SqlParameter("@if_use", if_use.SelectedValue));

            if (string.IsNullOrWhiteSpace(node_id.Value))
            {
                string id = IdCreator.CreateId("t_task_node_config", "node_id");
                //add
                p.Add(new SqlParameter("@node_id", id));
                p.Add(new SqlParameter("@node_code", "cd" + new Random().Next(1000, 9999)));
                p.Add(new SqlParameter("@task_id", task_id.Value));

                string sql    = "insert into t_task_node_config(node_id,task_id,node_code,node_sn,node_name,node_para,remarks,if_use) values(@node_id,@task_id,@node_code,@node_sn,@node_name,@node_para,@remarks,@if_use);";
                int    result = ado.ExecuteSqlNonQuery(sql, p.ToArray());

                if (result == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('新增成功');layer_close_refresh();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('新增失败');</script>");
                }
            }
            else
            {
                //update
                p.Add(new SqlParameter("@node_id", node_id.Value));
                string sql    = "update t_task_node_config set node_sn=@node_sn,node_name=@node_name,node_para=@node_para,remarks=@remarks,if_use=@if_use where node_id=@node_id;";
                int    result = ado.ExecuteSqlNonQuery(sql, p.ToArray());

                if (result == 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改失败');</script>");
                }
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('提交失败');</script>");
        }
    }
Example #6
0
 protected void FillFeild()
 {
     if (_id != "0")
     {
         model            = bll.GetModel(this._id);
         model.supplierId = this._id;
     }
     else
     {
         model.supplierId = IdCreator.CreateId("T_ShortMessage_Supplier", "supplierId");
         model.isUse      = 0;
         model.isDefault  = 0;
     }
     model.flag            = this.ddlParentCategory.SelectedValue;
     model.supplierName    = KillSqlIn.Form_ReplaceByString(Request.Form["txtTitle"], 200);
     model.accessKeyID     = KillSqlIn.Form_ReplaceByString(Request.Form["txtKey"], 200);
     model.accessKeySecret = KillSqlIn.Form_ReplaceByString(Request.Form["txtSecret"], 200);
     model.smsSign         = KillSqlIn.Form_ReplaceByString(Request.Form["txtSmsSign"], 200);
     model.sort            = int.Parse(KillSqlIn.Form_ReplaceByString(Request.Form["txtSort"], int.MaxValue));
 }
Example #7
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (this.id == "")
     {
         MorePropertyConfigSetModel mod = new MorePropertyConfigSetModel();
         mod.propertyId = IdCreator.CreateId("T_Goods_MorePropertySet", "propertyId");
         GetFormInfo(ref mod);
         if (bll.Add(mod) > 0)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href('MorePropertySetList.aspx');</script>");
         }
     }
     else
     {
         MorePropertyConfigSetModel mod = bll.GetModel(this.id);
         GetFormInfo(ref mod);
         if (bll.Update(mod) > 0)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href('MorePropertySetList.aspx');</script>");
         }
     }
 }
Example #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());
         }
     }
 }
        internal static ChannelContext GetNextContext(NettyNetwork network)
        {
            var contexts = GetContexts(network.Id).OrderBy(c => c.ChannelId).ToList();

            if (!contexts.Any())
            {
                return(null);
            }

            ChannelContext context = null;

            while (true)
            {
                if (contexts.Count == 0)
                {
                    break;
                }

                var index = IdCreator.CreateNextId() % contexts.Count;
                context = contexts[index];
                if (context.Handler.IsClient)
                {
                    throw new NotSupportedException("This method does not supported a client network search, you can using GetSingleContext.");
                }

                if (context.ChannelHanderContext.Channel.Active)
                {
                    break;
                }
                else
                {
                    context = null;
                    contexts.RemoveAt(index);
                }
            }
            return(context);
        }
Example #10
0
    protected void InitForm()
    {
        //string signList = "";
        string sign = "";

        if (this.id != "")
        {
            GoodsModel mod = bll.GetModel(this.id);
            if (mod != null)
            {
                this.txtName.Value      = mod.GoodsName;
                this.txtOrder.Value     = mod.Orderby.ToString();
                this.txtRemarks.Text    = mod.Remarks;
                this.div_img.Visible    = true;
                this.Image1.ImageUrl    = mod.GoodsSmallPic;
                this.txtSampleDesc.Text = mod.GoodsSampleDesc;
                this.hzst_ckeditor.Text = mod.GoodsDesc;
                this.cselect.categoryID = mod.CategoryId;

                this.goodsCode = this.txtGoodsCode.Value = mod.GoodsCode;
                if (mod.IsHot == 1)
                {
                    this.cbIsHot.Checked = true;
                }
                if (mod.IsNew == 1)
                {
                    this.cbIsNew.Checked = true;
                }
                if (mod.IsRec == 1)
                {
                    this.cbIsRec.Checked = true;
                }
                //if (mod.IsSpe == 1) { this.cbIsSpe.Checked = true; }
                this.txtSalePrice.Value   = mod.SalePrice.ToString();
                this.txtMarketPrice.Value = mod.MarketPrice.ToString();
                if (mod.MorePropertys != "")
                {
                    this.ddlMorePropertys.SelectedValue = mod.MorePropertys;
                }
                this.rdIsSale.SelectedValue = mod.IsSale.ToString();
                this.hidOldGoodsCode.Value  = mod.GoodsCode;

                sign         = mod.signId;
                hfSign.Value = sign;

                //20160605

                //this.txtJobStartTime.Value = mod.JobStartTime.ToString("yyyy-MM-dd HH:mm");
                //this.txtJobEndTime.Value = mod.JobEndTime.ToString("yyyy-MM-dd HH:mm");
                this.ddlJobType.Value        = mod.JobType;
                this.txtTotalSaleCount.Value = mod.TotalSaleCount.ToString();

                //this.llRemark.Text = GetMemberPrice(this.id);
            }
        }
        else
        {
            this.txtGoodsCode.Value = IdCreator.CreateId("T_Goods_Info", "GoodsCode");
            if (this.cateId != "")   //this.ddlPCategory.SelectedValue = this.cateId;
            {
                this.cselect.categoryID = this.cateId;
            }
            //this.txtJobStartTime.Value = this.txtJobEndTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
        }

        string strSQL = "";

        strSQL += "select * from T_Goods_Sign;";
        strSQL += "select * from T_Goods_Service order by orderby asc;";
        //strSQL += "select * from T_Goods_SignBind where goodsid='" + id + "';";
        AdoHelper     adohelper   = AdoHelper.CreateHelper(StarTech.Util.AppConfig.DBInstance);
        DataSet       ds          = adohelper.ExecuteSqlDataset(strSQL);
        List <string> signList    = new List <string>();
        List <string> serviceList = new List <string>();

        if (sign != "" && sign != null)
        {
            signList = sign.Split(',').ToList();
        }

        string llText = "";

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            if (signList.Contains(ds.Tables[0].Rows[i]["signid"].ToString().Trim()))
            {
                llText += "<input checked='checked' type='checkbox' signname='" + ds.Tables[0].Rows[i]["signname"].ToString() + "' signid='" + ds.Tables[0].Rows[i]["signid"].ToString() + "' class='ckSign' />";
            }
            else
            {
                llText += "<input type='checkbox' signname='" + ds.Tables[0].Rows[i]["signname"].ToString() + "' signid='" + ds.Tables[0].Rows[i]["signid"].ToString() + "' class='ckSign' />";
            }
            llText += ds.Tables[0].Rows[i]["signname"].ToString();
            if ((i + 1) % 6 == 0)
            {
                llText += "<br/>";
            }
            ltSign.Text = llText;
        }
    }
Example #11
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int updateInt = -1;

        if (this.id == "")
        {
            if (this.FileUpload1.HasFile == false)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务图片');</script>");
                return;
            }


            GoodsModel mod = new GoodsModel();
            mod.GoodsId = IdCreator.CreateId("T_Goods_Info", "GoodsId");
            mod.AddTime = DateTime.Now;

            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }
            string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();



            if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                return;
            }
            if (this.FileUpload1.PostedFile.ContentLength > 1024000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>");
                return;
            }
            string newFileName = Guid.NewGuid().ToString() + fileExt;
            string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
            {
                System.IO.Directory.CreateDirectory(Server.MapPath(dir));
            }
            string newPath = dir + newFileName;


            this.FileUpload1.SaveAs(Server.MapPath(newPath));
            //缩略图
            MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
            mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
            //mod.GoodsSmallPic = newPath.Replace(fileExt, "" + fileExt);
            ViewState["OriginalBigImg"] = mod.GoodsSmallPic;
            GetFormInfo(ref mod);
            if (mod.CategoryId == "1")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类')</script>");
            }
            if (bll.Add(mod) > 0)
            {
                string strShop = "select shopId from T_Shop_User where isdefault=1;";

                DataSet ds = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlDataset(strShop);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        string   newGuid   = Guid.NewGuid().ToString();
                        string   shopId    = ds.Tables[0].Rows[0][0].ToString();
                        string   goodsId   = mod.GoodsId;
                        int      num       = mod.Sotck.Value;
                        decimal  price     = mod.SalePrice.Value;
                        int      isSell    = mod.IsSale.Value;
                        DateTime addt      = DateTime.Now;
                        string   goodsCode = mod.GoodsCode;
                        string   strGoods  = "insert into T_Shop_Goods values('" + newGuid + "','" + shopId + "','" + goodsId + "'," + num + "," + price + "," + isSell + ",'" + addt + "','" + goodsCode + "',0,0,0,0);";
                        StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlNonQuery(strGoods);
                    }
                }
                string         strItem = "insert T_Menu_Item(itemName,itemImgSrc,ifBuy,GoodsId,orderBy,remark,unit) values(@itemName,@itemImgSrc,@ifBuy,@GoodsId,@orderBy,@remark,@unit);";
                SqlParameter[] q       =
                {
                    //  @itemImgSrc,@ifBuy,@GoodsId,@orderBy,@remark,@unit
                    new SqlParameter("@itemName",   SqlDbType.VarChar),
                    new SqlParameter("@itemImgSrc", SqlDbType.VarChar),
                    new SqlParameter("@ifBuy",      SqlDbType.Int),
                    new SqlParameter("@GoodsId",    SqlDbType.VarChar),
                    new SqlParameter("@orderBy",    SqlDbType.Int),
                    new SqlParameter("@remark",     SqlDbType.VarChar),
                    new SqlParameter("@unit",       SqlDbType.VarChar)
                };
                q[0].Value = mod.GoodsName;
                q[1].Value = mod.GoodsSmallPic;
                q[2].Value = 1;
                q[3].Value = mod.GoodsId;
                q[4].Value = 9999;
                q[5].Value = "任务“" + mod.GoodsName + "”添加";
                q[6].Value = mod.Uint;

                int rows = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlNonQuery(strItem, q);

                //默认幻灯图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加课程《" + mod.GoodsName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>if(confirm('保存成功')){location.href='GoodsAdd.aspx?id=" + mod.GoodsId + "'}else{}</script>");
            }
        }
        else
        {
            updateInt = 0;
            //string strSQL = "select * from T_Goods_Update where goodsid='" + id+"' and updatetime>'"+DateTime.Now.ToShortDateString()+" 00:00:00';";
            string    strSQL    = "";
            AdoHelper adohelper = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance);
            //DataSet ds = adohelper.ExecuteSqlDataset(strSQL);

            //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0)
            //{
            //    if (ds.Tables[0].Rows.Count > 2)
            //    {
            //        ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
            //        return;
            //    }
            //    else
            //    {
            //        updateInt = 2 - ds.Tables[0].Rows.Count;
            //    }
            //}



            GoodsModel mod = bll.GetModel(this.id);
            if (this.FileUpload1.HasFile == true)
            {
                string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
                if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                    return;
                }
                if (this.FileUpload1.PostedFile.ContentLength > 10240000)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于10M');</script>");
                    return;
                }
                string newFileName = Guid.NewGuid().ToString() + fileExt;
                string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir));
                }
                string newPath = dir + newFileName;

                this.FileUpload1.SaveAs(Server.MapPath(newPath));
                //缩略图
                MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
                mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
                //mod.GoodsSmallPic = newPath.Replace(fileExt, "" + fileExt);
                ViewState["OriginalBigImg"] = mod.GoodsSmallPic;
            }
            //hfSign.Value = hfSign.Value.Replace("--", "-");
            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }



            GetFormInfo(ref mod);
            if (bll.Update(mod))
            {
                adohelper.ExecuteSqlNonQuery("update T_Goods_Info set JobDay=datediff(day,JobStartTime,JobEndTime) where GoodsId='" + mod.GoodsId + "'");

                //默认图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                //if (updateInt == -1)
                //    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href='GoodsList.aspx?id=" + this.cselect.categoryID + "';</script>");
                //else{
                strSQL = "insert T_Goods_Update values('" + mod.GoodsId + "',getdate(),'');";
                adohelper.ExecuteSqlNonQuery(strSQL);
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "编辑任务《" + mod.GoodsName + "》", "编辑", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
                //}
            }
        }
    }
Example #12
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        GoodsTypeModel mod;

        if (this.id != "" && this.id != null)
        {
            mod = bll.GetModel(this.id);
        }
        else
        {
            mod = new GoodsTypeModel();
        }
        string pPath = "";

        string[] codeList = this.cSelect.hfCode.Split('|');
        StarTech.DBUtility.AdoHelper adoHelper = StarTech.DBUtility.AdoHelper.CreateHelper("DB_Instance");



        if (codeList.Length < 1 || cSelect.hfCode == "")
        {
            mod.PCategoryId   = "";
            mod.CategoryLevel = 1;
            mod.CategoryPath  = mod.CategoryId;
        }
        else
        {
            //if(this.cSelect.categoryID)
            mod.PCategoryId = codeList[codeList.Length - 1];

            DataSet ds = adoHelper.ExecuteSqlDataset("select * from T_Info_Category where categoryid='" + KillSqlIn.Form_ReplaceByString(mod.PCategoryId, 20) + "';");
            mod.CategoryLevel = Convert.ToInt32(ds.Tables[0].Rows[0]["CategoryLevel"].ToString()) + 1;
            pPath             = ds.Tables[0].Rows[0]["CategoryPath"].ToString();
        }

        if (pPath != "")
        {
            pPath += ",";
        }

        mod.CategoryName = this.txtMenuName.Text.Trim();
        //mod.CategoryPath=
        //mod.Remarks = this.txtRemarks.Text.Trim();
        int orderdy = 0;

        int.TryParse(this.txtSort.Text.Trim(), out orderdy);
        mod.Orderby      = orderdy;
        mod.CategoryFlag = (this.cbIsVisible.Checked == true) ? "Course" : "Category";

        if (fuImg.FileName != null && fuImg.FileName != "")
        {
            //mod.Url = fuImg.FileName;
            string nowUrl = Guid.NewGuid().ToString();
            string tzm    = fuImg.FileName.Substring(fuImg.FileName.LastIndexOf("."));
            string url    = "/upload/Category/" + nowUrl + "" + tzm;
            fuImg.SaveAs(Server.MapPath("~" + url));
            mod.Url = url;
        }

        if (this.id != "" && this.id != null)
        {
            if (this.id == mod.PCategoryId)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('上级分类不能选择当前分类');layer_close_refresh();</script>");
                return;
            }
            mod.CategoryPath = pPath + mod.CategoryId;
            if (bll.Update(mod))
            {
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "修改任务分类《" + mod.CategoryName + "》", "修改", "", "", HttpContext.Current.Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            mod.CategoryId = IdCreator.CreateId("T_Info_Category", "CategoryId");

            mod.CategoryPath = pPath + mod.CategoryId;
            bll.Add(mod);
            LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加任务分类《" + mod.CategoryName + "》;", "添加", "", "", HttpContext.Current.Request.Url.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('添加成功');layer_close_refresh();</script>");
            //JSUtility.ReplaceOpenerParentWindow("menuTree.aspx");
        }

        //ModMenu detail = new ModMenu();
        //detail.menuName = this.txtMenuName.Text.Trim();
        //detail.menuTarget = this.txtMenuLink.Text.Trim();
        //detail.isShow = (this.cbIsVisible.Checked == true ? 1 : 0);
        //detail.orderIndex = Convert.ToInt32(this.txtSort.Text.Trim());
        //detail.parentMenuId = Convert.ToInt32(this.cSelect.categoryID);
        //if (this._menuId != null)
        //{
        //    int menuId = Convert.ToInt32(this._menuId);
        //    detail.uniqueId = menuId;
        //    this._menu.Update(detail);
        //    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
        //}
        //else
        //{
        //    this._menu.Add(detail);
        //    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('添加成功');layer_close_refresh();</script>");
        //    //JSUtility.ReplaceOpenerParentWindow("menuTree.aspx");
        //}
    }
Example #13
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());
            }
        }
    }
Example #14
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int updateInt = -1;

        if (this.id == "")
        {
            if (this.FileUpload1.HasFile == false)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务图片');</script>");
                return;
            }

            if (this.ddlMorePropertys.SelectedValue == "视频和练习")
            {
                if (this.FileUpload2.HasFile == false)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择视频文件');</script>");
                    return;
                }
            }

            GoodsModel mod = new GoodsModel();
            mod.GoodsId    = IdCreator.CreateId("T_Goods_Info", "GoodsId");
            mod.AddTime    = DateTime.Now;
            mod.CategoryId = mod.GoodsToTypeId = this.hid_pgoodsid.Value;
            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }


            string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
            if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                return;
            }
            if (this.FileUpload1.PostedFile.ContentLength > 1024000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>");
                return;
            }
            string newFileName = Guid.NewGuid().ToString() + fileExt;
            string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
            {
                System.IO.Directory.CreateDirectory(Server.MapPath(dir));
            }
            string newPath = dir + newFileName;


            this.FileUpload1.SaveAs(Server.MapPath(newPath));
            //缩略图
            //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
            //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
            mod.GoodsSmallPic           = newPath;
            ViewState["OriginalBigImg"] = mod.GoodsSmallPic;


            //视频文件_start
            if (this.FileUpload2.HasFile == true)
            {
                string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
                if (fileExt_video != ".mp4")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>");
                    return;
                }
                string newFileName_video = Guid.NewGuid().ToString() + fileExt_video;
                string dir_video         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir_video));
                }
                string newPath_video = dir_video + newFileName_video;
                this.FileUpload2.SaveAs(Server.MapPath(newPath_video));
                mod.BookInfo = newPath_video;
            }
            //视频文件_end

            GetFormInfo(ref mod);
            if (mod.CategoryId == "1")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类')</script>");
            }
            if (bll.Add(mod) > 0)
            {
                //默认幻灯图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加任务《" + mod.GoodsName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>if(confirm('保存成功')){location.href='SubGoodsAdd.aspx?id=" + mod.GoodsId + "'}else{}</script>");
            }
        }
        else
        {
            updateInt = 0;
            //string strSQL = "select * from T_Goods_Update where goodsid='" + id+"' and updatetime>'"+DateTime.Now.ToShortDateString()+" 00:00:00';";
            string    strSQL    = "";
            AdoHelper adohelper = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance);
            //DataSet ds = adohelper.ExecuteSqlDataset(strSQL);

            //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0)
            //{
            //    if (ds.Tables[0].Rows.Count > 2)
            //    {
            //        ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
            //        return;
            //    }
            //    else
            //    {
            //        updateInt = 2 - ds.Tables[0].Rows.Count;
            //    }
            //}



            GoodsModel mod = bll.GetModel(this.id);
            if (this.FileUpload1.HasFile == true)
            {
                string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
                if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>");
                    return;
                }
                if (this.FileUpload1.PostedFile.ContentLength > 1024000)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>");
                    return;
                }
                string newFileName = Guid.NewGuid().ToString() + fileExt;
                string dir         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir));
                }
                string newPath = dir + newFileName;

                this.FileUpload1.SaveAs(Server.MapPath(newPath));
                //缩略图
                //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt)));
                //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt);
                mod.GoodsSmallPic           = newPath;
                ViewState["OriginalBigImg"] = mod.GoodsSmallPic;
            }


            //视频文件_start
            if (this.FileUpload2.HasFile == true)
            {
                string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
                if (fileExt_video != ".mp4")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>");
                    return;
                }
                string newFileName_video = Guid.NewGuid().ToString() + fileExt_video;
                string dir_video         = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false)
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath(dir_video));
                }
                string newPath_video = dir_video + newFileName_video;
                this.FileUpload2.SaveAs(Server.MapPath(newPath_video));
                mod.BookInfo = newPath_video;
            }
            //视频文件_end

            //hfSign.Value = hfSign.Value.Replace("--", "-");
            if (hfSign.Value.Length > 0)
            {
                mod.signId = hfSign.Value;
            }
            else
            {
                mod.signId = "";
            }



            GetFormInfo(ref mod);
            if (bll.Update(mod))
            {
                adohelper.ExecuteSqlNonQuery("update T_Goods_Info set JobDay=datediff(day,JobStartTime,JobEndTime) where GoodsId='" + mod.GoodsId + "'");

                //默认图片
                //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); }
                //if (updateInt == -1)
                //    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href='GoodsList.aspx?id=" + this.cselect.categoryID + "';</script>");
                //else{
                strSQL = "insert T_Goods_Update values('" + mod.GoodsId + "',getdate(),'');";
                adohelper.ExecuteSqlNonQuery(strSQL);
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "编辑任务《" + mod.GoodsName + "》", "编辑", "", "", HttpContext.Current.Request.Url.ToString());

                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>");
                //}
            }
        }
    }
Example #15
0
    /// <summary>
    /// 保存信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        MenuModel model = new MenuModel();

        if (menuId != null && menuId != "")
        {
            model = new MenuBll().GetModel(menuId);
            if (model == null)
            {
                model = new MenuModel();
            }
        }
        model.menuName = txtMenuName.Text;
        model.Flavor   = txtFlavor.Text;
        //model.Technology=ddlTechnology.SelectedValue;
        model.Technology   = txtTechnology.Text;
        model.Flavor       = txtFlavor.Text;
        model.CookingTime  = txtCookieTime.Text;
        model.CookingSkill = txtCookingSkill.Text;
        string[] strCode = selectMenu.hfCode.Split('|');
        if (strCode.Length > 0)
        {
            model.categoryId = strCode[strCode.Length - 1];
        }
        if (strCode[strCode.Length - 1] == "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类');</script>");
        }
        if (hfSign.Value.Length > 0)
        {
            model.signId = hfSign.Value;
        }
        else
        {
            model.signId = "";
        }

        decimal d = 0;

        if (decimal.TryParse(txtCalorie.Text, out d))
        {
            model.Calorie = d;
        }
        model.isShow = cbShow.Checked ? 1 : 0;
        model.isTop  = cbTop.Checked ? 1 : 0;

        if (fuBigImg.FileName.ToLower().Contains(".jpg") || fuBigImg.FileName.ToLower().Contains(".png") || fuBigImg.FileName.ToLower().Contains(".bmp") || fuBigImg.FileName.ToLower().Contains(".gif"))
        {
            string filePath = "/Upload/Menu/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/";
            if (!Directory.Exists(Server.MapPath(filePath)))
            {
                Directory.CreateDirectory(Server.MapPath(filePath));
            }
            string fileName = DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Second + new Random().Next(10, 99);
            string tzm      = fuBigImg.FileName.Substring(fuBigImg.FileName.LastIndexOf("."));
            fuBigImg.SaveAs(Server.MapPath(filePath + fileName + tzm));
            model.imgSrc = filePath + fileName + tzm;
            if (model.imgSrc != null && model.imgSrc != "")
            {
                llBigImg.Text = "<img src='" + model.imgSrc + "' width='100px' height='100px'/>";
            }
        }
        else if (fuBigImg.FileName != null && fuBigImg.FileName != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('展示图图片格式不正确');</script>");
            return;
        }

        if (fuSmallImg.FileName.ToLower().Contains(".jpg") || fuSmallImg.FileName.ToLower().Contains(".png") || fuSmallImg.FileName.ToLower().Contains(".bmp") || fuSmallImg.FileName.ToLower().Contains(".gif"))
        {
            string filePath = "/Upload/Menu/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/";
            string fileName = DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Second + new Random().Next(10, 99);
            string tzm      = fuSmallImg.FileName.Substring(fuSmallImg.FileName.LastIndexOf("."));
            fuSmallImg.SaveAs(Server.MapPath(filePath + fileName + tzm));
            model.smallImgSrc = filePath + fileName + tzm;
            if (model.smallImgSrc != null && model.smallImgSrc != "")
            {
                llSmallImg.Text = "<img src='" + model.smallImgSrc + "' width='100px' height='100px'/>";
            }
        }
        else if (fuSmallImg.FileName != null && fuSmallImg.FileName != "")
        {
            ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('预览图图片格式不正确');</script>");
            return;
        }

        if (menuId == null || menuId == "")
        {
            model.menuId  = IdCreator.CreateId("T_Menu_Info", "menuId");
            model.AddTime = DateTime.Now;
            if (new MenuBll().Add(model))
            {
                BindItemInfo(model.menuId);
                LogAdd.CreateLog(Session["UserId"].ToString(), "添加菜谱《" + model.menuName + "》", "添加", "", "", Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('添加成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            //model.menuId = IdCreator.CreateId("T_Menu_Info", "menuId");
            if (new MenuBll().Update(model))
            {
                BindItemInfo(model.menuId);
                LogAdd.CreateLog(Session["UserId"].ToString(), "修改菜谱《" + model.menuName + "》", "修改", "", "", Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
    }