Beispiel #1
0
        public void btnUpload_OnClick(object sender, EventArgs e)
        {
            UpLoadClass upload = new UpLoadClass();
            this.lblInfo.Visible = false;

            if (!PicOperate.isPermission(StringHelper.GetExtraType(big.Value)))
            {
                this.lblInfo.Text = "大图片格式不对";
                this.lblInfo.Visible = true;
                return;
            }
            //if (!PicOperate.isPermission(StringHelper.GetExtraType(small.Value)))
            //{
            //    this.lblInfo.Text = "小图片格式不对";
            //    this.lblInfo.Visible = true;
            //    return;
            //}

            string big1 = upload.UpLoadImg(big, "/uploadfiles/pictures/");
            System.Threading.Thread.Sleep(1000);
            string small1 = string.Empty;
            if (small.Value != string.Empty)
            {
                small1 = upload.UpLoadImg(small, "/uploadfiles/pictures/");
            }
            this.lblBig.Text = big1;
            this.lblSmall.Text = small1;

            this.lblInfo.Visible = true;
            this.lblInfo.Text = "<img width=100 height=50 src='"+small1+"'></img>&nbsp;&nbsp;<img src='"+big1+"' width=200 height=100></img>";
        }
Beispiel #2
0
        public void btnSubmitPic_OnClick(object sender, EventArgs e)
        {
            UpLoadClass upload = new UpLoadClass();

            string pName = upload.UpLoadImg(pic, "/uploadfiles/pictures/");
            if (pName != string.Empty)
            {
                this.img.Visible = true;
                this.img.ImageUrl = pName;
            }
        }
        public void btnPicSubmit_OnClick(object sender, EventArgs e)
        {
            UpLoadClass upload = new UpLoadClass();
            string picPath = upload.UpLoadImg(fileLogo, "/uploadfiles/pictures/");
            System.Threading.Thread.Sleep(1000);
            string picSmallPath = upload.UpLoadImg(smallLogo, "/uploadfiles/pictures/");

            if (picPath != string.Empty)
            {
                if (this.lblpicSring.Text == string.Empty)
                {
                    lblpicSring.Text = picPath;
                    lblpicsmallString.Text = picSmallPath;
                    lblPic.Text = "<img width=100 height=50 src="+picSmallPath+"></img>&nbsp;&nbsp;<img width=200 heigth=100 src=" + picPath + "></img>";
                }
                else
                {
                    lblpicSring.Text = lblpicSring.Text + ";" + picPath;
                    lblpicsmallString.Text = lblpicsmallString.Text + ";" + picSmallPath;
                    lblPic.Text += "&nbsp;&nbsp;<img width=100 height=50 src=" + picSmallPath + "></img>&nbsp;&nbsp;<img width=200 heigth=100 src=" + picPath + "></img>";
                }
            }
        }
        protected void btnAddPic_Click(object sender, EventArgs e)
        {
            UpLoadClass upload = new UpLoadClass();
            string filepath = upload.UpLoadImg(uploadpic, "/uploadfiles/pictures/");
            upload = null;

            List<PictureStore> list = (List<PictureStore>)ViewState["PicList"];
            PictureStore ps = new PictureStore();
            ps.PictureStoreName = txtPictureStoreName.Text.Trim();
            ps.PictureStoreGroupIDs = ddlPicGroup.SelectedValue;
            ps.PictureStoreDescription = txtPictureStoreDescriptioin.Text.Trim();
            ps.PictureStoreTagIDs = InfoAdmin.GetPictureStoreTagIDs(txtPictureStoreTag.Text.Trim());
            //ps.PictureStoreHits = 0;
            ps.PictureStoreCreateTime = DateTime.Now;

            //处理图片
            PicOperate po = new PicOperate();
            string newfilepath = filepath.Substring(0, filepath.LastIndexOf(".")) + "_new" + Path.GetExtension(filepath);
            po.AddWaterMarkOperate(Server.MapPath(filepath), Server.MapPath(WaterSettings.WaterMarkPath), Server.MapPath(newfilepath), WaterSettings.CopyrightText);
            //ps.PictureStoreRawUrl = newfilepath;
            //ps.PictureStoreLittleUrl = po.CreateMicroPic(newfilepath, "", WaterSettings.PictureScaleSize[0], WaterSettings.PictureScaleSize[1]);
            po = null;

            //更新图片标签
            ps.PictureStoreID = InfoAdmin.AddPictureStore(ps);
            foreach (string tagid in ps.PictureStoreTagIDs.Split(','))
            {
                InfoAdmin.SetPictureStoreTag(ps.PictureStoreID, int.Parse(tagid));
            }

            list.Add(ps);
            ViewState["PicList"] = list;

            this.bindPicList();
            this.clearText();
        }
        protected void btnPicUpload1_OnClick(object sender, EventArgs e)
        {
            this.lblRedInfo.Visible = false;
            this.btnPicUpload.Enabled = false;

            if (uploadpic1.FileName == string.Empty || uploadpicsmall.Value == string.Empty)
            {
                this.lblRedInfo.Text = "上传大小图片地址不能为空!";
                this.lblRedInfo.Visible = true;
                this.btnPicUpload.Enabled = true;
                return;
            }

            PictureStore ps = (PictureStore)ViewState["PictureStoreInfo"];

            UpLoadClass upload = new UpLoadClass();
            string filepath = "";
            string newfilepath = upload.UploadImageFile(uploadpic1, "/uploadfiles/pictures/");
            PicOperate WaterMark = new PicOperate();

            //Water Mark Operation
            filepath = newfilepath.Substring(0, newfilepath.LastIndexOf(".")) + "_new" + System.IO.Path.GetExtension(newfilepath);

            WaterMark.AddWaterMarkOperate(newfilepath, Server.MapPath(WaterSettings.WaterMarkPath), filepath, WaterSettings.CopyrightText);

            filepath = GetPath(filepath);
            System.Threading.Thread.Sleep(1000);
            string filepathSmall = upload.UpLoadImg(uploadpicsmall, "/uploadfiles/pictures/");

            string hairStyleID = "";
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ToString()))
            {
                string commString = "select id from HairStyle where PictureStoreId=" + ps.PictureStoreID.ToString();
                using (SqlCommand comm = new SqlCommand())
                {
                    comm.Connection = conn;
                    comm.CommandText = commString;
                    conn.Open();

                    using (SqlDataReader sdr = comm.ExecuteReader())
                    {
                        if (sdr.Read())
                        {
                            hairStyleID = sdr["id"].ToString();

                        }
                    }
                }
            }

            if (filepath != string.Empty)
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ToString()))
                {
                    string commString = "insert into PictureStoreSet(PictureStoreId,PictureStoreURL,SmallPictureUrl,IsHairStyle,HairStylePos) values(" + hairStyleID + ",'" + filepath + "','" + filepathSmall + "',0,0)";
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.Connection = conn;
                        comm.CommandText = commString;
                        conn.Open();

                        try
                        {
                            comm.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        { }
                    }
                }
                int pssid = 0;
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ToString()))
                {
                    string commString = "select top 1 * from PictureStoreSet where IsHairStyle=0 order by id desc";
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.Connection = conn;
                        comm.CommandText = commString;
                        conn.Open();

                        using (SqlDataReader sdr = comm.ExecuteReader())
                        {
                            if (sdr.Read())
                            {
                                pssid = Convert.ToInt32(sdr["ID"].ToString());
                            }
                        }
                    }
                }

                this.lblImg.Text = "<img src='" + filepathSmall + "' width=100 height=50 /><a href='" + filepath + "' target='_blank'><img src='" + filepath + "' width=200 height=100 /></a>&nbsp;&nbsp;<a href='PictureStoreOperate.aspx?id=" + pssid + "&pid=" + ps.PictureStoreID.ToString() + "'>删除</a>" + "&nbsp;&nbsp;" + this.lblImg.Text;

                this.btnPicUpload.Enabled = true;
            }
        }
