protected void Button1_Click(object sender, EventArgs e) { msg.Text = ""; if (user.Text.Length < 3) { msg.Text = "请输入用户名,最少为3位,谢谢"; return; } if (pass.Text.Length < 6) { msg.Text = "请输入密码,最少为6位,谢谢"; return; } if (pass.Text != pass2.Text) { msg.Text = "密码必须一样,谢谢"; return; } if (usertypes.SelectedValue == "0") { msg.Text = "请选择用户分类,谢谢"; return; } string sql1 = "select * from [Company] where MemberName ='" + Common.strFilter(user.Text) + "' "; //Response.Write(sql1); //Response.End(); msg.Text = sql1; DataTable dt2 = DBqiye.getDataTable(sql1); if (dt2.Rows.Count > 0) { msg.Text = "该用户已经注册,请更换用户,谢谢"; return; } string sql = "INSERT INTO [dbo].[Company] ( [MemberName] ,[Name],[Address],[Incentive_HasStock] ,[Password],[state],CreateDate,usertypes,EnterpriseType,typeid) VALUES('" + Common.strFilter(user.Text) + "','','',0,'" + MD5.CreateMD5Hash(pass.Text) + "',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + usertypes.SelectedValue + "','" + usertypes.SelectedValue + "',1) "; //Response.Write(sql); //DataTable dt = DBC.getDataTable("select * from zqhl_users where loginuser='******'"); //DataTable dt1 = DBqiye.getDataTable("select * from [dbo].[User] where [Enabled]=1 and LoginName='" + Common.strFilter(user.Text) + "'"); int count = DBqiye.getRowsreturnid(sql + " Select @@Identity"); if (count > 0) { Session["MemberName"] = Common.strFilter(user.Text); Session["usertypes"] = usertypes.SelectedValue; Session["sid"] = count; msg.Text = "注册成功"; //return; } //if(dt.Rows.Count>0) //{ // if (!dt.Rows[0]["pass"].ToString().Equals(MD5.CreateMD5Hash(pass.Text))) // { // msg.Text = "用户名或密码错误"; // return; // } // Session["adminloginuser"] = dt.Rows[0]["loginuser"].ToString(); //} //if (dt1.Rows.Count > 0) //{ // if (!dt1.Rows[0]["Password"].ToString().Equals(MD5.CreateMD5Hash(pass.Text))) // { // msg.Text = "用户名或密码错误"; // return; // } // Session["adminloginuser"] = dt1.Rows[0]["LoginName"].ToString(); // Session["userid"] = dt1.Rows[0]["UserID"].ToString(); // Session["title"] = dt1.Rows[0]["title"].ToString(); //} //Response.Redirect("main.aspx"); if (usertypes.SelectedValue.ToString() == "211") { Response.Redirect("comperson.aspx"); } else { Response.Redirect("comindex.aspx"); } }
//private void company() //{ // string sql = "SELECT [ID] ,[Name] FROM [dbo].[Company] where 1=1 "; // if (Session["title"].ToString() != "3") // { // sql += " and UserID='" + Session["userid"] + "' "; // } // DataTable dt = DBqiye.getDataTable(sql); // ChiYouRenID.DataSource = dt; // ChiYouRenID.DataTextField = "Name"; // ChiYouRenID.DataValueField = "ID"; // ChiYouRenID.DataBind(); // //ddlCompany.Items.Insert(0, new ListItem("==请选择==", "")); // //ddlCompany.SelectedValue = ""; //} protected void Button1_Click(object sender, EventArgs e) { //if (ddlCompany.SelectedValue == "") //{ // Label1.Text = ("请选择企业!"); // return; //} if (pname.Text.Length == 0) { Label1.Text = ("产品名称不允许为空!"); return; } else { DataTable dt = DBqiye.getDataTable("SELECT [MemberName] FROM [dbo].[product] where [pname]='" + pname.Text + "' and price='" + price.Text + "' and kucun='" + kucun.Text + "'"); if (dt != null && dt.Rows.Count > 0) { Label15.Text = ("产品名称,价格和库存都一样不能存储"); tblogin.Focus(); tblogin.ForeColor = Color.Red; return; } } try { Convert.ToSingle(price.Text); } catch { Label1.Text = ("价格,必须为数字!"); return; } try { Convert.ToSingle(marketprice.Text); } catch { Label1.Text = ("市场价格,必须为数字!"); return; } try { Convert.ToInt32(kucun.Text); } catch { Label1.Text = ("库存,必须为数字!"); return; } //try //{ // Convert.ToSingle(ZiJin.Text); //} //catch //{ // Label1.Text = ("设备投资,必须为数字!"); // return; //} //try //{ // Convert.ToSingle(tblirui.Text); //} //catch //{ // Label1.Text = ("新增利润,必须为数字!"); // return; //} //try //{ // Convert.ToSingle(tbjieye.Text); //} //catch //{ // Label1.Text = ("节省成本,必须为数字!"); // return; //} //if (webtype.SelectedValue == "0") //{ // Label1.Text = ("强基分类必须选择"); // return; //} //if (ShuiPing.SelectedValue == "0") //{ // Label1.Text = ("成果水平必须选择"); // return; //} string classid = "0"; string cbtext1 = ""; //for (int i = 0; i < YingYongLingYu.Items.Count; i++) //{ // if (YingYongLingYu.Items[i].Selected == true) // { // //这个打勾的 // cbtext1 += YingYongLingYu.Items[i].Value + ","; // if (classid == "0") // { // classid = YingYongLingYu.Items[i].Value; // } // } // else // { // //这是没打的 // } //} string cbtexthy = ""; for (int i = 0; i < lingyu.Items.Count; i++) { if (lingyu.Items[i].Selected == true) { //这个打勾的 cbtexthy += lingyu.Items[i].Value + ","; //if (classid == "0") //{ // classid = hangye.Items[i].Value; //} } else { //这是没打的 } } string XingZhiBiao = ""; this.content1.Text = Request.Form["content"]; string sql = ""; { // sql = @"INSERT INTO [dbo].[Results] //([RName] ,[JianJie] //,[JieShao] ,[JieDuan] //,[LeiBie] ,[DiZhi] ,[ZiJin] //,[ShuiPing] ,[MiJi] ,[ShuXing] ,[ChuangXinXingShi] //,[YingYongQingKuang] ,[NoYingYYin] ,[KeHuJingLi] //,[JiaoYiState] ,[Update] ,[userid] ,[state],hangye,webtype,indexlocation,biaoqian,zhongyao,wanzheng) // VALUES ('" + Common.strFilter(RName.Text) + "','" + Common.strFilter(JianJie.Text) + "','" + // Common.strFilter(content1.Text) + "','" + Common.strFilter(JieDuan.Text) + "','" + // Common.strFilter(LeiBie.SelectedValue) + "','" + Common.strFilter(DiZhi.SelectedValue) + "','" + Common.strFilter(ZiJin.Text) + "','" + // Common.strFilter(ShuiPing.SelectedValue) + "','" + Common.strFilter(MiJi.SelectedValue) + "','" + Common.strFilter(ShuXing.SelectedValue) + "','" + Common.strFilter(ChuangXinXingShi.SelectedValue) + "','" + // Common.strFilter(YingYongQingKuang.SelectedValue) + "','" + Common.strFilter(NoYingYYin.SelectedValue) + "','" + Session["userid"] + "','" + // Common.strFilter(JiaoYiState.SelectedValue) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Session["userid"] + "',1,'" + Common.strFilter(cbtexthy) + "','" + Common.strFilter(webtype.SelectedValue) + "','" + ((indexlocation.SelectedValue)) + "','" + biaoqian.Text + "',11,11)"; sql = @"INSERT INTO [dbo].[product] ([pname] ,[price] ,[marketprice] ,[orderno] ,[xinghao] ,[pinpai] ,[xilie] ,[pinlei] ,[danwen] ,[shangjie] ,[kucun] ,[xiangqing] ,[guige] ,[updates] ,[state] ,[createtime] ,[userid] ,[companyid] ,[qiangji] ,[Qiangji2] ,[dizhi] ,[lingyu] ,[chanye] ,[indexview]) VALUES ('" + Common.strFilter(pname.Text) + "','" + Common.strFilter(price.Text) + "','" + Common.strFilter(marketprice.Text) + "','" + Common.strFilter(orderno.Text) + "','" + Common.strFilter(xinghao.Text) + "','" + Common.strFilter(pinpai.Text) + "','" + Common.strFilter(xilie.Text) + "','" + Common.strFilter(pinlei.Text) + "','" + Common.strFilter(danwen.Text) + "',null,'" + Common.strFilter(kucun.Text) + "','" + Common.strFilter(content1.Text) + "','" + Common.strFilter(guige.Text) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Session["userid"] + "',null,'" + Common.strFilter(qiangji.SelectedValue) + "','" + Common.strFilter(qiangji2.SelectedValue) + "','" + Common.strFilter(DiZhi.SelectedValue) + "','" + Common.strFilter(lingyu.SelectedValue) + "','" + Common.strFilter(chanye.SelectedValue) + "','" + Common.strFilter((indexview.Checked) ? "1" : "0") + "') "; } int id = DBqiye.getRowsreturnid(sql + "Select @@Identity"); companyid.Text = id.ToString(); sql = ""; if (id > 0) { Label1.Text = "保存成功" + sql; } else { Label1.Text = "保存失败" + sql; } ///cid = Request.QueryString["id"].ToString(); //图片上传 if (!upfile.HasFile) { Label1.Text = "请选择文件后上传"; return; } if (upfile.FileBytes.Length > 1024 * 1024) { Label1.Text = "文件不能大于1M"; return; } string ext = upfile.FileName.Substring(upfile.FileName.Length - 3).ToLower(); if (ext != "png" && ext != "jpg" && ext != "gif") { Label1.Text = "文件格式只能是png或jpg"; return; } string file = DateTime.Now.ToString("yyyMMddHHmmss.ss"); string filename = Server.MapPath("~/upload/") + file + "." + ext; //upfile.SaveAs(filename); string filename1 = Server.MapPath("~/yuan/upload/") + file + "." + ext; upfile.SaveAs(filename1); pic.Text = "/upload/" + file + "." + ext; imgtext.BuildWatermark(filename1, Server.MapPath("/") + "/images/shunyin.png", "www.kjcgjy.com", filename); //imgtext.AddWaterText(filename1, "www.kjcgjy.com", filename, 255, 50); //imgh.ImageUrl = "/upload/" + file + "." + ext; //DBC.getRowsCount("update users set headimg='" + headimg.Text + "' where id=" + Session["userid"].ToString()); //imgh.ImageUrl = imgh.ImageUrl; //Session["headimg"] = imgh.ImageUrl; //Global.ROOM.updateheadIMG(ulong.Parse(Session["userid"].ToString()), imgh.ImageUrl); Label1.Text = "上传成功"; ///cid = Request.QueryString["id"].ToString(); sql = ""; { sql = @"INSERT INTO [dbo].[productPic] ([pID] ,[FileName] ,[datetime] ,[state],[viewindex])VALUES('" + id + "','" + Common.strFilter(pic.Text) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',1,1)"; } int count = DBqiye.getRowsCount(sql); sql = ""; if (count > 0) { Label1.Text = "保存成功" + sql; } else { Label1.Text = "保存失败" + sql; } }
protected void Button21_Click(object sender, EventArgs e) { // Response.Write("正在插入数据"); if (tbname.Text.Length == 0) { Label15.Text = ("企业名称,不允许为空"); return; } else { DataTable dt = DBqiye.getDataTable("SELECT [Name] FROM [dbo].[Company] where [Name]='" + tbname.Text + "'"); if (dt != null && dt.Rows.Count > 0) { Label15.Text = ("企业名称,已经被占用请使用其它名称"); tbname.Focus(); tbname.ForeColor = Color.Red; return; } } if (tblogin.Text.Length == 0) { Label15.Text = ("登陆名,不允许为空"); tblogin.Focus(); return; } else { DataTable dt = DBqiye.getDataTable("SELECT [MemberName] FROM [dbo].[Company] where [MemberName]='" + tblogin.Text + "'"); if (dt != null && dt.Rows.Count > 0) { Label15.Text = ("登陆名,已经被占用请使用其它名称"); tblogin.Focus(); tblogin.ForeColor = Color.Red; return; } } if (tbpass.Text.Length == 0) { Label15.Text = ("密码,不允许为空"); return; } if (ddldiqu.SelectedValue == "0") { Label15.Text = ("必须选择一个地区"); return; } if (ddlqiyexz.SelectedValue == "0") { Label15.Text = ("必须选择一个企业性质"); return; } if (hangye.SelectedValue == "0") { Label15.Text = ("必须选择一个行业"); return; } //if (hangye2.SelectedValue == "0") //{ // Label15.Text = ("必须选择一个二行业"); // return; //} string sql = ""; { if (Session["userid"].ToString() == "13") { sql = @"INSERT INTO[dbo].[Company] ([Name] ,[MemberName] ,[Password] ,[Address] ,[ZipCode] ,[LegalPerson] ,[LegalPersonTel] ,[Contact] ,[ContactTel] ,[BusinessScope] ,[Region] ,[EnterpriseType] ,[KeyAreas] ,[HasQuoted] ,[CreateDate] ,Incentive_HasStock,state) VALUES ('" + Common.strFilter(tbname.Text) + "','" + Common.strFilter(tblogin.Text) + "','" + MD5.CreateMD5Hash(tbpass.Text) + "','" + Common.strFilter(tbadd.Text) + "', '" + Common.strFilter(tbzipcode.Text) + "','" + Common.strFilter(tbfaren.Text) + "','" + Common.strFilter(tbfarentel.Text) + "','" + Common.strFilter(tblianxi.Text) + "','" + Common.strFilter(tblianxitel.Text) + "','" + Common.strFilter(jingyingfw.Text) + "','" + ddldiqu.SelectedValue + "','" + ddlqiyexz.SelectedValue + "','" + hangye.SelectedValue + "'," + ((ishangshi.Checked) ? "1" : "0") + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,1)"; } else { sql = @"INSERT INTO[dbo].[Company] ([Name] ,[MemberName] ,[Password] ,[Address] ,[ZipCode] ,[LegalPerson] ,[LegalPersonTel] ,[Contact] ,[ContactTel] ,[BusinessScope] ,[Region] ,[EnterpriseType] ,[KeyAreas] ,[HasQuoted] ,[CreateDate] ,Incentive_HasStock,state,UserID) VALUES ('" + Common.strFilter(tbname.Text) + "','" + Common.strFilter(tblogin.Text) + "','" + MD5.CreateMD5Hash(tbpass.Text) + "','" + Common.strFilter(tbadd.Text) + "', '" + Common.strFilter(tbzipcode.Text) + "','" + Common.strFilter(tbfaren.Text) + "','" + Common.strFilter(tbfarentel.Text) + "','" + Common.strFilter(tblianxi.Text) + "','" + Common.strFilter(tblianxitel.Text) + "','" + Common.strFilter(jingyingfw.Text) + "','" + ddldiqu.SelectedValue + "','" + ddlqiyexz.SelectedValue + "','" + hangye.SelectedValue + "'," + ((ishangshi.Checked) ? "1" : "0") + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,1," + Session["userid"] + ")"; } } int id = DBqiye.getRowsreturnid(sql + "Select @@Identity"); sql = "UPDATE [dbo].[product] SET [companyid] = " + id + " WHERE id=" + companyid.Text + ""; id = DBqiye.getRowsCount(sql); if (id > 0) { Label15.Text = "保存成功"; } else { Label15.Text = "保存失败" + sql; } }
//private void company() //{ // string sql = "SELECT [ID] ,[Name] FROM [dbo].[Company] where 1=1 "; // if (Session["title"].ToString() != "3") // { // sql += " and UserID='" + Session["userid"] + "' "; // } // DataTable dt = DBqiye.getDataTable(sql); // ChiYouRenID.DataSource = dt; // ChiYouRenID.DataTextField = "Name"; // ChiYouRenID.DataValueField = "ID"; // ChiYouRenID.DataBind(); // //ddlCompany.Items.Insert(0, new ListItem("==请选择==", "")); // //ddlCompany.SelectedValue = ""; //} protected void Button1_Click(object sender, EventArgs e) { //if (ddlCompany.SelectedValue == "") //{ // Label1.Text = ("请选择企业!"); // return; //} if (RName.Text.Length == 0) { Label1.Text = ("成果姓名不允许为空!"); return; } try { Convert.ToSingle(ZiJin.Text); } catch { Label1.Text = ("资金,必须为数字!"); return; } //try //{ // Convert.ToSingle(ZiJin.Text); //} //catch //{ // Label1.Text = ("设备投资,必须为数字!"); // return; //} //try //{ // Convert.ToSingle(tblirui.Text); //} //catch //{ // Label1.Text = ("新增利润,必须为数字!"); // return; //} //try //{ // Convert.ToSingle(tbjieye.Text); //} //catch //{ // Label1.Text = ("节省成本,必须为数字!"); // return; //} if (JieDuan.SelectedValue == "0") { Label1.Text = ("成果阶段必须选择"); return; } if (LeiBie.SelectedValue == "0") { Label1.Text = ("成果类别必须选择"); return; } //if (webtype.SelectedValue == "0") //{ // Label1.Text = ("强基分类必须选择"); // return; //} //if (ShuiPing.SelectedValue == "0") //{ // Label1.Text = ("成果水平必须选择"); // return; //} if (YingYongQingKuang.SelectedValue == "205" && NoYingYYin.SelectedValue == "0") { Label1.Text = ("未应用时,必须选择未应用原因"); return; } string classid = "0"; string cbtext1 = ""; //for (int i = 0; i < YingYongLingYu.Items.Count; i++) //{ // if (YingYongLingYu.Items[i].Selected == true) // { // //这个打勾的 // cbtext1 += YingYongLingYu.Items[i].Value + ","; // if (classid == "0") // { // classid = YingYongLingYu.Items[i].Value; // } // } // else // { // //这是没打的 // } //} string cbtexthy = ""; for (int i = 0; i < hangyec.Items.Count; i++) { if (hangyec.Items[i].Selected == true) { //这个打勾的 cbtexthy += hangyec.Items[i].Value + ","; //if (classid == "0") //{ // classid = hangye.Items[i].Value; //} } else { //这是没打的 } } string XingZhiBiao = ""; switch (LeiBie.SelectedValue) { case "211": XingZhiBiao = "A"; break; case "210": XingZhiBiao = "B"; break; case "214": XingZhiBiao = "D"; break; case "215": XingZhiBiao = "E"; break; case "216": XingZhiBiao = "F"; break; case "217": XingZhiBiao = "G"; break; case "1311": XingZhiBiao = "C"; break; case "1312": XingZhiBiao = "A"; break; case "1313": XingZhiBiao = "E"; break; case "1314": XingZhiBiao = "F"; break; default: XingZhiBiao = "C"; break; } this.content1.Text = Request.Form["content"]; string sql = ""; { sql = @"INSERT INTO [dbo].[Results] ([RName] ,[JianJie] ,[JieShao] ,[JieDuan] ,[LeiBie] ,[DiZhi] ,[ZiJin] ,[ShuiPing] ,[MiJi] ,[ShuXing] ,[ChuangXinXingShi] ,[YingYongQingKuang] ,[NoYingYYin] ,[KeHuJingLi] ,[JiaoYiState] ,[Update] ,[userid] ,[state],hangye,webtype,indexlocation,biaoqian,zhongyao,wanzheng) VALUES ('" + Common.strFilter(RName.Text) + "','" + Common.strFilter(JianJie.Text) + "','" + Common.strFilter(content1.Text) + "','" + Common.strFilter(JieDuan.Text) + "','" + Common.strFilter(LeiBie.SelectedValue) + "','" + Common.strFilter(DiZhi.SelectedValue) + "','" + Common.strFilter(ZiJin.Text) + "','" + //Common.strFilter(((ZhuanLi.Checked) ? "1" : "0")) + "','" + Common.strFilter(((ChaXin.Checked) ? "1" : "0")) + "','" + Common.strFilter(((JianCe.Checked) ? "1" : "0")) + "','" + ((ShiYongBao.Checked) ? "1" : "0") + "','" + Common.strFilter(ShuiPing.SelectedValue) + "','" + Common.strFilter(MiJi.SelectedValue) + "','" + Common.strFilter(ShuXing.SelectedValue) + "','" + Common.strFilter(ChuangXinXingShi.SelectedValue) + "','" + Common.strFilter(YingYongQingKuang.SelectedValue) + "','" + Common.strFilter(NoYingYYin.SelectedValue) + "','" + Session["userid"] + "','" + Common.strFilter(JiaoYiState.SelectedValue) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Session["userid"] + "',1,'" + Common.strFilter(cbtexthy) + "','" + Common.strFilter(webtype.SelectedValue) + "','" + ((indexlocation.SelectedValue)) + "','" + biaoqian.Text + "',11,11)"; } int id = DBqiye.getRowsreturnid(sql + "Select @@Identity"); //int Gid = Convert.ToInt32(DBqiye.ExecuteScalar()); //sql = ""; XingZhiBiao = XingZhiBiao + ""; string sql1 = "update Results set RNo='" + XingZhiBiao + id + "' where ID='" + id + "' "; DBqiye.getRowsCount(sql1); //合作方式 { sql = @"update [dbo].[Results] set [hezuotype1]='" + Common.strFilter(((hezuotype1.Checked) ? "1" : "0")) + "',[hezuotype2]='" + Common.strFilter(((hezuotype2.Checked) ? "1" : "0")) + "',[hezuotype3]='" + Common.strFilter(((hezuotype3.Checked) ? "1" : "0")) + "',[hezuotype4]='" + Common.strFilter(((hezuotype4.Checked) ? "1" : "0")) + "',[hezuocost1]='" + Common.strFilter(hezuocost1.Text) + "',[hezuocost2]='" + Common.strFilter(hezuocost2.Text) + "',[hezuocost3]='" + Common.strFilter((hezuocost3.Text)) + "' where id=" + id; } int count = DBqiye.getRowsCount(sql); //图片上传 if (!upfile.HasFile) { Label1.Text = "请选择文件后上传"; return; } if (upfile.FileBytes.Length > 1024 * 1024) { Label1.Text = "文件不能大于1M"; return; } string ext = upfile.FileName.Substring(upfile.FileName.Length - 3).ToLower(); if (ext != "png" && ext != "jpg" && ext != "gif") { Label1.Text = "文件格式只能是png或jpg"; return; } string file = DateTime.Now.ToString("yyyMMddHHmmss.ss"); string filename = Server.MapPath("~/upload/") + file + "." + ext; //upfile.SaveAs(filename); string filename1 = Server.MapPath("~/yuan/upload/") + file + "." + ext; upfile.SaveAs(filename1); pic.Text = "/upload/" + file + "." + ext; imgtext.BuildWatermark(filename1, Server.MapPath("/") + "/images/shunyin.png", "www.kjcgjy.com", filename); //imgtext.AddWaterText(filename1, "www.kjcgjy.com", filename, 255, 50); //imgh.ImageUrl = "/upload/" + file + "." + ext; //DBC.getRowsCount("update users set headimg='" + headimg.Text + "' where id=" + Session["userid"].ToString()); //imgh.ImageUrl = imgh.ImageUrl; //Session["headimg"] = imgh.ImageUrl; //Global.ROOM.updateheadIMG(ulong.Parse(Session["userid"].ToString()), imgh.ImageUrl); Label1.Text = "上传成功"; ///cid = Request.QueryString["id"].ToString(); sql = ""; { sql = @"INSERT INTO [dbo].[ResultPic] ([CID] ,[FileName] ,[datetime] ,[state],[viewindex])VALUES('" + id + "','" + Common.strFilter(pic.Text) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',1,1)"; } count = DBqiye.getRowsCount(sql); sql = ""; if (count > 0) { Label1.Text = "保存成功" + sql; } else { Label1.Text = "保存失败" + sql; } }