Exemplo n.º 1
0
        /// <summary>
        /// 同步数据库
        /// </summary>
        /// <param name="context"></param>
        private void UpdateFromBase(HttpContext context)
        {
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();
            string sql = "";

            string where = context.Request["num"] == null ? "" : context.Request["num"].ToString();
            if (where == "")
            {
                sql = "update fv_projectbrand p ,fv_sys_brand v set p.brandLogo=v.sys_logo,p.brandDesc=v.sys_desc where p.brandName=v.sys_nane and p.lastChangeTime=p.createTime and  p.projectid=" + int.Parse(context.Request["id"].ToString());
            }
            else
            {
                sql = "update fv_projectbrand p ,fv_sys_brand v set p.brandLogo=v.sys_logo,p.brandDesc=v.sys_desc where p.brandName=v.sys_nane and  p.projectid=" + int.Parse(context.Request["id"].ToString()) + " and p.id in (" + where + ")";
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除数据库记录
        /// </summary>
        /// <param name="context"></param>
        private void DelRecord(HttpContext context)
        {
            string where = context.Request["id"] == null ? "" : context.Request["id"].ToString();
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();
            string sql = "";
            string msg = "";
            bool   w   = false;

            if (where == "")
            {
                msg = "数据库网络延迟";
            }
            else
            {
                sql = "delete from fv_floor where id in (" + where + ")";
                w   = SqlManage.OpRecord(sql, sqlparams);
            }
            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 3
0
        private void RecordAdd(HttpContext context)
        {
            string areaPoints     = context.Request.Form["txtArea"].ToString();
            string floorLevel     = context.Request.Form["hidFloorId"].ToString();
            string projectBrandId = context.Request.Form["projectBrandId"].ToString();
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@floorLevel", floorLevel);
            sqlparams.Add("@areaPoints", areaPoints);
            string sql = "";

            sql = "update fv_projectbrand set floorLevel=@floorLevel,areaPoints=@areaPoints,lastchangetime=now() where id=" + projectBrandId;
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 4
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(Server.MapPath(@"~/release/" + Label2.Text + "/images")))
            {
                //Directory.CreateDirectory(Server.MapPath(@"~/release/" + txtName.Value));//创建项目根文件夹
                Directory.CreateDirectory(Server.MapPath(@"~/release/" + Label2.Text + "/images"));
            }
            //Dictionary<string, object> sqlparams = new Dictionary<string, object>();
            string logo = "";

            if (txtlogo.HasFile)
            {
                string timeSign = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString()
                                  + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString()
                                  + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                logo = "../images/" + timeSign + txtlogo.FileName;
                txtlogo.SaveAs(Server.MapPath(@"~/release/" + Label2.Text + "/images/") + timeSign + txtlogo.FileName);
            }
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@projectId", int.Parse(Label2.Text));
            sqlparams.Add("@brandTypeName", txtName.Value);
            sqlparams.Add("@brandTypeOrder", btOrder.Value);
            sqlparams.Add("@brandTypeImg", logo);
            sqlparams.Add("@brandTypeBackColor", "");
            sqlparams.Add("@btIsShow", "1");
            string sql = "";

            if (int.Parse(hidpro.Value) == 0)
            {
                sql = "insert into fv_projectbrandtype (projectId,brandTypeName,brandTypeOrder,brandTypeImg,isShow,brandTypeBackColor,createTime,lastChangeTime)" +
                      "values(@projectId,@brandTypeName,@brandTypeOrder,@brandTypeImg,@btIsShow,@brandTypeBackColor,now(),now())";
            }
            else
            if (logo == "")
            {
                sql = "update fv_projectbrandtype set brandTypeName=@brandTypeName,brandTypeOrder=@brandTypeOrder,isShow=@btIsShow,brandTypeBackColor=@brandTypeBackColor,lastChangeTime=NOW() where id=" + int.Parse(hidpro.Value);
            }
            else
            {
                sql = "update fv_projectbrandtype set brandTypeName=@brandTypeName,brandTypeOrder=@brandTypeOrder,brandTypeImg=@brandTypeImg,isShow=@btIsShow,brandTypeBackColor=@brandTypeBackColor,lastChangeTime=NOW() where id=" + int.Parse(hidpro.Value);
            }
            bool w = SqlManage.OpRecord(sql, sqlparams);

            if (w)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "success",
                                                    "alert('您操作成功!稍后自动跳转到列表页'); window.location='projectBrandType_query.aspx?projectId=" + Label2.Text + "&projectName=" + Label1.Text + "'", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "error",
                                                    "alert('数据库连接异常!');", true);
            }
        }
