Esempio n. 1
0
 /// <summary>
 /// 显示店铺详细信息
 /// </summary>
 /// <param name="shop"></param>
 public void ShowShopDetail(Alading.Entity.Shop shop)
 {
     tENick.Text              = shop.nick;
     tETitle.Text             = shop.title;
     tESellerName.Text        = shop.seller_name;
     tESellerZip.Text         = shop.seller_zip;
     tETelephone.Text         = shop.seller_tel;
     tEPhone.Text             = shop.seller_mobile;
     cBoxState.Text           = shop.seller_state;
     cBoxCity.Text            = shop.seller_city;
     cBoxDistrict.Text        = shop.seller_district;
     tEAddress.Text           = shop.seller_address;
     labelSellerLevel.Text    = shop.seller_level == null ? string.Empty : shop.seller_level.ToString();
     labelSellerScore.Text    = shop.seller_score == null ? string.Empty : shop.seller_score.ToString();
     labelSellerTotalNum.Text = shop.seller_total_num == null ? string.Empty : shop.seller_total_num.ToString();
     labelSellerGoodNum.Text  = shop.seller_good_num == null ? string.Empty : shop.seller_good_num.ToString();
     if (!string.IsNullOrEmpty(shop.desc))
     {
         editorDesc.BodyHtml = HttpUtility.HtmlDecode(shop.desc);
     }
     if (!string.IsNullOrEmpty(shop.bulletin))
     {
         editorBulletin.BodyHtml = HttpUtility.HtmlDecode(shop.bulletin);
     }
     if (shop.seller_level != null)
     {
         ((ILinearGauge)rating.Gauges[0]).Scales[0].Value = (float)shop.seller_level * 5 - 1;
     }
     else
     {
         ((ILinearGauge)rating.Gauges[0]).Scales[0].Value = 0;
     }
 }
