protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sqlString = " PciID > 0";

            if (txtProjectShow.Text != "")
            {
                sqlString += " and  PciName_c like '%" + txtProjectShow.Text + "%' ";
            }
            if (txtKeyMiaoshu.Text != "")
            {
                sqlString += " and  PciDescription_c like '%" + txtKeyMiaoshu.Text + "%' ";
            }
            if (txtProductKey.Text != "")
            {
                if (!ValueJudge.IsInt(txtProductKey.Text))
                {
                    MessaegBox("请填写数字!");
                    return;
                }
                sqlString += " and  PciID = " + txtProductKey.Text + " ";
            }
            if (ddlState.SelectedItem.Value != "-1")
            {
                sqlString += " and PciState =" + ddlState.SelectedValue;
            }
            sqlString    += "order by PciState,ImgUploadtime Desc";
            lblWhere.Text = sqlString;
            wucPager.Bind();
        }
Esempio n. 2
0
        protected void btnSaveProduct_Click(object sender, EventArgs e)
        {
            bool   IsModitify;
            string priceLast;

            if (lblProductId.Text == "自动编号")
            {
                IsModitify = false;
            }
            else
            {
                IsModitify = true;
            }
            if (txtNameChinese.Text == "")
            {
                MessaegBoxConfrim("请填写产品名称");
                return;
            }
            if (txtNameEnglish.Text == "")
            {
                MessaegBoxConfrim("请填写产品英文名称");
                return;
            }
            if (ddlProductType.SelectedValue == "-1")
            {
                MessaegBoxConfrim("请选择产品所属类别");
                return;
            }
            if (txtPriceNow.Text == "")
            {
                MessaegBoxConfrim("请输入产品当前价格");
                return;
            }
            else
            {
                if (!ValueJudge.IsNumberic(txtPriceNow.Text))
                {
                    MessaegBox("请填写数字!");
                    return;
                }
            }
            if (txtPriceLst.Text != "")
            {
                if (!ValueJudge.IsNumberic(txtPriceLst.Text))
                {
                    MessaegBox("请填写数字!");
                    return;
                }
                priceLast = txtPriceLst.Text;
            }
            else
            {
                priceLast = (Math.Floor(Convert.ToDouble(txtPriceNow.Text) * 1.2)).ToString();
            }
            if (txtProductKeyWordsEnd.Text == "")
            {
                MessaegBoxConfrim("请填写英文关键词");
                return;
            }
            if (txtProductIntroDuct.Text == "")
            {
                MessaegBoxConfrim("请填写产品中文简介");
                return;
            }
            if (txtProductIntroDuctEng.Text == "")
            {
                MessaegBoxConfrim("请填写产品英文简介");
                return;
            }
            /*英文 ’ 字符串处理*/

            /*
             * 1.英文名称
             * **/
            string EnglishName             = txtNameEnglish.Text.Replace("\'", "\'\'");
            string UrlOfTaoBao             = txttaobaoUrl.Text.Replace("\'", "\'\'");
            string KendLish                = txtProductKeyWordsEnd.Text.Replace("\'", "\'\'");
            string ProductEngIntroDuctiuon = txtProductIntroDuctEng.Text.Replace("\'", "\'\'");
            string IsVisibly;
            string IsBaoyou;
            string IsRemai;
            string IsNew;
            string ss = "\'\'";

            IsVisibly = chkIsDown.Checked ? "1" : "0";
            IsBaoyou  = chkBaoyou.Checked ? "1" : "0";
            IsRemai   = chbremai.Checked ? "1" : "0";
            IsNew     = chbIsNew.Checked ? "1" : "0";
            if (!IsModitify)
            {
                if (!wuc_FileUpload.IsHaveFile())
                {
                    MessaegBoxConfrim("请选择图片文件!");
                    return;
                }
                wuc_FileUpload.MapPaths = "~/ProductImage/";
                wuc_FileUpload.UpFile();
                string ImgPath = wuc_FileUpload.ServerDianPath;
                string sql     = "  INSERT INTO [XcXm].[dbo].[tblProductInfo] ( [ProductName_c] ,[ProductName_e],[ProductType],[ProductDescription_c],[ProductDescription_e]  ,[IsVisiable],[IsNew],[ImgPatjh],[ProductKey],[taobaoUrl],[price_last],[Price_now],[IsBY],[IsRm],[ProductState],ProductKeyEng,ProductImgPC)" +
                                 " VALUES('" + txtNameChinese.Text + "','" + EnglishName + "'," + ddlProductType.SelectedValue + " ,'" + txtProductIntroDuct.Text + "','" + ProductEngIntroDuctiuon +
                                 "'," + IsVisibly + "," + IsNew + ",'" + ImgPath + "'," + "'" + txtKetWords.Text + "', '" + UrlOfTaoBao + "' ," + priceLast + "," +
                                 txtPriceNow.Text + "," + IsBaoyou + "," + IsRemai + ",30" + ",'" + KendLish + " ' , ' " + wuc_FileUpload_pc.ServerDianPath + "')";
                //Label1.Text = sql;
                DB.CarryOutSqlSentence(sql);
                MessaegBoxConfrim("添加完成");
            }
            else
            {
                if (wuc_FileUpload.IsHaveFile())
                {
                    wuc_FileUpload.MapPaths = "~/ProductImage/";
                    wuc_FileUpload.UpFile();
                    string imgPath = wuc_FileUpload.ServerDianPath;
                    string sql     = " UPDATE [XcXm].[dbo].[tblProductInfo] SET  " + "ProductName_c ='" +
                                     txtNameChinese.Text + "',ProductName_e ='" + txtNameEnglish.Text.Replace("\'", ss) + "', ProductType=" +
                                     ddlProductType.SelectedValue +
                                     ",ProductDescription_c='" + txtProductIntroDuct.Text + "',ProductDescription_e='" +
                                     txtProductIntroDuctEng.Text.Replace("\'", ss) + "',IsVisiable=" + IsVisibly + ",IsNew=" + IsNew +
                                     ",taobaoUrl='" + txttaobaoUrl.Text.Replace("\'", ss) + "'"
                                     + ",price_last=" + txtPriceNow.Text + ",Price_now=" + priceLast + ",IsBY =" + IsBaoyou + ",IsRm=" + IsRemai + ",ProductKey='" + txtKetWords.Text + "',ImgPatjh='" + imgPath + "'" +
                                     "ProductKeyEng ='" + txtProductKeyWordsEnd.Text.Replace("\'", ss) + "'" + "WHERE ProductID=" + lblProductId.Text;
                    DB.CarryOutSqlSentence(sql);
                    MessaegBox("修改完毕");
                }
                else
                {
                    string sql = " UPDATE [XcXm].[dbo].[tblProductInfo] SET " + "ProductName_c ='" +
                                 txtNameChinese.Text + "',ProductName_e ='" + txtNameEnglish.Text.Replace("\'", ss) + "', ProductType=" +
                                 ddlProductType.SelectedValue +
                                 ",ProductDescription_c='" + txtProductIntroDuct.Text + "',ProductDescription_e='" +
                                 txtProductIntroDuctEng.Text.Replace("\'", ss) + "',IsVisiable=" + IsVisibly + ",IsNew=" + IsNew +
                                 ",taobaoUrl='" + txttaobaoUrl.Text.Replace("\'", ss) + "'"
                                 + ",price_last=" + txtPriceNow.Text + ",Price_now=" + priceLast + ",IsBY =" + IsBaoyou + ",IsRm=" + IsRemai + ",ProductKey='" + txtKetWords.Text
                                 + "'," + "ProductKeyEng ='" + txtProductKeyWordsEnd.Text.Replace("\'", ss) + "'" + "WHERE ProductID=" + lblProductId.Text;
                    DB.CarryOutSqlSentence(sql);
                    MessaegBox("修改完毕");
                }
            }
            lblProductId.Text = "自动编号";
            ChangeProductNull();
            ChangeProductEnableTrue();
        }