Exemplo n.º 5
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            //if (!Directory.Exists(Server.MapPath(@"~/release" + txtName.Value)))
            //{
            //    Directory.CreateDirectory(Server.MapPath(@"~/release" + txtName.Value));//创建项目根文件夹
            //    Directory.CreateDirectory(Server.MapPath(@"~/release" + txtName.Value + "/images"));
            //}
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();
            string logo = "";

            if (txtlogo.HasFile)
            {
                string timeSign = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString()
                                  + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString()
                                  + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                logo = @"/release/" + hidpro.Value + "/images/" + timeSign + txtlogo.FileName;
                txtlogo.SaveAs(Server.MapPath(@"~/release/" + hidpro.Value + "/images/") + timeSign + txtlogo.FileName);
            }
            sqlparams.Add("@projectName", txtName.Value);
            sqlparams.Add("@projectLogo", logo);
            sqlparams.Add("@projectDesc", txtdesc.Value);
            //sqlparams.Add("@projectImg", bImg);
            //sqlparams.Add("@projectVideo", bVideo);
            sqlparams.Add("@projectCity", txtcity.Value);
            //sqlparams.Add("@projectFirstShow", bFirst);
            string sql = "";

            if (int.Parse(hidpro.Value) == 0)
            {
                sql = "insert into fv_project (projectName,projectLogo,projectDesc,projectCity,createTime,lastChangeTime) values(@projectName,@projectLogo,@projectDesc,@projectCity,now(),now())";
            }
            else
            if (logo == "")
            {
                sql = "update fv_project set projectName=@projectName,projectDesc=@projectDesc,projectCity=@projectCity,lastChangeTime=NOW() where id=" + int.Parse(hidpro.Value);
            }
            else
            {
                sql = "update fv_project set projectName=@projectName,projectLogo=@projectLogo,projectDesc=@projectDesc,projectCity=@projectCity,lastChangeTime=NOW() where id=" + int.Parse(hidpro.Value);
            }
            bool w = SqlManage.OpRecord(sql, sqlparams);

            if (w)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "success",
                                                    "alert('您操作成功!稍后自动跳转到列表页'); window.location='cityProject_query.aspx'", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "error",
                                                    "alert('数据库连接异常!');", true);
            }
        }
Exemplo n.º 6
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(Server.MapPath(@"~/brandTemplate")))
            {
                Directory.CreateDirectory(Server.MapPath(@"~/brandTemplate"));
            }
            string bName = txtName.Value;
            //string bImg = "";
            string bDesc  = txtdesc.Value;
            string bLogo  = txtlogo.FileName;
            string bVideo = txtvideo.FileName;
            int    id     = hidpro.Value == "0" ? 0 : int.Parse(hidpro.Value);
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@sys_nane", bName);
            //sqlparams.Add("@brandImg", bImg);
            sqlparams.Add("@sys_desc", bDesc);
            sqlparams.Add("@sys_logo", @"/brandTemplate/" + bLogo);
            sqlparams.Add("@sys_video", bVideo);
            sqlparams.Add("@sys_type", "");
            sqlparams.Add("@sys_typeName", "");
            if (txtlogo.HasFile)
            {
                txtlogo.SaveAs(Server.MapPath(@"~/brandTemplate/" + txtlogo.FileName));
            }
            //else if (txtvideo.HasFile)
            //{
            //    txtvideo.SaveAs(Server.MapPath(@"~/brandTemplate/" + txtvideo.FileName));
            //}
            string sql = "";

            if (id == 0)
            {
                sql = "insert into fv_sys_brand (sys_nane,sys_desc,sys_logo,sys_video,sys_type,sys_typeName,createTime,lastChangeTime) values(@sys_nane,@sys_desc,@sys_logo,@sys_video,@sys_type,@sys_typeName,now(),now())";
            }
            else
            {
                sql = "update fv_sys_brand set sys_nane=@sys_nane,sys_desc=@sys_desc,sys_logo=@sys_logo,sys_video=@sys_video,sys_type=@sys_type,sys_typeName=@sys_typeName,lastChangeTime=NOW() where id=" + id;
            }
            bool w = SqlManage.OpRecord(sql, sqlparams);

            if (w)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "success",
                                                    "alert('您操作成功!稍后自动跳转到列表页'); window.location='sysRecord.aspx'", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "error",
                                                    "alert('数据库连接异常!');", true);
            }
        }
