コード例 #1
0
ファイル: COM_Home.cs プロジェクト: TranBinh96/HanbiSoftWare
        private void GetSummary()
        {
            intNew        = 0;
            intPicking    = 0;
            intDelivering = 0;
            intWaiting    = 0;
            intCompleted  = 0;
            intTotal      = 0;

            JsonRequest request = new JsonRequest();

            ProcAction action = request.NewAction();

            action.proc = WebUtil.Values.PROC_SQL;
            action.text = "CALL get_summary(#{loc_cd}); ";
            action.param.Add("loc_cd", COM.UserInfo.LocCode);

            WebClient client = new WebClient();
            DataSet   ds     = client.Execute(request);

            DataTable dt = ds.Tables[0];

            if (dt.Rows.Count == 0 || dt.Rows.Count > 1)
            {
                return;
            }

            intNew        = int.Parse(dt.Rows[0]["new"].ToString());
            labelNew.Text = intNew.ToString();

            intPicking        = int.Parse(dt.Rows[0]["picking"].ToString());
            labelPicking.Text = intPicking.ToString();

            intDelivering        = int.Parse(dt.Rows[0]["delivering"].ToString());
            labelDelivering.Text = intDelivering.ToString();

            intWaiting        = int.Parse(dt.Rows[0]["waiting"].ToString());
            labelWaiting.Text = intWaiting.ToString();

            intCompleted = int.Parse(dt.Rows[0]["completed"].ToString());
            intTotal     = int.Parse(dt.Rows[0]["total"].ToString());
            string lang = AccessDB.GetConfig("lang");

            if (lang == null || lang == "")
            {
                lang = "ko";
            }

            switch (lang)
            {
            case "ko":
                labelSummary.Text = String.Concat("총 주문 : ", intCompleted, "/", intTotal, " 건");
                break;

            case "en":
                labelSummary.Text = String.Concat("Total orders: ", intCompleted, "/", intTotal, " cases");
                break;

            case "vi":
                labelSummary.Text = String.Concat("Tổng đơn hàng: ", intCompleted, "/", intTotal, " đơn");
                break;
            }
        }
