Ejemplo n.º 1
0
        private void UpdateEmShowOnlineIsFalse(EmCostume item)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                GlobalCache.CostumeList.Find(t => t.ID == item.ID).EmShowOnline = false;
                UpdateResult result = GlobalCache.EMallServerProxy.UpdateEmShowOnlineIsFalse(item.ID);
                switch (result)
                {
                case UpdateResult.Success:
                    GlobalMessageBox.Show("下架成功!");
                    RefreshPage();
                    break;

                case UpdateResult.Error:
                    GlobalMessageBox.Show("内部错误!");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
Ejemplo n.º 2
0
        // public event CJBasic.Action<EmCostume, BaseUserControl> OpenModifyDialog;
        private void OpenModifyDialog(EmCostume e)
        {
            SaveEmCostumeForm form    = new SaveEmCostumeForm(e?.ID, String.IsNullOrEmpty(e.EmTitle), e.Price);
            string            tabName = (String.IsNullOrEmpty(e.EmTitle) ? "商品上架" : "编辑商品");

            form.Text          = tabName;
            form.Costume_Save += Costume_Save;
            form.ShowDialog(this);
            //form.ShowDialog(this);
            //ShowMessage(form.ShowDialog(this).ToString());
            //if (form.ShowDialog(this) == DialogResult.OK)
            //{
            //    form.Display(true);
            //    ShowMessage("加载图片");
            //}
            // 创建句柄时报错
            //  form.Dispose();
        }
Ejemplo n.º 3
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
            {
                return;
            }
            try
            {
                if (e.RowIndex > -1 && e.ColumnIndex > -1)
                {
                    EmCostume item = (EmCostume)this.dataGridView1.Rows[e.RowIndex].DataBoundItem;
                    switch (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)
                    {
                    case "编辑":
                        this.OpenModifyDialog(item);
                        break;

                    case "下架":
                        if (GlobalMessageBox.Show("下架后,店铺内将不再展示该商品,确定下架?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            UpdateEmShowOnlineIsFalse(item);
                        }
                        break;

                    case "上架":
                        //if (GlobalMessageBox.Show("确认上架该商品?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        //{
                        //    UpdateEmShowOnlineIsTrue(item);
                        //}

                        this.OpenModifyDialog(item);

                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
Ejemplo n.º 4
0
        private void Recommend(EmCostume item)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                UpdateEmRecommandPara para = new UpdateEmRecommandPara()
                {
                    EmIsRecommand = item.EmIsRecommand,
                    ID            = item.ID
                };
                UpdateResult result = GlobalCache.EMallServerProxy.UpdateEmRecommand(para);
                switch (result)
                {
                case UpdateResult.Success:
                    break;

                case UpdateResult.Error:
                    GlobalMessageBox.Show("内部错误!");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
Ejemplo n.º 5
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                try
                {
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }

                    EmCostume item = (EmCostume)dataGridView1.CurrentRow.DataBoundItem;
                    // item.EmThumbnailData
                    if (curCostume != item && skinCheckBoxShowImage.Checked)
                    {
                        if (imageCtrl != null)
                        {
                            imageCtrl?.Close();
                            imageCtrl = null;
                        }
                        imageCtrl              = new SingleImageForm();
                        imageCtrl.FormClosing += ImageCtrl_FormClosing;
                        imageCtrl.Text         = "款号:" + item.ID;
                        imageCtrl.OnLoadingState(); skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged;
                        skinCheckBoxShowImage.Checked         = true;
                        skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged;
                        Costume CurItem = CommonGlobalCache.GetCostume(item.ID);
                        // byte[] bytes = GlobalCache.ServerProxy.GetCostumePhoto(item.ID);
                        if (item.EmShowOnline)
                        {
                            if (!String.IsNullOrEmpty(item.EmThumbnail))
                            {
                                String url = item.EmThumbnail;
                                System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                                System.Net.WebResponse webres = webreq.GetResponse();
                                using (System.IO.Stream stream = webres.GetResponseStream())
                                {
                                    imageCtrl.Image = Image.FromStream(stream);
                                }
                            }
                            else
                            {
                                imageCtrl.Image = null;
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(CurItem.EmThumbnail))
                            {
                                String url = CurItem.EmThumbnail;
                                System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                                System.Net.WebResponse webres = webreq.GetResponse();
                                using (System.IO.Stream stream = webres.GetResponseStream())
                                {
                                    imageCtrl.Image = Image.FromStream(stream);
                                }
                            }
                            else
                            {
                                imageCtrl.Image = null;
                            }
                        }
                        imageCtrl?.BringToFront();
                        imageCtrl?.Show();
                        curCostume = item;
                    }
                }
                catch (Exception ex)
                {
                    //  GlobalUtil.ShowError(ex);
                }
                finally
                {
                    GlobalUtil.UnLockPage(this);
                }
            }
        }
Ejemplo n.º 6
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !dataGridView1.Rows[e.RowIndex].IsNewRow)
                {
                    DataGridView     view = (DataGridView)sender;
                    List <EmCostume> list = (List <EmCostume>)view.DataSource;
                    EmCostume        item = (EmCostume)list[e.RowIndex];
                    switch (view.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.HeaderText)
                    {
                    /* case "推荐":
                     *   item.EmIsRecommand = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                     *   Recommend(item);
                     *   break;*/
                    case "新品":
                        item.IsNew = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                        UpIsNew(item.ID, item.IsNew);
                        break;

                    case "热卖":
                        item.IsHot = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                        UpIsHot(item.ID, item.IsHot);
                        break;

                    case "零售":
                        item.EmShowOnline = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                        if (!item.EmShowOnline && item.PfShowOnline == false)
                        {
                            GlobalMessageBox.Show("线上商品必须是批发或者零售,请确定后再进行修改!");
                            this.RefreshPage();
                            break;
                        }
                        UpEmShowOnLine(item.ID, item.EmShowOnline);
                        break;

                    case "批发":
                        item.PfShowOnline = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;
                        if (!item.PfShowOnline && item.EmShowOnline == false)
                        {
                            GlobalMessageBox.Show("线上商品必须是批发或者零售,请确定后再进行修改!");
                            this.RefreshPage();
                            break;
                        }
                        UpPfShowOnLine(item.ID, item.PfShowOnline);
                        break;

                    case "销量":
                        item.QuantityOfSale = (int)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value;

                        UpSaleNum(item.ID, item.QuantityOfSale);
                        break;

                    default: break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }