Exemple #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要删除的商品", false);
            }
            else
            {
                List <int> list = new List <int>();
                foreach (string str2 in str.Split(new char[] { ',' }))
                {
                    list.Add(Convert.ToInt32(str2));
                }
                SendMessageHelper.SendMessageToDistributors(str, 3);
                if (ProductHelper.RemoveProduct(str) > 0)
                {
                    this.ShowMsg("成功删除了选择的商品", true);
                    this.BindProducts();
                }
                else
                {
                    this.ShowMsg("删除商品失败,未知错误", false);
                }
                if (this.hdPenetrationStatus.Value.Equals("1"))
                {
                    ProductHelper.CanclePenetrationProducts(str);
                }
            }
        }
Exemple #2
0
        private void btnUpdateLine_Click(object sender, System.EventArgs e)
        {
            int    num  = 0;
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要转移的商品", false);
                return;
            }
            SendMessageHelper.SendMessageToDistributors(text + "|" + this.dropProductLines.SelectedItem.Text, 6);
            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string s = array2[i];
                if (ProductLineHelper.UpdateProductLine(System.Convert.ToInt32(this.hdProductLine.Value), int.Parse(s)))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                this.BindProducts();
                this.ShowMsg(string.Format("成功转移了{0}件商品", num), true);
                return;
            }
            this.ShowMsg("转移商品失败", false);
        }
        /// <summary>
        /// Post Message from User Input
        /// </summary>
        private void btnPost_Click(object sender, EventArgs e)
        {
            //Create Message from Client Input
            var message = new messagerequest
            {
                From = new address {
                    Type = addresstype.Direct, Value = messageControl.From
                },
                To          = parseAddress(messageControl.To),
                CC          = parseAddress(messageControl.CC),
                Subject     = messageControl.Subject,
                Body        = messageControl.Body,
                Attachments = attachmentControl.Attachments
            };

            Cursor = Cursors.WaitCursor;
            try
            {
                // Post service call
                var guid = SendMessageHelper.Post(message, getCertificate());

                //Update UI with returned guid
                tbResults.Text           = string.Format("Successful Message Post.\r\nMessage Id = {0}", guid);
                messageControl.MessageId = guid.ToString();
            }
            catch (Exception exception)
            {
                tbResults.Text = string.Empty;
                SecureMessagingHelper.ShowErrorForm(exception);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Exemple #4
0
        protected void btnSaveCategory_Click(object sender, System.EventArgs e)
        {
            if (!this.dropProductLineFrom.SelectedValue.HasValue || !this.dropProductLineFromTo.SelectedValue.HasValue)
            {
                this.ShowMsg("请选择需要替换的产品线或需要替换至的产品线", false);
                return;
            }
            if (this.dropProductLineFrom.SelectedValue.Value == this.dropProductLineFromTo.SelectedValue.Value)
            {
                this.ShowMsg("请选择不同的产品进行替换", false);
                return;
            }
            string text  = this.dropProductLineFrom.SelectedItem.Text;
            string text2 = this.dropProductLineFromTo.SelectedItem.Text;
            string text3 = this.dropProductLineFrom.SelectedValue.ToString();

            SendMessageHelper.SendMessageToDistributors(string.Concat(new string[]
            {
                text3,
                "|",
                text,
                "|",
                text2
            }), 4);
            if (!ProductLineHelper.ReplaceProductLine(System.Convert.ToInt32(text3), System.Convert.ToInt32(this.dropProductLineFromTo.SelectedValue)))
            {
                this.ShowMsg("产品线批量转移商品失败", false);
                return;
            }
            this.ShowMsg("产品线批量转移商品成功", true);
        }
Exemple #5
0
        private void btnUpdateLine_Click(object sender, EventArgs e)
        {
            int    num = 0;
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要转移的商品", false);
            }
            else
            {
                SendMessageHelper.SendMessageToDistributors(str + "|" + this.dropProductLines.SelectedItem.Text, 6);
                foreach (string str2 in str.Split(new char[] { ',' }))
                {
                    if (ProductLineHelper.UpdateProductLine(Convert.ToInt32(this.hdProductLine.Value), int.Parse(str2)))
                    {
                        num++;
                    }
                }
                if (num > 0)
                {
                    this.BindProducts();
                    this.ShowMsg(string.Format("成功转移了{0}件商品", num), true);
                }
                else
                {
                    this.ShowMsg("转移商品失败", false);
                }
            }
        }
Exemple #6
0
        public override void SendAsync(byte[] data, int offset, int length)
        {
            if (this._disposable == 1)
            {
                return;
            }

            byte[] bytes = CompressHelper.Compress(data, offset, length);
            if ((SessionWorkType)_session.AppTokens[0] == SessionWorkType.ManagerSession)
            {
                byte[] body = new byte[sizeof(Int64) + sizeof(Int32) + bytes.Length];
                BitConverter.GetBytes(this.RemoteId).CopyTo(body, 0);
                BitConverter.GetBytes(bytes.Length).CopyTo(body, 8);
                bytes.CopyTo(body, 12);

                SendMessageHelper.SendMessage(_session, MsgCommand.Msg_MessageData, body);
            }
            else
            {
                byte[] body = new byte[bytes.Length + sizeof(Int32)];
                BitConverter.GetBytes(bytes.Length).CopyTo(body, 0);
                bytes.CopyTo(body, 4);

                _session.SendAsync(body, 0, body.Length);
            }
        }
Exemple #7
0
        private void ConnectionProcess(TcpSocketSaeaSession session)
        {
            if (Interlocked.Exchange(ref _manager_login, 1) == 0)
            {
                this.SendAck(session, SessionWorkType.ManagerSession);

                _manager_session  = session;
                session.AppTokens = new object[]
                {
                    SessionWorkType.ManagerSession,
                    null
                };

                //获取所有主连接
                SendMessageHelper.SendMessage(session, MsgCommand.Msg_Pull_Session);
            }
            else
            {
                this.SendAck(session, SessionWorkType.ManagerWorkSession);
                var sessionBased = new TcpProxySessionBased(session);
                session.AppTokens = new object[]
                {
                    SessionWorkType.ManagerWorkSession,
                    sessionBased
                };

                this._onSessionNotifyProc(SessionCompletedNotify.OnConnected, sessionBased as SessionHandler);
            }
        }
Exemple #8
0
        private void btnInStock_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要入库的商品", false);
                return;
            }
            if (this.hdPenetrationStatus.Value.Equals("1"))
            {
                SendMessageHelper.SendMessageToDistributors(text, 2);
                if (ProductHelper.CanclePenetrationProducts(text) == 0)
                {
                    this.ShowMsg("取消铺货失败!", false);
                    return;
                }
            }
            int num = ProductHelper.InStock(text);

            if (num > 0)
            {
                this.ShowMsg("成功入库选择的商品,您可以在仓库区的商品里面找到入库以后的商品", true);
                this.BindProducts();
                return;
            }
            this.ShowMsg("入库商品失败,未知错误", false);
        }
 protected void btnSaveCategory_Click(object sender, EventArgs e)
 {
     if (!this.dropProductLineFrom.SelectedValue.HasValue || !this.dropProductLineFromTo.SelectedValue.HasValue)
     {
         this.ShowMsg("请选择需要替换的产品线或需要替换至的产品线", false);
     }
     else if (this.dropProductLineFrom.SelectedValue.Value == this.dropProductLineFromTo.SelectedValue.Value)
     {
         this.ShowMsg("请选择不同的产品进行替换", false);
     }
     else
     {
         string text = this.dropProductLineFrom.SelectedItem.Text;
         string str2 = this.dropProductLineFromTo.SelectedItem.Text;
         string str3 = this.dropProductLineFrom.SelectedValue.ToString();
         SendMessageHelper.SendMessageToDistributors(str3 + "|" + text + "|" + str2, 4);
         if (!ProductLineHelper.ReplaceProductLine(Convert.ToInt32(str3), Convert.ToInt32(this.dropProductLineFromTo.SelectedValue)))
         {
             this.ShowMsg("产品线批量转移商品失败", false);
         }
         else
         {
             this.ShowMsg("产品线批量转移商品成功", true);
         }
     }
 }
Exemple #10
0
        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要删除的商品", false);
                return;
            }
            System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>();
            string[] array = text.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string value = array[i];
                list.Add(System.Convert.ToInt32(value));
            }
            SendMessageHelper.SendMessageToDistributors(text, 3);
            if (ProductHelper.CanclePenetrationProducts(text) >= 1)
            {
                int num = ProductHelper.RemoveProduct(text);
                if (num > 0)
                {
                    this.ShowMsg("成功删除了选择的商品", true);
                    this.BindProducts();
                    return;
                }
                this.ShowMsg("删除商品失败,未知错误", false);
            }
        }
Exemple #11
0
        private void btnUnSale_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要下架的商品", false);
            }
            else
            {
                if (this.hdPenetrationStatus.Value.Equals("1"))
                {
                    SendMessageHelper.SendMessageToDistributors(str, 1);
                    if (ProductHelper.CanclePenetrationProducts(str) == 0)
                    {
                        this.ShowMsg("取消铺货失败!", false);
                        return;
                    }
                }
                if (ProductHelper.OffShelf(str) > 0)
                {
                    this.ShowMsg("成功下架了选择的商品,您可以在下架区的商品里面找到下架以后的商品", true);
                    this.BindProducts();
                }
                else
                {
                    this.ShowMsg("下架商品失败,未知错误", false);
                }
            }
        }