コード例 #2
0
        private static void OpenMenuTap(MenuTabInfo info, bool finishDelivery = false)
        {
            if (info == null)
            {
                return;
            }

            foreach (XtraTabPage page in tabControl.TabPages)
            {
                MenuTabInfo curInfo = page.Tag as MenuTabInfo;
                if (curInfo == null)
                {
                    continue;
                }
                if (curInfo.menuId == info.menuId)
                {
                    tabControl.SelectedTabPage = page;
                    if (curInfo.form != null && (curInfo.form.Name == "COM_Home" || curInfo.form.Name == "SOD_Order" || curInfo.form.Name == "SOD_Pickup" || curInfo.form.Name == "SOD_Delivery" || curInfo.form.Name == "SOD_Return"))
                    {
                        curInfo.form.Focus();
                    }

                    XtraUserControl form = curInfo.form;
                    if (form == null)
                    {
                        return;
                    }

                    MethodInfo mInfo = null;
                    if (!String.IsNullOrEmpty(ord_no))
                    {
                        PropertyInfo ordNo = form.GetType().GetProperty("ordNo");
                        ordNo.SetValue(form, ord_no);

                        if (curInfo.form.Name == "SOD_Delivery" && finishDelivery)
                        {
                            bolConfirmMessage = true;
                            mInfo             = form.GetType().GetMethod("InitFromDoubleClickAndHandle", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                        }
                        else
                        {
                            mInfo = form.GetType().GetMethod("InitFromDoubleClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                        }

                        ord_no = String.Empty;
                    }
                    else if (!(String.IsNullOrEmpty(pick_ord_yn) && String.IsNullOrEmpty(pick_yn) &&
                               String.IsNullOrEmpty(delv_ord_yn) && String.IsNullOrEmpty(delv_yn)))
                    {
                        PropertyInfo pickOrdYn = form.GetType().GetProperty("pickOrdYn");
                        pickOrdYn.SetValue(form, pick_ord_yn);
                        PropertyInfo pickYn = form.GetType().GetProperty("pickYn");
                        pickYn.SetValue(form, pick_yn);
                        PropertyInfo delvOrdYn = form.GetType().GetProperty("delvOrdYn");
                        delvOrdYn.SetValue(form, delv_ord_yn);
                        PropertyInfo delvYn = form.GetType().GetProperty("delvYn");
                        delvYn.SetValue(form, delv_yn);

                        mInfo = form.GetType().GetMethod("InitFromDoubleClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                    }
                    else
                    {
                        mInfo = form.GetType().GetMethod("Search", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                    }

                    if (mInfo != null)
                    {
                        mInfo.Invoke(form, null);
                    }
                    return;
                }
            }

            if (!info.canOpen)
            {
                return;
            }

            try
            {
                XtraTabPage page = new XtraTabPage();
                page.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
                page.Text   = info.menuText[AccessDB.GetConfig("lang")];
                page.Tag    = info;
                page.Font   = new System.Drawing.Font("맑은 고딕", 9F);
                page.Appearance.Header.Font           = new System.Drawing.Font("맑은 고딕", 9F);
                page.Appearance.HeaderActive.Font     = new System.Drawing.Font(page.Font.FontFamily.Name, page.Font.Size, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
                page.Appearance.HeaderDisabled.Font   = new System.Drawing.Font("맑은 고딕", 9F);
                page.Appearance.HeaderHotTracked.Font = new System.Drawing.Font("맑은 고딕", 9F);
                page.Appearance.PageClient.Font       = new System.Drawing.Font("맑은 고딕", 9F);
                page.ShowCloseButton = info.haveClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;


                tabControl.TabPages.Add(page);
                tabControl.SelectedTabPage = page;

                string dllPath = Application.StartupPath + @"\" + info.dllName + @".dll";
                Type   type    = null;
                try
                {
                    Assembly asm = Assembly.LoadFrom(dllPath);
                    type = asm.GetType(info.dllName + "." + info.className);
                }
                catch (Exception er)
                {
                    type = null;
                }

                if (type == null)
                {
                    return;
                }

                XtraUserControl form = null;
                bolConfirmMessage = true;

                if (!String.IsNullOrEmpty(ord_no))
                {
                    form   = Activator.CreateInstance(type, ord_no) as XtraUserControl;
                    ord_no = String.Empty;
                }
                else if (!(String.IsNullOrEmpty(pick_ord_yn) && String.IsNullOrEmpty(pick_yn) &&
                           String.IsNullOrEmpty(delv_ord_yn) && String.IsNullOrEmpty(delv_yn)))
                {
                    form = Activator.CreateInstance(type, pick_ord_yn, pick_yn, delv_ord_yn, delv_yn) as XtraUserControl;
                }
                else
                {
                    form = Activator.CreateInstance(type) as XtraUserControl;
                }

                if (form == null)
                {
                    return;
                }
                info.form    = form;
                form.Tag     = info;
                form.Visible = false;


                page.Controls.Add(form);
                form.Dock = DockStyle.Fill;

                form.Visible = true;
                if (form.Name == "COM_Home" || form.Name == "SOD_Order" || form.Name == "SOD_Pickup" || form.Name == "SOD_Delivery" || form.Name == "SOD_Return")
                {
                    form.Focus();
                }

                //MethodInfo mInfo = null;
                //if (!String.IsNullOrEmpty(ord_no))
                //{
                //    PropertyInfo ordNo = form.GetType().GetProperty("ordNo");
                //    ordNo.SetValue(form, ord_no);
                //
                //    if (form.Name == "SOD_Delivery" && finishDelivery) mInfo = form.GetType().GetMethod("InitFromDoubleClickAndHandle", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                //    else mInfo = form.GetType().GetMethod("InitFromDoubleClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                //    ord_no = String.Empty;
                //
                //}
                //else if (!(String.IsNullOrEmpty(pick_ord_yn) && String.IsNullOrEmpty(pick_yn)
                //  && String.IsNullOrEmpty(delv_ord_yn) && String.IsNullOrEmpty(delv_yn)))
                //{
                //    PropertyInfo pickOrdYn = form.GetType().GetProperty("pickOrdYn");
                //    pickOrdYn.SetValue(form, pick_ord_yn);
                //    PropertyInfo pickYn = form.GetType().GetProperty("pickYn");
                //    pickYn.SetValue(form, pick_yn);
                //    PropertyInfo delvOrdYn = form.GetType().GetProperty("delvOrdYn");
                //    delvOrdYn.SetValue(form, delv_ord_yn);
                //    PropertyInfo delvYn = form.GetType().GetProperty("delvYn");
                //    delvYn.SetValue(form, delv_yn);
                //
                //    mInfo = form.GetType().GetMethod("InitFromDoubleClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                //
                //}
                //else
                //{
                //    mInfo = form.GetType().GetMethod("Search", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null);
                //
                //}
                //
                //if (mInfo != null)
                //{
                //    mInfo.Invoke(form, null);
                //}
            }
            catch (Exception err)
            {
            }
        }