Exemplo n.º 7
0
        private void RecordAdd(HttpContext context)
        {
            string floorId    = context.Request.Form["floorId"].ToString();
            string areaPoints = context.Request.Form["txtArea"].ToString();

            string[] arrS        = areaPoints.Split(';');
            string   clientPoint = arrS[0];               //第一个点是C
            string   liftPoint   = arrS[arrS.Length - 1]; // 第二个点是L
            string   floorLevel  = context.Request.Form["floorLevel"].ToString();
            string   projectId   = context.Request.Form["projectId"].ToString();
            int      id          = string.IsNullOrEmpty(context.Request.Form["clientId"].ToString()) ? 0 : int.Parse(context.Request.Form["clientId"].ToString());
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@floorLevel", floorLevel);
            sqlparams.Add("@liftPoint", liftPoint);
            sqlparams.Add("@projectId", projectId);
            sqlparams.Add("@floorId", floorId);
            sqlparams.Add("@clientPoint", clientPoint);
            sqlparams.Add("@nextPointName", areaPoints);

            string sql = "";

            if (id == 0)
            {
                //插入client
                sql = "insert into fv_client (clientPoint,clientName,projectId,floorLevel,floorId,nextPointId,nextPointName,isClient) values(@clientPoint,@clientPoint,@projectId,@floorLevel,@floorId,0,@nextPointName,1);";
                //插入lift
                sql += "insert into fv_client (clientPoint,clientName,projectId,floorLevel,floorId,nextPointId,nextPointName,isClient) values(@liftPoint,@liftPoint,@projectId,@floorLevel,@floorId,0,'',0);";
            }
            else
            {
                //c有nextName  l没有
                sql  = "update fv_client set clientPoint=@clientPoint,clientName=@clientPoint,nextPointName=@nextPointName where id=" + id;
                sql += string.Format("; update fv_client set clientPoint=@liftPoint,clientName=@liftPoint where floorLevel={0} and projectId={1} and isClient=0",
                                     floorLevel, projectId);
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 8
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(Server.MapPath("~/release/" + ViewState["proId"].ToString() + "/images")))//创建项目楼层图片目录
            {
                Directory.CreateDirectory(Server.MapPath("~/release/" + ViewState["proId"].ToString() + "/images"));
            }
            string img = "";

            if (floorImg.HasFile)
            {
                img = @"/release/" + ViewState["proId"].ToString() + "/images/" + floorLevel.Value + "F" + GetExtension(floorImg.FileName);
                floorImg.SaveAs(Server.MapPath("~/release/" + ViewState["proId"].ToString() + "/images/" + floorLevel.Value + floorImg.FileName));
            }
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@floorLevel", floorLevel.Value);
            sqlparams.Add("@hidProId", ViewState["proId"]);
            sqlparams.Add("@floorImg", img);
            string sql = "";

            if (int.Parse(hidpro.Value) == 0)
            {
                sql = "insert into fv_floor (projectId,floorLevel,floorImg,createTime,lastChangeTime) values(@hidProId,@floorLevel,@floorImg,now(),now())";
            }
            else
            if (img != "")
            {
                sql = "update fv_floor set projectId=@hidProId,floorLevel=@floorLevel,floorImg=@floorImg,lastChangeTime=now() where id=" + int.Parse(hidpro.Value);
            }
            else
            {
                sqlparams.Remove("@floorImg");
                sql = "update fv_floor set projectId=@hidProId,floorLevel=@floorLevel,lastChangeTime=now() where id=" + int.Parse(hidpro.Value);
            }
            bool w = SqlManage.OpRecord(sql, sqlparams);

            if (w)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "success",
                                                    "alert('您操作成功!稍后自动跳转到列表页'); window.location='setFloor.aspx?projectId=" + ViewState["proId"].ToString()
                                                    + "&projectName=" + Label1.Text + "'", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "error",
                                                    "alert('数据库连接异常!');", true);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 增更数据库
        /// </summary>
        /// <param name="context"></param>
        private void RecordAdd(HttpContext context)
        {
            string bName  = context.Request.Form["txtName"].ToString();
            string bImg   = context.Request.Form["txtImg"].ToString();
            string bDesc  = context.Request.Form["txtdsc"].ToString();
            string bLogo  = context.Request.Form["txtlogo"].ToString();
            string bVideo = context.Request.Form["txtvideo"].ToString();
            string bCity  = context.Request.Form["txtcity"].ToString();
            string bFirst = context.Request.Form["txtfirst"].ToString();
            int    id     = context.Request.Form["hid"].ToString() == "" ? 0 : int.Parse(context.Request.Form["hid"].ToString());
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@projectName", bName);
            sqlparams.Add("@projectLogo", bLogo);
            sqlparams.Add("@projectDesc", bDesc);
            sqlparams.Add("@projectImg", bImg);
            sqlparams.Add("@projectVideo", bVideo);
            sqlparams.Add("@projectCity", bCity);
            sqlparams.Add("@projectFirstShow", bFirst);
            string sql = "";

            if (id == 0)
            {
                sql = "insert into fv_project (projectName,projectLogo,projectDesc,projectImg,projectVideo,projectCity,projectFirstShow,createTime,lastChangeTime) values(@projectName,@projectLogo,@projectDesc,@projectImg,@projectVideo,@projectCity,@projectFirstShow,now(),now())";
            }
            else
            {
                sql = "update fv_project set projectName=@projectName,projectLogo=@projectLogo,projectDesc=@projectDesc,projectImg=@projectImg,projectVideo=@projectVideo,projectCity=@projectCity,projectFirstShow=@projectFirstShow,lastChangeTime=NOW() where id=" + id;
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 同步数据库
        /// </summary>
        /// <param name="context"></param>
        private void UpdateFromBase(HttpContext context)
        {
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();
            string sql = "update fv_projectbrandtype p ,fv_sysbrand v set p.brandTypeImg=v.brandLogo where brandTypeName=v.brandName and p.projectid=" + int.Parse(context.Request["id"].ToString());
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 增更数据库
        /// </summary>
        /// <param name="context"></param>
        private void RecordAdd(HttpContext context)
        {
            string bName  = context.Request.Form["txtName"].ToString();
            string bImg   = context.Request.Form["txtImg"].ToString();
            string bDesc  = context.Request.Form["txtdsc"].ToString();
            string bLogo  = context.Request.Form["txtlogo"].ToString();
            string bVideo = context.Request.Form["txtvideo"].ToString();
            int    id     = context.Request.Form["hid"].ToString() == "" ? 0 : int.Parse(context.Request.Form["hid"].ToString());
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@brandName", bName);
            sqlparams.Add("@brandImg", bImg);
            sqlparams.Add("@brandDesc", bDesc);
            sqlparams.Add("@brandLogo", bLogo);
            sqlparams.Add("@brandVideo", bVideo);
            string sql = "";

            if (id == 0)
            {
                sql = "insert into fv_sysbrand (brandName,brandImg,brandDesc,brandLogo,brandVideo,createTime,lastChangeTime) values(@brandName,@brandImg,@brandDesc,@brandLogo,@brandVideo,now(),now())";
            }
            else
            {
                sql = "update fv_sysbrand set brandName=@brandName,brandImg=@brandImg,brandDesc=@brandDesc,brandLogo=@brandLogo,brandVideo=@brandVideo,lastChangeTime=NOW() where id=" + id;
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 12
0
        private void RecordAdd(HttpContext context)
        {
            string floorLevel  = context.Request.Form["floorLevel"].ToString();
            string projectId   = context.Request.Form["projectId"].ToString();
            string floorId     = context.Request.Form["floorId"].ToString();
            string clientPoint = context.Request.Form["clientPoint"].ToString();
            int    id          = context.Request.Form["hid"].ToString() == "" ? 0 : int.Parse(context.Request.Form["hid"].ToString());
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@floorLevel", floorLevel);
            sqlparams.Add("@projectId", projectId);
            sqlparams.Add("@floorId", floorId);
            sqlparams.Add("@clientPoint", clientPoint);
            string sql = "";

            if (id == 0)
            {
                sql = "insert into fv_client (clientPoint,clientName,projectId,floorLevel,floorId,nextPointId,nextPointName,isclient) values(@clientPoint,@clientPoint,@projectId,@floorLevel,@floorId,0,'',0)";
            }
            else
            {
                sql = "update fv_client set clientPoint=@clientPoint,clientName=@clientPoint where id=" + id;
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 13
0
        private void RecordAdd(HttpContext context)
        {
            string clientId       = context.Request.Form["clientId"].ToString();
            string areaPoints     = context.Request.Form["txtArea"].ToString();
            string floorLevel     = context.Request.Form["floorLevel"].ToString();
            string projectBrandId = context.Request.Form["projectBrandId"].ToString();
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@walkWay", areaPoints);
            string sql = "";

            sql = string.Format("select count(*) from fv_walkway where projectBrandId={0} and fromClientId={1}", projectBrandId, clientId);
            int rtn = Convert.ToInt32(SqlManage.Exists(sql, sqlparams));

            if (rtn > 0)
            {
                sql = string.Format("update fv_walkway set walkWay=@walkWay where projectBrandId={0} and fromClientId={1}", projectBrandId, clientId);
            }
            else
            {
                sql = string.Format("insert into fv_walkway (projectBrandId,walkWay,fromClientId) values ({0},@walkWay,{1})", projectBrandId, clientId);
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 14
0
        /// <summary>
        /// 增更数据库
        /// </summary>
        /// <param name="context"></param>
        private void RecordAdd(HttpContext context)
        {
            string img       = "";
            string projectid = context.Request.Form["hidpro"].ToString();

            if (context.Request.Files["floorImg"] != null)
            {
                HttpPostedFile _upfile = context.Request.Files["floorImg"];
                if (!System.IO.Directory.Exists(context.Server.MapPath("~/" + projectid + "/floors")))//创建项目楼层图片目录
                {
                    System.IO.Directory.CreateDirectory(context.Server.MapPath("~/" + projectid + "/floors"));
                }
                _upfile.SaveAs(HttpContext.Current.Server.MapPath("~/images/logo.jpg")); //保存图片
                img = context.Server.MapPath("~/" + projectid + "/floors") + "/" + _upfile.FileName;
            }
            else
            {
                img = "";
            }
            string floorLevel = context.Request.Form["floorLevel"].ToString();
            string hidProId   = context.Request.Form["hidProId"].ToString();
            //HttpPostedFile _upfile = context.Request.Files["File1"];
            // _upfile.SaveAs(HttpContext.Current.Server.MapPath("~/images/logo.jpg")); //保存图片
            //string floorLevel = context.Request.Form["floorLevel"].ToString();   //楼层是第几层
            //string hidProId = context.Request.Form["hidProId"].ToString();   //隐藏的projectID 项目ID
            int id = context.Request.Form["hid"].ToString() == "" ? 0 : int.Parse(context.Request.Form["hid"].ToString());
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@floorLevel", floorLevel);
            sqlparams.Add("@hidProId", hidProId);
            sqlparams.Add("@floorImg", "f" + img);
            string sql = "";

            if (id == 0)  //用来标识是添加还是修改,如果有ID,则是修改(根据ID修改),如果为0则是添加
            {
                sql = "insert into fv_floor (projectId,floorLevel,floorImg,createTime,lastChangeTime) values(@hidProId,@floorLevel,@floorImg,now(),now())";
            }
            else
            if (img != "")
            {
                sql = "update fv_floor set projectId=@hidProId,floorLevel=@floorLevel,floorImg=@floorImg,lastChangeTime=now() where id=" + id;
            }
            else
            {
                sqlparams.Remove("@floorImg");
                sql = "update fv_floor set projectId=@hidProId,floorLevel=@floorLevel,lastChangeTime=now() where id=" + id;
            }
            bool   w   = SqlManage.OpRecord(sql, sqlparams);
            string msg = "";

            if (w)
            {
                msg = "suc";
            }
            else
            {
                msg = "数据库连接超时或出现未知错误";
            }
            JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();

            context.Response.Write(javascriptSerializer.Serialize(msg));
        }
Exemplo n.º 15
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(Server.MapPath(@"~/release/" + ViewState["proId"].ToString() + "/images")))
            {
                Directory.CreateDirectory(Server.MapPath(@"~/release/" + ViewState["proId"].ToString() + @"/images"));
            }
            string bName = txtName.Value;
            //string bImg = "";
            string timeSign = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString()
                              + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString()
                              + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
            string qrcode = "";

            if (fvUrl.Value != "")
            {
                qrcode = BuildQrCode(fvUrl.Value, value: timeSign);//生成二维码图片存放
            }
            string phone = "";

            if (sphoneurl.Value != "")
            {
                phone = BuildQrCode(sphoneurl.Value, value: timeSign);
            }
            string bDesc  = txtdesc.Value;
            string bLogo  = "";
            string bVideo = txtvideo.FileName;
            int    isStar = int.Parse(ddlisStar.SelectedValue);
            int    isShow = int.Parse(ddlisShow.SelectedValue);
            string url    = fvUrl.Value;
            string tel    = telephone.Value;
            string addr   = address.Value;
            int    id     = hidpro.Value == "0" ? 0 : int.Parse(hidpro.Value);
            Dictionary <string, object> sqlparams = new Dictionary <string, object>();

            sqlparams.Add("@projectId", int.Parse(ViewState["proId"].ToString()));
            sqlparams.Add("@brandName", bName);
            sqlparams.Add("@brandImg", "");
            sqlparams.Add("@brandDesc", bDesc);
            //sqlparams.Add("@brandLogo", bLogo);
            sqlparams.Add("@brandVideo", bVideo);
            sqlparams.Add("@brandOrder", int.Parse(brandOrder.Value));
            sqlparams.Add("@brandTypeId", int.Parse(ddltype.SelectedValue));
            sqlparams.Add("@brandTypeName", ddltype.SelectedItem.Text);
            sqlparams.Add("@isShow", isShow);
            sqlparams.Add("@isStar", isStar);
            sqlparams.Add("@isShowWay", 0);
            sqlparams.Add("@fvUrl", url);
            sqlparams.Add("@telephone", tel);
            sqlparams.Add("@address", addr);
            sqlparams.Add("@qrCode", qrcode);
            sqlparams.Add("@localvpath", localpath.Value);
            sqlparams.Add("sphone", phone == "" ? hidPhone.Value : phone);
            sqlparams.Add("@sphoneurl", sphoneurl.Value);
            if (txtlogo.HasFile)
            {
                bLogo = "../images/" + timeSign + txtlogo.FileName;
                sqlparams.Add("@brandLogo", bLogo);
                txtlogo.SaveAs(Server.MapPath(@"~/release/" + ViewState["proId"].ToString() + "/images/" + timeSign + txtlogo.FileName));
            }

            //else if (txtvideo.HasFile)
            //{
            //    txtvideo.SaveAs(Server.MapPath(@"~/brandTemplate/" + txtvideo.FileName));
            //}
            string sql = "";

            if (id == 0)
            {
                sql = "insert into fv_projectBrand (brandName,brandImg,brandDesc,brandLogo,brandVideo,brandOrder,brandTypeId,brandTypeName,projectId,isShow,isStar,isShowWay,fvUrl,createTime,lastChangeTime,telephone,address,localvpath,sphone,sphoneurl) values(@brandName,@brandImg,@brandDesc,@brandLogo,@brandVideo,@brandOrder,@brandTypeId,@brandTypeName,@projectId,@isShow,@isStar,@isShowWay,@fvUrl,now(),now(),@telephone,@address,@localvpath,@sphone,@sphoneurl)";
            }
            else
            if (bLogo != "")
            {
                sql = "update fv_projectBrand set brandName=@brandName,brandImg=@brandImg,brandDesc=@brandDesc,brandLogo=@brandLogo,brandVideo=@brandVideo,brandOrder=@brandOrder,brandTypeId=@brandTypeId,brandTypeName=@brandTypeName,isShow=@isShow,isStar=@isStar,fvUrl=@fvUrl,lastChangeTime=NOW(),telephone=@telephone,address=@address,qrcode=@qrcode,localvpath=@localvpath,sphone=@sphone,sphoneurl=@sphoneurl where id=" + id;
            }
            else
            {
                sql = "update fv_projectBrand set brandName=@brandName,brandImg=@brandImg,brandDesc=@brandDesc,brandVideo=@brandVideo,brandOrder=@brandOrder,brandTypeId=@brandTypeId,brandTypeName=@brandTypeName,isShow=@isShow,isStar=@isStar,fvUrl=@fvUrl,lastChangeTime=NOW(),telephone=@telephone,address=@address,qrcode=@qrcode,localvpath=@localvpath,sphone=@sphone,sphoneurl=@sphoneurl where id=" + id;
            }
            bool w = SqlManage.OpRecord(sql, sqlparams);

            if (w)
            {
                //                projectId = Request.QueryString["projectId"];
                // projectName = Request.QueryString["projectName"];
                // projectBtId = Request.QueryString["projectBtId"];
                //   projectBtName = Request.QueryString["projectBtName"];
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "success",
                                                    "alert('您操作成功!稍后自动跳转到列表页'); window.location='project_query.aspx?projectId=" +
                                                    ViewState["proId"].ToString() + "&projectName=" + lblpro.Text + "&projectBtId=" + ddltype.SelectedValue + "&projectBtName=" + ddltype.SelectedItem.Text + "'", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "error",
                                                    "alert('数据库连接异常!');", true);
            }
        }