Beispiel #6
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            this.Response.Write("<script>enableButton();</script>");

            if (this.txtHairShopTag.Text.Trim() != string.Empty)
            {
                string[] tagCondition = this.txtHairShopTag.Text.Split(",".ToCharArray());
                this.lblRedInfo.Visible = false;

                for (int k = 0; k < tagCondition.Length; k++)
                {
                    if (tagCondition[k] == string.Empty)
                    {
                        this.lblRedInfo.Text = "TAG格式不正确(正确的格式&nbsp;&nbsp; 1,2,3)";
                        this.lblRedInfo.Visible = true;
                        return;
                    }
                }
            }

            HairShop hs = new HairShop();
            hs.HairShopName = txtHairShopName.Text.Trim();
            hs.HairShopShortName = txtHairShopShortName.Text.Trim();
            hs.TypeID = int.Parse(ddlTypeTable.SelectedValue);
            hs.TypeName = ddlTypeTable.SelectedItem.Text;
            hs.HairShopWebSite = txtHairShopWebSite.Text.Trim();
            hs.HairShopEmail = txtHairShopEmail.Text.Trim();
            hs.HairShopDiscount = txtHairShopDiscount.Text.Trim();
            hs.TravelInfo = txtTravelInfo.Text.Trim();

            if (fileLogo.Value != string.Empty)
            {
                //获取上传图片后的路径
                UpLoadClass upload = new UpLoadClass();

                if (!PicOperate.isPermission(StringHelper.GetExtraType(fileLogo.Value)))
                {
                    this.lblInfo.Text = "上传图片格式不对";
                    this.lblInfo.Visible = true;
                    return;
                }
                hs.HairShopLogo = upload.UpLoadImg(fileLogo, "/uploadfiles/logo/");
            }
            else
            {
                hs.HairShopLogo = string.Empty;
            }

            hs.HairShopCreateTime = txtHairShopCreateTime.Text.Trim();
            hs.HairShopCityID = int.Parse(ddlCity.SelectedValue);
            hs.HairShopMapZoneID = int.Parse(ddlMapZone.SelectedValue);
            hs.HairShopHotZoneID = int.Parse(ddlHotZone.SelectedValue);

            hs.HairShopAddress = txtHairShopAddress.Text.Trim();
            hs.HairShopPhoneNum = txtHairShopPhoneNum.Text.Trim();
            hs.HairShopOpenTime = txtHairShopOpenTime.Text.Trim();

            //TAG逻辑,先复制空,然后插入TAG表,然后UPDATE美发厅表
            hs.HairShopTagIDs = "";

            //List<string> IDs = new List<string>();
            //int chkI = chkListWorkRange.Items.Count;
            //for (int i = 0; i < chkI; i++)
            //{
            //    if (chkListWorkRange.Items[i].Selected)
            //    {
            //        IDs.Add(chkListWorkRange.Items[i].Value);
            //    }
            //}
            //IDs.Sort();
            //hs.WorkRangeIDs = string.Join(",", IDs.ToArray());

            //hs.IsBest = chkIsBest.Checked;
            hs.IsJoin = chkIsJoin.Checked;
            hs.IsPostMachine = chkIsPostMachine.Checked;
            hs.IsPostStation = chkIsPostStation.Checked;
            hs.HairShopDescription = txtDescription.Text.Trim();

            //Session["HairShopInfo"] = hs;

            try
            {
                hs.HairCutDiscountMin = Decimal.Parse(txtHairCutPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairCutDiscountMin = 0;
            }

            try
            {
                hs.HairMarcelDiscountMin = Decimal.Parse(txtMarcelPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairMarcelDiscountMin = 0;
            }

            try
            {
                hs.HairDyeDiscountMin = Decimal.Parse(txtHairDyePriceMin.Text.Trim());
            }
            catch
            {
                hs.HairDyeDiscountMin = 0;
            }

            try
            {
                hs.HairShapeDiscountMin = Decimal.Parse(txtShapePriceMin.Text.Trim());
            }
            catch
            {
                hs.HairShapeDiscountMin = 0;
            }

            try
            {
                hs.HairConservationDiscountMin = Decimal.Parse(txtConservationPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairConservationDiscountMin = 0;
            }

            try
            {
                hs.HairCutDiscount = Decimal.Parse(tbHairCutDiscount.Text.Trim());
            }
            catch
            {
                hs.HairCutDiscount = 0;
            }
            try
            {
                hs.HairCutPirce = Decimal.Parse(tbHairCutPrice.Text.Trim());
            }
            catch
            {
                hs.HairCutPirce = 0;
            }
            try
            {
                hs.HairMarcelDiscount = Decimal.Parse(tbMarclDiscount.Text.Trim());
            }
            catch
            {
                hs.HairMarcelDiscount = 0;
            }
            try
            {
                hs.HairMarcelPrice = Decimal.Parse(tbMarcelPrice.Text.Trim());
            }
            catch
            {
                hs.HairMarcelPrice = 0;
            }

            try
            {
                hs.HairDyeDiscount = Decimal.Parse(tbHairDyeDiscount.Text.Trim());
            }
            catch
            {
                hs.HairDyeDiscount = 0;
            }
            try
            {

                hs.HairDyePrice = Decimal.Parse(tbHairDyePrice.Text.Trim());
            }
            catch
            {
                hs.HairDyePrice = 0;
            }

            try
            {
                hs.HairShapePrice = Decimal.Parse(tbShapePrice.Text.Trim());
            }
            catch
            {
                hs.HairShapePrice = 0;
            }
            try
            {
                hs.HairShapeDiscount = Decimal.Parse(tbShapeDiscount.Text.Trim());
            }
            catch
            {
                hs.HairShapeDiscount = 0;
            }
            try
            {
                hs.HairConservationPrice = Decimal.Parse(tbConservationPrice.Text.Trim());
            }
            catch
            {
                hs.HairConservationPrice = 0;
            }
            try
            {
                hs.HairConservationDiscount = Decimal.Parse(tbConservationDiscount.Text.Trim());
            }
            catch
            {
                hs.HairConservationDiscount = 0;
            }

            hs.LocationMapURL = tbLocation.Text.Trim();

            try
            {
                hs.Square = int.Parse(TextBox4.Text.Trim()).ToString();
            }
            catch
            {
                hs.Square = "0";
            }

            hs.IsServeHairCut = chkCut.Checked;
            hs.IsServeMarce = chkMarcel.Checked;
            hs.IsServeDye = chkDye.Checked;

            hs.MemberInfo = txtMemberInfo.Text.Trim();

            string productIDs = "";
            int num = 0;
            foreach (ListItem li in this.chkList.Items)
            {
                if (li.Selected)
                {
                    num++;
                    if (num == 1)
                    {
                        productIDs = li.Value;
                        hs.ProductsName = li.Text;
                    }
                    else
                    {
                        productIDs += ","+li.Value;
                        hs.ProductsName += "," + li.Text;
                    }
                }
            }
            hs.ProductIDs = productIDs;
            //InfoAdmin.AddHairShop(hs);
            int newid = 0;
            InfoAdmin.AddHairShopInfo(hs,out newid);
            Session["HairShop"] = hs;

            string id = newid.ToString();

            string tagIDs = "";
            string[] tagCollection = txtHairShopTag.Text.Split(",".ToCharArray());
            if (tagCollection[0] != string.Empty)
            {
                for (int k = 0; k < tagCollection.Length; k++)
                {
                    string tagID = "";
                    bool isExist = false;
                    HairShopTag hst = new HairShopTag();
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                    {
                        string commString = "select * from HairShopTag where HairShopTagName='" + tagCollection[k] + "'";
                        using (SqlCommand comm = new SqlCommand())
                        {
                            comm.CommandText = commString;
                            comm.Connection = conn;
                            conn.Open();
                            using (SqlDataReader sdr = comm.ExecuteReader())
                            {
                                if (sdr.Read())
                                {
                                    try
                                    {
                                        hst.TagID = int.Parse(sdr["HairShopTagID"].ToString());
                                        hst.TagName = sdr["HairShopTagName"].ToString();
                                        hst.HairShopIDs = sdr["HairShopIDs"].ToString();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (hst.TagID == 0)
                    {
                        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                        {
                            string commString = "insert HairShopTag(HairShopTagName,HairShopIDs) values('" + tagCollection[k] + "','" + id.ToString() + "');select @@identity;";
                            using (SqlCommand comm = new SqlCommand())
                            {
                                comm.CommandText = commString;
                                comm.Connection = conn;
                                conn.Open();

                                tagID = comm.ExecuteScalar().ToString();
                            }
                        }
                    }
                    else
                    {
                        tagID = hst.TagID.ToString();
                        if (hst.HairShopIDs == string.Empty)
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairShopTag set HairShopIDs='" + id.ToString() + "' where HairShopTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        else
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairShopTag set HairShopIDs=HairShopIDs+'," + id.ToString() + "' where HairShopTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (k == 0)
                    {
                        tagIDs = tagID;
                    }
                    else
                    {
                        tagIDs += "," + tagID;
                    }
                }
            }
            hs.HairShopTagIDs = tagIDs;
            hs.HairShopID = int.Parse(id.ToString());
            int nnewid = 0;
            ProviderFactory.GetHairShopDataProviderInstance().HairShopCreateDeleteUpdate(hs, UserAction.Update,out nnewid);

            this.Response.Redirect("HairShopAddNext1.aspx?id="+id.ToString());

            //this.Response.Redirect("HairEngineerAdd.aspx");
        }
Beispiel #7
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            if (this.txtHairShopTag.Text.Trim() != string.Empty)
            {
                string[] tagCondition = this.txtHairShopTag.Text.Split(",".ToCharArray());
                this.lblRedInfo.Visible = false;

                for (int k = 0; k < tagCondition.Length; k++)
                {
                    if (tagCondition[k] == string.Empty)
                    {
                        this.lblRedInfo.Text = "TAG格式不正确(正确的格式&nbsp;&nbsp; 1,2,3)";
                        this.lblRedInfo.Visible = true;
                        return;
                    }
                }
            }

            if (ddlHotZone.SelectedItem.Value == "28")
            {
                this.lblInfo.Visible = true;
                this.lblInfo.Text = "美发商圈未指定!";
                return;
            }

            HairShop hs = (HairShop)ViewState["HairShop"];
            //先处理TAG逻辑,先删除HS所对应的所有TAG
            if (hs.HairShopTagIDs != string.Empty)
            {
                string[] tempTagC = hs.HairShopTagIDs.Split(",".ToCharArray());
                for (int k = 0; k < tempTagC.Length; k++)
                {
                    HairShopTag hst = new HairShopTag();
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                    {
                        string commString = "select * from HairShopTag where HairShopTagID=" + tempTagC[k];
                        using (SqlCommand comm = new SqlCommand())
                        {
                            comm.CommandText = commString;
                            comm.Connection = conn;
                            conn.Open();
                            using (SqlDataReader sdr = comm.ExecuteReader())
                            {
                                if (sdr.Read())
                                {
                                    try
                                    {
                                        hst.TagID = int.Parse(sdr["HairShopTagID"].ToString());
                                        hst.TagName = sdr["HairShopTagName"].ToString();
                                        hst.HairShopIDs = sdr["HairShopIDs"].ToString();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    string[] tempHairShopIDC = hst.HairShopIDs.Split(",".ToCharArray());
                    string hairShopIDs = "";

                    int tempNum = 0;
                    for (int i = 0; i < tempHairShopIDC.Length; i++)
                    {
                        if (tempHairShopIDC[i] != hs.HairShopID.ToString())
                        {
                            tempNum++;
                            if (tempNum == 1)
                            {
                                hairShopIDs = tempHairShopIDC[i];
                            }
                            else
                            {
                                hairShopIDs += "," + tempHairShopIDC[i];
                            }
                        }
                    }
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                    {
                        string commString = "update HairShopTag set HairShopIDs='" + hairShopIDs + "' where HairShopTagID=" + hst.TagID.ToString();
                        using (SqlCommand comm = new SqlCommand())
                        {
                            comm.CommandText = commString;
                            comm.Connection = conn;
                            conn.Open();
                            try
                            {
                                comm.ExecuteNonQuery();
                            }
                            catch
                            { }
                        }
                    }
                }
            }

            //
            hs.HairShopName = txtHairShopName.Text.Trim();
            hs.HairShopShortName = txtHairShopShortName.Text.Trim();
            hs.TypeID = int.Parse(ddlTypeTable.SelectedValue);
            hs.HairShopWebSite = txtHairShopWebSite.Text.Trim();
            hs.HairShopEmail = txtHairShopEmail.Text.Trim();
            hs.HairShopDiscount = txtHairShopDiscount.Text.Trim();
            //获取上传图片后的路径
            if (fileLogo.Value!="")
            {
                UpLoadClass upload = new UpLoadClass();
                hs.HairShopLogo = upload.UpLoadImg(fileLogo, "/uploadfiles/logo/");
                upload = null;
            }
            else
            {
                hs.HairShopLogo = imgLogo.ImageUrl;
            }

            try
            {
                hs.HairCutDiscountMin = Decimal.Parse(txtHairCutPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairCutDiscountMin = 0;
            }

            try
            {
                hs.HairMarcelDiscountMin = Decimal.Parse(txtMarcelPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairMarcelDiscountMin = 0;
            }

            try
            {
                hs.HairDyeDiscountMin = Decimal.Parse(txtHairDyePriceMin.Text.Trim());
            }
            catch
            {
                hs.HairDyeDiscountMin = 0;
            }

            try
            {
                hs.HairShapeDiscountMin = Decimal.Parse(txtShapePriceMin.Text.Trim());
            }
            catch
            {
                hs.HairShapeDiscountMin = 0;
            }

            try
            {
                hs.HairConservationDiscountMin = Decimal.Parse(txtConservationPriceMin.Text.Trim());
            }
            catch
            {
                hs.HairConservationDiscountMin = 0;
            }

            hs.HairShopCreateTime = txtHairShopCreateTime.Text.Trim();
            hs.HairShopCityID = int.Parse(ddlCity.SelectedValue);
            hs.HairShopMapZoneID = int.Parse(ddlMapZone.SelectedValue);
            hs.HairShopHotZoneID = int.Parse(ddlHotZone.SelectedValue);
            hs.HairShopAddress = txtHairShopAddress.Text.Trim();
            hs.HairShopPhoneNum = txtHairShopPhoneNum.Text.Trim();
            hs.HairShopOpenTime = txtHairShopOpenTime.Text.Trim();
            hs.TravelInfo = txtTravelInfo.Text.Trim();

            hs.HairShopTagIDs = "";

            try
            {
                hs.HairCutDiscount = Decimal.Parse(tbHairCutDiscount.Text.Trim());
            }
            catch
            {
                hs.HairCutDiscount = 0;
            }
            try
            {
                hs.HairCutPirce = Decimal.Parse(tbHairCutPrice.Text.Trim());
            }
            catch
            {
                hs.HairCutPirce = 0;
            }
            try
            {
                hs.HairMarcelDiscount = Decimal.Parse(tbMarclDiscount.Text.Trim());
            }
            catch
            {
                hs.HairMarcelDiscount = 0;
            }
            try
            {
                hs.HairMarcelPrice = Decimal.Parse(tbMarcelPrice.Text.Trim());
            }
            catch
            {
                hs.HairMarcelPrice = 0;
            }

            try
            {
                hs.HairDyeDiscount = Decimal.Parse(tbHairDyeDiscount.Text.Trim());
            }
            catch
            {
                hs.HairDyeDiscount = 0;
            }
            try
            {

                hs.HairDyePrice = Decimal.Parse(tbHairDyePrice.Text.Trim());
            }
            catch
            {
                hs.HairDyePrice = 0;
            }

            try
            {
                hs.HairShapePrice = Decimal.Parse(tbShapePrice.Text.Trim());
            }
            catch
            {
                hs.HairShapePrice = 0;
            }
            try
            {
                hs.HairShapeDiscount = Decimal.Parse(tbShapeDiscount.Text.Trim());
            }
            catch
            {
                hs.HairShapeDiscount = 0;
            }
            try
            {
                hs.HairConservationPrice = Decimal.Parse(tbConservationPrice.Text.Trim());
            }
            catch
            {
                hs.HairConservationPrice = 0;
            }
            try
            {
                hs.HairConservationDiscount = Decimal.Parse(tbConservationDiscount.Text.Trim());
            }
            catch
            {
                hs.HairConservationDiscount = 0;
            }

            hs.LocationMapURL = tbLocation.Text.Trim();

            try
            {
                hs.Square = int.Parse(tbSquare.Text.Trim()).ToString();
            }
            catch
            {
                hs.Square = "0";
            }

            hs.IsServeHairCut = chkCut.Checked;
            hs.IsServeMarce = chkMarcel.Checked;
            hs.IsServeDye = chkDye.Checked;

            hs.IsJoin = chkIsJoin.Checked;
            hs.IsPostMachine = chkIsPostMachine.Checked;
            hs.IsPostStation = chkIsPostStation.Checked;
            hs.HairShopDescription = txtDescription.Text.Trim();

            hs.MemberInfo = txtMemberInfo.Text.Trim();

            string productIDs = "";
            int num = 0;
            foreach (ListItem li in this.chkList.Items)
            {
                if (li.Selected)
                {
                    num++;
                    if (num == 1)
                    {
                        productIDs = li.Value;
                    }
                    else
                    {
                        productIDs += "," + li.Value;
                    }
                }
            }
            hs.ProductIDs = productIDs;

            //TAG逻辑
            string tagIDs = "";
            string id = hs.HairShopID.ToString();
            string[] tagCollection = txtHairShopTag.Text.Split(",".ToCharArray());

            if (tagCollection[0] != string.Empty)
            {
                for (int k = 0; k < tagCollection.Length; k++)
                {
                    string tagID = "";
                    bool isExist = false;
                    HairShopTag hst = new HairShopTag();
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                    {
                        string commString = "select * from HairShopTag where HairShopTagName='" + tagCollection[k] + "'";
                        using (SqlCommand comm = new SqlCommand())
                        {
                            comm.CommandText = commString;
                            comm.Connection = conn;
                            conn.Open();
                            using (SqlDataReader sdr = comm.ExecuteReader())
                            {
                                if (sdr.Read())
                                {
                                    try
                                    {
                                        hst.TagID = int.Parse(sdr["HairShopTagID"].ToString());
                                        hst.TagName = sdr["HairShopTagName"].ToString();
                                        hst.HairShopIDs = sdr["HairShopIDs"].ToString();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (hst.TagID == 0)
                    {
                        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                        {
                            string commString = "insert HairShopTag(HairShopTagName,HairShopIDs) values('" + tagCollection[k] + "','" + id.ToString() + "');select @@identity;";
                            using (SqlCommand comm = new SqlCommand())
                            {
                                comm.CommandText = commString;
                                comm.Connection = conn;
                                conn.Open();

                                tagID = comm.ExecuteScalar().ToString();
                            }
                        }
                    }
                    else
                    {
                        tagID = hst.TagID.ToString();
                        if (hst.HairShopIDs == string.Empty)
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairShopTag set HairShopIDs='" + id.ToString() + "' where HairShopTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        else
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairShopTag set HairShopIDs=HairShopIDs+'," + id.ToString() + "' where HairShopTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (k == 0)
                    {
                        tagIDs = tagID;
                    }
                    else
                    {
                        tagIDs += "," + tagID;
                    }
                }
            }
            hs.HairShopTagIDs = tagIDs;
            Session["HairShopInfo"] = hs;
            InfoAdmin.UpdateHairShopInfo(hs);
            this.Response.Redirect("HairShopAdmin.aspx");
        }
        protected void btnHairEngineerAdd_Click(object sender, EventArgs e)
        {
            if (this.txtHairEngineerTag.Text.Trim() != string.Empty)
            {
                string[] tagCondition = this.txtHairEngineerTag.Text.Split(",".ToCharArray());
                this.lblRedInfo.Visible = false;

                for (int k = 0; k < tagCondition.Length; k++)
                {
                    if (tagCondition[k] == string.Empty)
                    {
                        this.lblRedInfo.Text = "TAG格式不正确(正确的格式&nbsp;&nbsp; 1,2,3)";
                        this.lblRedInfo.Visible = true;
                        return;
                    }
                }
            }

            HairEngineer he = new HairEngineer();
            he.HairEngineerName = txtHairEngineerName.Text.Trim();
            //he.HairEngineerAge = txtHairEngineerAge.Text.Trim();
            he.HairEngineerSex = int.Parse(rBtnListHairEngineerSex.SelectedValue);
            he.HairEngineerTel = txtHairEngineerTel.Text.Trim();
            he.HairEngineerRawPrice = txtHairEngineerRawPrice.Text.Trim();
            he.HairEngineerYear = txtHairEngineerYear.Text.Trim();
            he.HairEngineerSkill = txtHairEngineerSkill.Text.Trim();
            he.HairEngineerDescription = txtHairEngineerDescription.Text.Trim();
            he.HairEngineerConstellation = this.ddlConstellation.SelectedItem.Text;
            he.HairEngineerClassID = txtHairEngineerClass.Text.Trim();
            he.HairEngineerClassName = txtHairEngineerClass.Text.Trim();
            he.HairShopID = int.Parse(ddlHairShop.SelectedValue);
            he.HairShopName = ddlHairShop.SelectedItem.Text;
            he.IsImportant = this.chkIsImportant.Checked;

            UpLoadClass upload = new UpLoadClass();
            //he.HairEngineerPhoto = upload.UpLoadImg(fileLogo, "/uploadfiles/pictures/");

            he.HairEngineerTagIDs = "";

            int id = InfoAdmin.AddHairEngineer(he);
            he.HairEngineerID = id;
               string content=buildBBSContent(he);
            int postId = 0;
            BBSPost post = new BBSPost();
            bool bSuc = post.AddPost(he.HairEngineerName, content, BBSPost.Category.HairEngineer, out postId);
            he.PostId = postId;
            if (bSuc)
            {
                //update postid
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                {
                    string commString = "update HairEngineer set postid=" + he.PostId.ToString() + " where HairEngineerID=" + he.HairEngineerID.ToString();
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.CommandText = commString;
                        comm.Connection = conn;
                        conn.Open();
                        try
                        {
                            comm.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        {
                            throw new Exception(ex.Message);
                        }
                    }
                }
            }

            Session["HairEngineerInfo"] = he;
            if (txtHairEngineerTag.Text.Trim() != string.Empty)
            {
                //TAG逻辑
                string tagIDs = "";
                string[] tagCollection = txtHairEngineerTag.Text.Split(",".ToCharArray());
                for (int k = 0; k < tagCollection.Length; k++)
                {
                    string tagID = "";
                    bool isExist = false;
                    HairEngineerTag hst = new HairEngineerTag();
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                    {
                        string commString = "select * from HairEngineerTag where HairEngineerTagName='" + tagCollection[k] + "'";
                        using (SqlCommand comm = new SqlCommand())
                        {
                            comm.CommandText = commString;
                            comm.Connection = conn;
                            conn.Open();
                            using (SqlDataReader sdr = comm.ExecuteReader())
                            {
                                if (sdr.Read())
                                {
                                    try
                                    {
                                        hst.TagID = int.Parse(sdr["HairEngineerTagID"].ToString());
                                        hst.TagName = sdr["HairEngineerTagName"].ToString();
                                        hst.HairEngineerIDs = sdr["HairEngineerIDs"].ToString();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (hst.TagID == 0)
                    {
                        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                        {
                            string commString = "insert HairEngineerTag(HairEngineerTagName,HairEngineerIDs) values('" + tagCollection[k] + "','" + id.ToString() + "');select @@identity;";
                            using (SqlCommand comm = new SqlCommand())
                            {
                                comm.CommandText = commString;
                                comm.Connection = conn;
                                conn.Open();

                                tagID = comm.ExecuteScalar().ToString();
                            }
                        }
                    }
                    else
                    {
                        tagID = hst.TagID.ToString();
                        if (hst.HairEngineerIDs == string.Empty)
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairEngineerTag set HairEngineerIDs='" + id.ToString() + "' where HairEngineerTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        else
                        {
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                            {
                                string commString = "update HairEngineerTag set HairEngineerIDs=HairEngineerIDs+'," + id.ToString() + "' where HairEngineerTagID=" + hst.TagID.ToString();
                                using (SqlCommand comm = new SqlCommand())
                                {
                                    comm.CommandText = commString;
                                    comm.Connection = conn;
                                    conn.Open();
                                    try
                                    {
                                        comm.ExecuteNonQuery();
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                    }
                    if (k == 0)
                    {
                        tagIDs = tagID;
                    }
                    else
                    {
                        tagIDs += "," + tagID;
                    }
                }
                he.HairEngineerTagIDs = tagIDs;
                he.HairEngineerID = id;
                ProviderFactory.GetHairEngineerDataProviderInstance().HairEngineerCreateDeleteUpdate(he, UserAction.Update, out id);
            }
            id = he.HairEngineerID;

            //个人图片逻辑
            string photoIDs = "";
            string[] photoSmallString = lblpicsmallString.Text.Split(";".ToCharArray());
            string[] photoString = lblpicSring.Text.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            for(int k=0;k<photoString.Length;k++)
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
                {
                    string commString = "insert into enginpics(picurl,picsmallurl,ownerid,classid) values('" + photoString[k] + "','"+photoSmallString[k]+"'," + id.ToString() + ",1);select @@identity;";
                    using (SqlCommand comm = new SqlCommand())
                    {
                        comm.CommandText = commString;
                        comm.Connection = conn;
                        conn.Open();
                        try
                        {
                            photoIDs += "," + comm.ExecuteScalar().ToString();
                        }
                        catch (Exception ex)
                        {
                            throw new Exception(ex.Message);
                        }
                    }
                }
            }
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
            {
                string commString = "update HairEngineer set HairEngineerPhotoIDs = '"+photoIDs+"' where HairEngineerID=" + id.ToString();
                using (SqlCommand comm = new SqlCommand())
                {
                    comm.CommandText = commString;
                    comm.Connection = conn;
                    conn.Open();
                    try
                    {
                        comm.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
            {
                string commString = "update HairShop set HairShopEngineerNum = HairShopEngineerNum+1 where HairShopID="+he.HairShopID.ToString();
                using (SqlCommand comm = new SqlCommand())
                {
                    comm.CommandText = commString;
                    comm.Connection = conn;
                    conn.Open();
                    try
                    {
                        comm.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
            ResetControlState();

            this.Response.Redirect("HairEngineerAddSwitch.aspx?id="+id.ToString()+"&shopid="+this.ddlHairShop.SelectedItem.Value);
        }
        protected void btnPicUpload1_OnClick(object sender, EventArgs e)
        {
            this.lblRedInfo.Visible = false;
            this.btnPicUpload.Enabled = false;
            if (uploadpic1.FileName == string.Empty || uploadpicsmall.Value == string.Empty)
            {
                this.lblRedInfo.Text = "上传大小图片地址均不能为空!";
                this.lblRedInfo.Visible = true;
                this.btnPicUpload.Enabled = true;
                return;
            }

            UpLoadClass upload = new UpLoadClass();
            string filepath = "";
            string newfilepath = upload.UploadImageFile(uploadpic1, "/uploadfiles/pictures/");
            PicOperate WaterMark = new PicOperate();

            //Water Mark Operation
            filepath = newfilepath.Substring(0, newfilepath.LastIndexOf(".")) + "_new" + System.IO.Path.GetExtension(newfilepath);

            WaterMark.AddWaterMarkOperate(newfilepath, Server.MapPath(WaterSettings.WaterMarkPath), filepath, WaterSettings.CopyrightText);

            filepath = GetPath(filepath);
            System.Threading.Thread.Sleep(1000);
            string filepathSmall = upload.UpLoadImg(uploadpicsmall, "/uploadfiles/pictures/");

            if (filepath != string.Empty)
            {
                int num = Convert.ToInt32(Session["num"].ToString());
                num++;
                Session["num"] = num;
                int picNum = int.Parse(Session["picNum"].ToString());
                picNum++;

                if (picNum == 1)
                {
                    Session["pic" + num.ToString()] = filepath;
                    Session["picSmall" + num.ToString()] = filepathSmall;

                    this.picString.Text = "<img width=100 heigth=50 src='" + filepathSmall + "' />&nbsp;&nbsp;<img width=200 heigth=100 src='" + filepath + "' />&nbsp;&nbsp;<a href='PictureStoreOperate2.aspx?num="+num.ToString()+"'>删除</a>";
                    this.pic.Text = filepath;
                    this.picsmall.Text = filepathSmall;
                }
                else
                {
                    this.picString.Text += "&nbsp;&nbsp;<img width=100 heigth=50 src='" + filepathSmall + "' />&nbsp;&nbsp;<img width=200 heigth=100 src='" + filepath + "' />&nbsp;&nbsp;<a href='PictureStoreOperate2.aspx?num=" + num.ToString() + "'>删除</a>";
                    this.pic.Text += ";" + filepath;
                    this.picsmall.Text += ";" + filepathSmall;
                }
                Session["pic" + num.ToString()] = filepath;
                Session["picSmall" + num.ToString()] = filepathSmall;

                Session["picString"] = this.picString.Text;
                Session["pic"] = this.pic.Text;
                Session["picSmall"] = this.picsmall.Text;

                Session["picNum"] = picNum;

                Session["PSGIDS"] = this.GetPSGIDs();
                Session["PictureStoreName"] = txtPictureStoreName.Text.Trim();
                Session["PictureStoreDescription"] = txtPictureStoreDescription.Text.Trim();
                Session["PictureTags"] = txtPictureStoreTag.Text.Trim();
                Session["iHairNature"] = this.ddlHairNature.SelectedItem.Value;
                Session["iHairQuantity"] = this.ddlHairQuantity.SelectedItem.Value;
                Session["iFaceStyle"] = this.ddlFaceStyle.SelectedItem.Value;
                Session["iSex"] = this.ddlSex.SelectedItem.Value;
                Session["iHairStyleClassName"] = this.ddlHairStyleClassName.SelectedItem.Value;
                Session["iTemperament"] = this.ddlTemperament.SelectedItem.Value;
                Session["iOccasion"] = this.ddlOccasion.SelectedItem.Value;
                Session["bbsUrl"] = txtBbsurl.Text.Trim();

                this.btnPicUpload.Enabled = true;
            }
        }