Exemple #12
0
    private static void TagResponseUnwrapper(TagActorResponse tar)
    {
        GameObject actorConcerned = Actors.allActors[tar.actorId];
        //Make the send message threadsafe
        SendMessageContext context = new SendMessageContext(actorConcerned, "TagUntag", tar, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #13
0
    private static void SuppressResponseUnwrapper(SuppressActorResponse sar)
    {
        //Suppress response reached-> inform accordingly
        GameObject actorConcerned = Actors.allActors[sar.actorId];
        //Make the send message threadsafe
        SendMessageContext context = new SendMessageContext(actorConcerned, "SuppressOnOff", sar, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #14
0
    public static void StateUnwrapper(State st) //Also accessed from TraceImplement
    {
        //Send the state to Actor
        GameObject actorConcerned = Actors.allActors[st.actorId];
        //Make the send message threadsafe
        SendMessageContext context = new SendMessageContext(actorConcerned, "NewStateReceived", st, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #15
0
    public static void Handle(Log currEvent)
    {
        //Maybe also play an error sound?
        //Send message to the main screen to change the text

        SendMessageContext context = new SendMessageContext(logHead, "NewLog", currEvent, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #16
0
    private static void TagReachedResponseUnwrapper(TagReachedResponse trr)
    {
        AutoNext.ResetEverything(); //Disable Auto-next

        GameObject actorConcerned = Actors.allActors[trr.actorId];
        //Make the send message threadsafe
        SendMessageContext context = new SendMessageContext(actorConcerned, "TagReached", trr, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #17
0
    void GetMessage()
    {
        while (true)
        {
            var    count    = client.Receive(messTmp);
            string mess_str = Encoding.UTF8.GetString(messTmp, 0, count);
            if (count != 0)
            {
                if (mess_str.Contains("start send data"))
                {
                    receive_data = true;
                    continue;
                }

                if (receive_data == true)
                {
                    string[] data_pieces = mess_str.Split(';');
                    string   data_str    = "{\"data_list\":[";
                    for (int i = 0; i < data_pieces.Length - 1; i++)
                    {
                        if (i != data_pieces.Length - 2)
                        {
                            data_str += data_pieces[i] + ",";
                        }
                        else
                        {
                            data_str += data_pieces[i] + "]}";
                        }
                    }
                    Debug.Log("data_pieces[0]= " + data_pieces[0]);
                    Data frame = ReadToObject <Data>(data_str);
                    message = frame.ToString();
                    Debug.Log(message);
                    SendMessageContext context = new SendMessageContext(view.gameObject, "UpdateData", frame, SendMessageOptions.RequireReceiver);
                    SendMessageHelper.RegisterSendMessage(context);
                }
                else
                {
                    Config frame = ReadToObject <Config>(mess_str);
                    message = frame.ToString();
                    Debug.Log(message);
                    SendMessageContext context = new SendMessageContext(view.gameObject, "ConfigureCharts", frame, SendMessageOptions.RequireReceiver);
                    SendMessageHelper.RegisterSendMessage(context);
                }
            }
            Array.Clear(messTmp, 0, count);
        }
    }
Exemple #18
0
        public override void SessionClose()
        {
            if (this._disposable == 1)
            {
                return;
            }

            if ((SessionWorkType)_session.AppTokens[0] == SessionWorkType.ManagerSession)
            {
                SendMessageHelper.SendMessage(_session, MsgCommand.Msg_Close_Session, BitConverter.GetBytes(this.RemoteId));
            }
            else
            {
                _session.Close(true);
            }
        }
Exemple #19
0
        private void btnCancle_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要下架的商品", false);
                return;
            }
            SendMessageHelper.SendMessageToDistributors(text, 5);
            int num = ProductHelper.CanclePenetrationProducts(text);

            if (num > 0)
            {
                this.ShowMsg("取消铺货成功", true);
                this.BindProducts();
                return;
            }
            this.ShowMsg("取消铺货失败,未知错误", false);
        }
Exemple #20
0
        private void grdProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>();
            string text = this.grdProducts.DataKeys[e.RowIndex].Value.ToString();

            if (text != "")
            {
                list.Add(System.Convert.ToInt32(text));
            }
            SendMessageHelper.SendMessageToDistributors(text, 3);
            if (this.hdPenetrationStatus.Value.Equals("1"))
            {
                ProductHelper.CanclePenetrationProducts(text);
            }
            if (ProductHelper.RemoveProduct(text) > 0)
            {
                this.ShowMsg("删除商品成功", true);
                this.BindProducts();
            }
        }
Exemple #21
0
        private void grdProducts_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            List <int> list = new List <int>();
            string     str  = this.grdProducts.DataKeys[e.RowIndex].Value.ToString();

            if (str != "")
            {
                list.Add(Convert.ToInt32(str));
            }
            SendMessageHelper.SendMessageToDistributors(str, 3);
            if (this.hdPenetrationStatus.Value.Equals("1"))
            {
                ProductHelper.CanclePenetrationProducts(str);
            }
            if (ProductHelper.RemoveProduct(str) > 0)
            {
                this.ShowMsg("删除商品成功", true);
                this.ReloadProductOnSales(false);
            }
        }
Exemple #22
0
    // Use this for initialization
    void Start()
    {
        receive_data  = false;
        messTmp       = new byte[2048];
        view          = this.GetComponent <View>().gameObject;
        messageHelper = this.GetComponent <SendMessageHelper>();
        client        = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

        try
        {
            client.Connect(new IPEndPoint(IPAddress.Parse(host), port));
            clientReceiveThread = new Thread(new ThreadStart(GetMessage));
            clientReceiveThread.IsBackground = true;
            clientReceiveThread.Start();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
            Application.Quit();
        }
    }
Exemple #23
0
    public static void Handle(TopographyResponse tr)
    {
        switch (tr.topographyType)
        {
        case "RING":
            List <Vector3> positions = RingGenerator.Create(tr.orderedActorIds.Count);

            for (int i = 0; i < tr.orderedActorIds.Count; i++)
            {
                //This hack because of some random GetComponentFastPath error
                GameObject         actorConcerned = Actors.allActors[tr.orderedActorIds[i]];
                SendMessageContext context        = new SendMessageContext(actorConcerned, "MoveToAPosition", positions[i], SendMessageOptions.RequireReceiver);
                SendMessageHelper.RegisterSendMessage(context);
            }
            break;

        default:
            Debug.LogError("Unknown Topography type response received. Doing nothing.");
            break;
        }
    }
Exemple #24
0
        private void btnCancle_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要下架的商品", false);
            }
            else
            {
                SendMessageHelper.SendMessageToDistributors(str, 5);
                if (ProductHelper.CanclePenetrationProducts(str) > 0)
                {
                    this.ShowMsg("取消铺货成功", true);
                    this.BindProducts();
                }
                else
                {
                    this.ShowMsg("取消铺货失败,未知错误", false);
                }
            }
        }
Exemple #25
0
    public static void Handle(ActorCreated currEvent)
    {
        GameObject go;

        if (currEvent.resourceId == "" || currEvent.resourceId == null)
        {
            go = Instantiate(VisualizationHandler.modelDictionary["Cube"]); //If type is not set, we want a cube
        }
        else
        {
            go = Instantiate(VisualizationHandler.modelDictionary[currEvent.resourceId]);
        }

        go.transform.name = currEvent.actorId;

        go.transform.parent = TraceImplement.rootOfActors.transform;//Add it to the root G.O.

        //Add this to the dictionary
        Actors.allActors.Add(currEvent.actorId, go);
        if (VisualizationHandler.sysActorNames.Any(go.transform.name.Contains))                            //System actors are different
        {
            go.transform.position = new Vector3(Random.Range(3.5f, 4.5f), 1f, Random.Range(-2.5f, -3.5f)); //A separate area->Marked in the inspector
        }
        else
        {
            go.transform.position = new Vector3(Random.Range(0f, 3.5f), Random.Range(1.25f, 1.9f), Random.Range(-1.5f, 1.5f));
            if (logCreateForEvent)
            {
                //Create a Log of it
                Log newLog = new Log(0, "Actor created : " + currEvent.actorId);
                VisualizationHandler.Handle(newLog);
            }
        }
        SuppressActorResponse sar     = new SuppressActorResponse(go.transform.name, true);
        SendMessageContext    context = new SendMessageContext(go, "SuppressOnOff", sar, SendMessageOptions.RequireReceiver);

        SendMessageHelper.RegisterSendMessage(context);
    }
Exemple #26
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要下架的商品", false);
                return;
            }
            if (this.hdPenetrationStatus.Value.Equals("1"))
            {
                System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>();
                string[] array = text.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < array.Length; i++)
                {
                    string value = array[i];
                    list.Add(System.Convert.ToInt32(value));
                }
                SendMessageHelper.SendMessageToDistributors(text, 1);
                if (ProductHelper.CanclePenetrationProducts(text) == 0)
                {
                    this.ShowMsg("取消铺货失败!", false);
                    return;
                }
            }
            int num = ProductHelper.OffShelf(text);

            if (num > 0)
            {
                this.ShowMsg("成功下架了选择的商品,您可以在下架区的商品里面找到下架以后的商品", true);
                this.BindProducts();
                return;
            }
            this.ShowMsg("下架商品失败,未知错误", false);
        }
Exemple #27
0
        private void CreateSession(byte[] data)
        {
            byte[] body = new byte[data.Length - 1];
            Array.Copy(data, 1, body, 0, body.Length);

            //byte[] sessionIds = new byte[body.Length * 2];
            List <byte> buffer = new List <byte>();

            byte[] sessionId = new byte[sizeof(Int64) * 2];

            List <TcpProxySessionBased> sessionList = new List <TcpProxySessionBased>();

            for (int i = 0; i < body.Length / sizeof(Int64); i++)
            {
                Array.Copy(body, i * sizeof(Int64), sessionId, 0, sizeof(Int64));
                TcpProxySessionBased sessionBased = new TcpProxySessionBased(_manager_session);
                sessionBased.RemoteId = BitConverter.ToInt64(sessionId, 0);

                Console.WriteLine("CreateSession:" + sessionBased.RemoteId + " Id:" + sessionBased.Id);

                sessionList.Add(sessionBased);

                BitConverter.GetBytes(sessionBased.Id).CopyTo(sessionId, sizeof(Int64));
                buffer.AddRange(sessionId);
                //Array.Copy(sessionId, 0, sessionIds, i * (sizeof(Int64) + sizeof(Int64)), sizeof(Int64) + sizeof(Int64));
            }

            SendMessageHelper.SendMessage(_manager_session, MsgCommand.Msg_Set_Session_Id, buffer.ToArray());

            this._sessionList.AddRange(sessionList.ToArray());

            foreach (var session in sessionList)
            {
                this._onSessionNotifyProc?.Invoke(SessionCompletedNotify.OnConnected, session as SessionHandler);
            }

            sessionList.Clear();
        }
Exemple #28
0
        private void Execute(SingleKeysInfo singleKeysInfo)
        {
            if (singleKeysInfo.KEYS == Keys.None || singleKeysInfo.TIME_DELAY == 0)
            {
                return;
            }

            // 최초 1회 실행
            SendMessageHelper.KeyboardPress(Properties.Settings.Default.SELECTED_GAME_TITLE, singleKeysInfo.KEYS);

            // 타이머 설정
            Timer tmr = new Timer();

            tmr.Tick += (sender, e) =>
            {
                var tempTmr            = sender as Timer;
                var tempSingleKeysInfo = tempTmr.Tag as SingleKeysInfo;

                if (timer매크로활성.Enabled)
                {
                    return;
                }

                if (tempSingleKeysInfo.IS_MACROD_FUNC)
                {
                    Start매크로활성();
                }

                SendMessageHelper.KeyboardPress(Properties.Settings.Default.SELECTED_GAME_TITLE, tempSingleKeysInfo.KEYS);
            };

            tmr.Tag      = singleKeysInfo;
            tmr.Interval = singleKeysInfo.TIME_DELAY;
            tmr.Enabled  = true;

            listKeyTimer.Add(tmr);
        }
Exemple #29
0
        private HP_MP_BAR_POSITION_INFO GetCurrentResolution()
        {
            var size = SendMessageHelper.GetWindowRect("MapleStory");

            if (size.HasValue == false)
                return null;

            HP_MP_BAR_POSITION_INFO temp = null;

            if (size.Value.Width == 806 && size.Value.Height == 629)
                temp = RESOLUTION_800_600;
            else if (size.Value.Width == 1030 && size.Value.Height == 797)
                temp = null;
            else if (size.Value.Width == 1286 && size.Value.Height == 749)
                temp = null;
            else if (size.Value.Width == 1372 && size.Value.Height == 797)
                temp = RESOLUTION_1366_768;
            else if (size.Value.Width == 1926 && size.Value.Height == 1089)
                temp = null;
            else
                temp = null;

            return temp;
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            int     num;
            int     num2;
            int     num3;
            decimal num4;
            decimal num5;
            decimal num6;
            decimal?nullable;
            decimal?nullable2;
            decimal?nullable3;

            if (this.categoryId == 0)
            {
                this.categoryId = (int)this.ViewState["ProductCategoryId"];
            }
            if (this.ValidateConverts(this.chkSkuEnabled.Checked, out num, out num4, out num5, out num6, out nullable, out nullable2, out num2, out num3, out nullable3))
            {
                if (!this.chkSkuEnabled.Checked)
                {
                    if (num6 <= 0M)
                    {
                        this.ShowMsg("商品一口价必须大于0", false);
                        return;
                    }
                    if (nullable.HasValue && (nullable.Value >= num6))
                    {
                        this.ShowMsg("商品成本价必须小于商品一口价", false);
                        return;
                    }
                    if (num4 > num5)
                    {
                        this.ShowMsg("分销商采购价必须要小于等于其最低零售价", false);
                        return;
                    }
                }
                string text = this.fckDescription.Text;
                if (this.ckbIsDownPic.Checked)
                {
                    text = base.DownRemotePic(text);
                }
                ProductInfo info3 = new ProductInfo();
                info3.ProductId         = this.productId;
                info3.CategoryId        = this.categoryId;
                info3.TypeId            = this.dropProductTypes.SelectedValue;
                info3.ProductName       = this.txtProductName.Text;
                info3.ProductCode       = this.txtProductCode.Text;
                info3.DisplaySequence   = num;
                info3.LineId            = this.dropProductLines.SelectedValue.Value;
                info3.LowestSalePrice   = num5;
                info3.MarketPrice       = nullable2;
                info3.Unit              = this.txtUnit.Text;
                info3.ImageUrl1         = this.uploader1.UploadedImageUrl;
                info3.ImageUrl2         = this.uploader2.UploadedImageUrl;
                info3.ImageUrl3         = this.uploader3.UploadedImageUrl;
                info3.ImageUrl4         = this.uploader4.UploadedImageUrl;
                info3.ImageUrl5         = this.uploader5.UploadedImageUrl;
                info3.ThumbnailUrl40    = this.uploader1.ThumbnailUrl40;
                info3.ThumbnailUrl60    = this.uploader1.ThumbnailUrl60;
                info3.ThumbnailUrl100   = this.uploader1.ThumbnailUrl100;
                info3.ThumbnailUrl160   = this.uploader1.ThumbnailUrl160;
                info3.ThumbnailUrl180   = this.uploader1.ThumbnailUrl180;
                info3.ThumbnailUrl220   = this.uploader1.ThumbnailUrl220;
                info3.ThumbnailUrl310   = this.uploader1.ThumbnailUrl310;
                info3.ThumbnailUrl410   = this.uploader1.ThumbnailUrl410;
                info3.ShortDescription  = this.txtShortDescription.Text;
                info3.Description       = (!string.IsNullOrEmpty(text) && (text.Length > 0)) ? text : null;
                info3.PenetrationStatus = this.chkPenetration.Checked ? PenetrationStatus.Already : PenetrationStatus.Notyet;
                info3.Title             = this.txtTitle.Text;
                info3.MetaDescription   = this.txtMetaDescription.Text;
                info3.MetaKeywords      = this.txtMetaKeywords.Text;
                info3.AddedDate         = DateTime.Now;
                info3.BrandId           = this.dropBrandCategories.SelectedValue;
                ProductInfo       target = info3;
                ProductSaleStatus onSale = ProductSaleStatus.OnSale;
                if (this.radInStock.Checked)
                {
                    onSale = ProductSaleStatus.OnStock;
                }
                if (this.radUnSales.Checked)
                {
                    onSale = ProductSaleStatus.UnSale;
                }
                if (this.radOnSales.Checked)
                {
                    onSale = ProductSaleStatus.OnSale;
                }
                target.SaleStatus = onSale;
                CategoryInfo category = CatalogHelper.GetCategory(this.categoryId);
                if (category != null)
                {
                    target.MainCategoryPath = category.Path + "|";
                }
                Dictionary <string, SKUItem>   skus  = null;
                Dictionary <int, IList <int> > attrs = null;
                if (this.chkSkuEnabled.Checked)
                {
                    target.HasSKU = true;
                    skus          = base.GetSkus(this.txtSkus.Text);
                }
                else
                {
                    Dictionary <string, SKUItem> dictionary3 = new Dictionary <string, SKUItem>();
                    SKUItem item = new SKUItem();
                    item.SkuId         = "0";
                    item.SKU           = this.txtSku.Text;
                    item.SalePrice     = num6;
                    item.CostPrice     = nullable.HasValue ? nullable.Value : 0M;
                    item.PurchasePrice = num4;
                    item.Stock         = num2;
                    item.AlertStock    = num3;
                    item.Weight        = nullable3.HasValue ? nullable3.Value : 0M;
                    dictionary3.Add("0", item);
                    skus = dictionary3;
                    if (this.txtMemberPrices.Text.Length > 0)
                    {
                        base.GetMemberPrices(skus["0"], this.txtMemberPrices.Text);
                    }
                    if (this.txtDistributorPrices.Text.Length > 0)
                    {
                        base.GetDistributorPrices(skus["0"], this.txtDistributorPrices.Text);
                    }
                }
                if (!string.IsNullOrEmpty(this.txtAttributes.Text) && (this.txtAttributes.Text.Length > 0))
                {
                    attrs = base.GetAttributes(this.txtAttributes.Text);
                }
                ValidationResults validateResults = Hishop.Components.Validation.Validation.Validate <ProductInfo>(target);
                if (!validateResults.IsValid)
                {
                    this.ShowMsg(validateResults);
                }
                else
                {
                    if (this.ViewState["distributorUserIds"] == null)
                    {
                        this.ViewState["distributorUserIds"] = new List <int>();
                    }
                    int type = 0;
                    if (((target.LineId > 0) && (int.Parse(this.hdlineId.Value) > 0)) && (target.LineId != int.Parse(this.hdlineId.Value)))
                    {
                        type = 6;
                    }
                    if (!this.chkPenetration.Checked)
                    {
                        type = 5;
                    }
                    if (type == 5)
                    {
                        SendMessageHelper.SendMessageToDistributors(target.ProductId.ToString(), type);
                        ProductHelper.CanclePenetrationProducts(this.productId.ToString());
                    }
                    else if (type == 6)
                    {
                        this.toline = this.dropProductLines.SelectedItem.Text;
                        SendMessageHelper.SendMessageToDistributors(this.hdlineId.Value + "|" + this.toline, type);
                    }
                    IList <int> tagIds = new List <int>();
                    if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
                    {
                        string   str2     = this.txtProductTag.Text.Trim();
                        string[] strArray = null;
                        if (str2.Contains(","))
                        {
                            strArray = str2.Split(new char[] { ',' });
                        }
                        else
                        {
                            strArray = new string[] { str2 };
                        }
                        foreach (string str3 in strArray)
                        {
                            tagIds.Add(Convert.ToInt32(str3));
                        }
                    }
                    switch (ProductHelper.UpdateProduct(target, skus, attrs, (IList <int>) this.ViewState["distributorUserIds"], tagIds))
                    {
                    case ProductActionStatus.Success:
                        this.litralProductTag.SelectedValue = tagIds;
                        this.ShowMsg("修改商品成功", true);
                        return;

                    case ProductActionStatus.AttributeError:
                        this.ShowMsg("修改商品失败,保存商品属性时出错", false);
                        return;

                    case ProductActionStatus.DuplicateName:
                        this.ShowMsg("修改商品失败,商品名称不能重复", false);
                        return;

                    case ProductActionStatus.DuplicateSKU:
                        this.ShowMsg("修改商品失败,商家编码不能重复", false);
                        return;

                    case ProductActionStatus.SKUError:
                        this.ShowMsg("修改商品失败,商家编码不能重复", false);
                        return;

                    case ProductActionStatus.OffShelfError:
                        this.ShowMsg("修改商品失败, 子站没在零售价范围内的商品无法下架", false);
                        return;

                    case ProductActionStatus.ProductTagEroor:
                        this.ShowMsg("修改商品失败,保存商品标签时出错", false);
                        return;
                    }
                    this.ShowMsg("修改商品失败,未知错误", false);
                }
            }
        }