Esempio n. 2
0
        public bool UpdateShop(string name, Alading.HtmlEditor.Editor editor)
        {
            Alading.Entity.Shop focusShop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;
            if (focusShop != null)
            {
                string  session = SystemHelper.GetSessionKey(focusShop.nick);
                string  value   = editor.BodyHtml;
                ShopRsp shopRsp = TopService.ShopUpdate(session, name, value);

                ShopRsp getShopRsp = TopService.ShopGet(focusShop.nick);
                if (getShopRsp != null)
                {
                    if (name == "desc")
                    {
                        focusShop.desc = getShopRsp.Shop.Description;
                    }
                    else
                    {
                        focusShop.bulletin = getShopRsp.Shop.Bulletin;
                    }
                    focusShop.sid      = getShopRsp.Shop.Sid;
                    focusShop.modified = DateTime.Parse(getShopRsp.Shop.Modified);
                    ShopService.UpdateShop(focusShop);
                }
                return(true);
            }
            else
            {
                XtraMessageBox.Show("请先选择数据", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                Alading.Entity.Shop focusShop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;
                if (focusShop == null)
                {
                    XtraMessageBox.Show("请先选中要删除的店铺", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (XtraMessageBox.Show("是否彻底从本地删除", Constants.SYSTEM_PROMPT, MessageBoxButtons.YesNo, MessageBoxIcon.Information)
                    == DialogResult.Yes)
                {
                    ShopService.RemoveShop(c => c.sid == focusShop.sid);
                    LoadShop(shopShowType);
                }
                else//不从本地彻底删除
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 点击GridView焦点行
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridViewShop_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         Alading.Entity.Shop shop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;
         if (!string.IsNullOrEmpty(shop.nick))
         {
             barBtnDownload.Enabled       = true;
             barBtnUpdateDesc.Enabled     = true;
             barBtnUpdateBulletin.Enabled = true;
         }
         else
         {
             barBtnDownload.Enabled       = false;
             barBtnUpdateDesc.Enabled     = false;
             barBtnUpdateBulletin.Enabled = false;
         }
         ClearTextEdit();
         ShowShopDetail(shop);
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 5
0
        public static List <Alading.Entity.Shop> GetShop(string account, string pwd)
        {
            AladingWebService.WebService wsc    = new Alading.WebService.AladingWebService.WebService();
            List <Alading.Entity.Shop>   result = new List <Alading.Entity.Shop>();

            try
            {
                var shopList = wsc.GetShop(account, HashProvider.GetHash(pwd));
                if (shopList != null)
                {
                    foreach (var x in shopList)
                    {
                        Alading.Entity.Shop shop = new Alading.Entity.Shop();

                        shop.sid      = string.Empty;
                        shop.nick     = x.ShopNick;
                        shop.created  = DateTime.Now;
                        shop.modified = DateTime.Now;
                        shop.title    = x.ShopNick;
                        //加上shop.shopType,shop.shopTypeName
                        result.Add(shop);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// 展示店铺详细信息
        /// </summary>
        public void ShowShopDetail(List <Alading.Entity.Shop> shopList)
        {
            gridCtrlShop.DataSource = shopList;
            gridViewShop.BestFitColumns();

            //触发第一行
            if (gridViewShop.FocusedRowHandle == 0)
            {
                Alading.Entity.Shop shop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;
                ShowShopDetail(shop);
            }
        }
Esempio n. 7
0
        private string BuildEmailContent(Alading.Entity.Consumer consumer, Alading.Entity.Shop shop)
        {
            StringBuilder sb = new StringBuilder(EmailContentTemplate);
            string addr = string.Format("{0} {1} {2} {3} {4}",
                consumer.location_country,
                consumer.location_state,
                consumer.location_city,
                consumer.location_district,
                consumer.location_address);

            sb.Replace("@收货人@", consumer.buyer_name);
            sb.Replace("@收货地址@", addr);
            sb.Replace("@邮政编码@", consumer.buyer_zip);
            sb.Replace("@联系电话@", consumer.phone);

            sb.Replace("@客户昵称@", consumer.nick);
            sb.Replace("@客户地址@", addr);
            sb.Replace("@客户邮编@", consumer.buyer_zip);
            sb.Replace("@客户电话@", consumer.phone);
            sb.Replace("@客户手机@", consumer.mobilephone);
            sb.Replace("@客户邮箱@", consumer.email);

            if (shop != null)
            {
                string shopAddr = string.Format("{0} {1} {2} {3} {4}",
                                    shop.seller_country,
                                    shop.seller_state,
                                    shop.seller_city,
                                    shop.seller_district,
                                    shop.seller_address);

                sb.Replace("@店主昵称@", shop.nick);
                sb.Replace("@店主地址@", shopAddr);
                sb.Replace("@店主邮编@", shop.seller_zip);
                sb.Replace("@店主电话@", shop.seller_tel);
                sb.Replace("@店主手机@", shop.seller_mobile);
                sb.Replace("@店铺名称@", shop.title);
            }
            else
            {
                sb.Replace("@店主昵称@", string.Empty);
                sb.Replace("@店主地址@", string.Empty);
                sb.Replace("@店主邮编@", string.Empty);
                sb.Replace("@店主电话@", string.Empty);
                sb.Replace("@店主手机@", string.Empty);
                sb.Replace("@店铺名称@", string.Empty);
            }

            sb.Replace("@系统日期@", DateTime.Today.ToShortDateString());
            sb.Replace("@系统时间@", DateTime.Now.ToLongTimeString());

            return sb.ToString();
        }
Esempio n. 8
0
        /// <summary>
        /// 点击更新店铺
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnDownload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            WaitDialogForm waitFrm = null;

            try
            {
                Alading.Entity.Shop focusShop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;
                if (focusShop == null)//未选中
                {
                    XtraMessageBox.Show("请先选中更新的店铺", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                waitFrm = new WaitDialogForm(Constants.WAIT_LOAD_DATA);
                ShopRsp shopRsp = TopService.ShopGet(focusShop.nick);
                string  session = SystemHelper.GetSessionKey(focusShop.nick);
                UserRsp userRsp = TopService.UserGet(session, focusShop.nick, string.Empty);

                Alading.Entity.Shop shop = new Alading.Entity.Shop();

                if (shopRsp == null || userRsp == null)//从淘宝网未获取到数据
                {
                    waitFrm.Close();
                    XtraMessageBox.Show("未获取到数据", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                ShopCopyData((int)shopShowType, shop, shopRsp.Shop, userRsp.User);

                Alading.Entity.Shop oldShop = ShopService.GetShopByNick(shop.nick);

                if (oldShop == null)//不存在时添加
                {
                    ShopService.AddShop(shop);
                }
                else//存在时更新
                {
                    ShopService.UpdateShop(shop);
                }

                LoadShop(shopShowType);//重新刷新界面
                waitFrm.Close();
                XtraMessageBox.Show("更新成功", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                waitFrm.Close();
                XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// selected shop changed event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbShopList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbShopList.SelectedIndex > 0)
     {
         selectedShopIndex = cbShopList.SelectedIndex;
         if (selectedShopIndex > 0)
         {
             selectedShop = shopList[selectedShopIndex - 1];
         }
         else
         {
             selectedShop = null;
         }
     }
 }
Esempio n. 10
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <string>    nicklist = (List <string>)e.Argument;
            int              n        = nicklist.Count;
            int              temp     = 0;//作用是避免进度值propgress没有改变时得重复报告
            BackgroundWorker worker   = (BackgroundWorker)sender;

            for (int i = 0; i < n; i++)
            {
                if (worker.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }

                try
                {
                    string  session = SystemHelper.GetSessionKey(nicklist[i]);
                    ShopRsp shopRsp = TopService.ShopGet(nicklist[i]);
                    UserRsp userRsp = TopService.UserGet(session, nicklist[i], string.Empty);
                    if (shopRsp != null || userRsp != null)
                    {
                        Alading.Entity.Shop shop = new Alading.Entity.Shop();
                        UIHelper.ShopCopyData(shop, shopRsp.Shop, userRsp.User);
                        ShopService.UpdateShop(shop);
                    }

                    //进度报告
                    int propgress = (int)((float)(i + 1) / n * 100);
                    if (propgress > temp)
                    {
                        MyInfo myInfo = new MyInfo();
                        myInfo.nick      = nicklist[i];
                        myInfo.isSucceed = true;
                        worker.ReportProgress(propgress, myInfo);
                    }
                    temp = propgress;
                }
                catch (System.Exception ex)
                {
                    MyInfo myInfo = new MyInfo();
                    myInfo.nick      = nicklist[i];
                    myInfo.isSucceed = false;
                    myInfo.msg       = ex.Message;
                    worker.ReportProgress(0, myInfo);
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 保存店铺按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveShopBtn_Click(object sender, EventArgs e)
        {
            WaitDialogForm waitFrm = null;

            try
            {
                waitFrm = new WaitDialogForm(Constants.WAIT_LOAD_DATA);

                Alading.Entity.Shop shop = SaveShopDetail();
                if (shop.sid == null)
                {
                    shop.sid = string.Empty;
                }
                if (shop.created == null)
                {
                    shop.created = System.DateTime.Now;
                }
                if (shop.modified == null)
                {
                    shop.modified = System.DateTime.Now;
                }

                ShopService.UpdateShop(shop);
                //判断是否是查询
                if (!isQuery)
                {
                    LoadShop(shopShowType);
                }
                else
                {
                    QueryCheck();
                }
                waitFrm.Close();
                XtraMessageBox.Show("保存成功", Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                waitFrm.Close();
                XtraMessageBox.Show(ex.Message, Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// checkedShopList为空 按钮不可用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void checkedShopList_EditValueChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(checkedShopList.Text))
            {
                /*初始化被选择的店铺列表*/
                shop_List.Clear();
                string[] ShopNickList = checkedShopList.EditValue.ToString().Split(',');
                foreach (string shop_nick in ShopNickList)
                {
                    Alading.Entity.Shop shop = initShopList.Where(q => q.nick == shop_nick.Trim()).FirstOrDefault();
                    shop_List.Add(shop);
                }

                this.btnCancel.Enabled     = true;
                this.btnDownOrders.Enabled = true;
            }
            else
            {
                this.btnCancel.Enabled     = false;
                this.btnDownOrders.Enabled = false;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 传递店铺详细信息
        /// </summary>
        /// <param name="shop"></param>
        public Alading.Entity.Shop SaveShopDetail()
        {
            Alading.Entity.Shop focusShop = gridViewShop.GetFocusedRow() as Alading.Entity.Shop;

            if (focusShop != null)
            {
                focusShop.nick            = tENick.Text;
                focusShop.title           = tETitle.Text;
                focusShop.seller_name     = tESellerName.Text;
                focusShop.seller_zip      = tESellerZip.Text;
                focusShop.seller_tel      = tETelephone.Text;
                focusShop.seller_mobile   = tEPhone.Text;
                focusShop.seller_state    = cBoxState.Text;
                focusShop.seller_city     = cBoxCity.Text;
                focusShop.seller_district = cBoxDistrict.Text;
                focusShop.seller_address  = tEAddress.Text;
            }
            else
            {
                focusShop = new Alading.Entity.Shop();
            }
            return(focusShop);
        }