コード例 #1
0
        /// <summary>
        /// 调用服务更新数据库
        /// </summary>
        /// <param name="mark"></param>
        /// <param name="isAll"></param>
        /// <returns></returns>
        bool InvokeServices(String mark, bool isAll)
        {
            bool result = false;
            //1、调用方法获取数据
            //2、将数据导入到表
            //bool isok = true;
            DataTable table = null;
            object    obj;

            try
            {
                t_handle _t_handle = Gattr.Bll.SelectHandleData();
                //obj = PosServiceProvider.Instance.InvokeService(Gattr.HttpAddress, Gattr.WebPosServicePath, mark, ref isok, Gattr.BranchNo);
                //obj = PosDownServiceProvider.Instance.InvokeService(Gattr.CONNECT_STRING, mark, ref isok, Gattr.BranchNo, "", 0, "");
                Dictionary <string, object> _dic = Gfunc.GetServiceParameter();
                _dic.Add("branch_no", Gattr.BranchNo);
                switch (mark)
                {
                case "Getiteminfo":
                    string last_time = WindowsAPIUtility.GetLocalSysParam("download", "t_product_food", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH);
                    _dic.Add("rid", _t_handle.t_product_food);
                    _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time).ToString());
                    break;

                case "Getbrastock":
                    string last_time1 = WindowsAPIUtility.GetLocalSysParam("download", "t_pos_branch_stock", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH);
                    _dic.Add("rid", _t_handle.t_product_food_kc);
                    _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time1).ToString());
                    break;

                case "Getbraprc":
                    string last_time2 = WindowsAPIUtility.GetLocalSysParam("download", "t_pos_branch_price", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH);
                    _dic.Add("rid", _t_handle.t_product_food_jg);
                    _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time2).ToString());
                    break;

                case "Getbarcode":
                    string last_time3 = WindowsAPIUtility.GetLocalSysParam("download", "barcode", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH);
                    _dic.Add("rid", _t_handle.t_product_food_barcode);
                    _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time3).ToString());
                    break;

                case "Getitemcls":
                    //_dic.Add("rid", _t_handle.t_product_food_type);
                    _dic.Add("rid", -1);
                    break;

                case "Getbasecode":
                    _dic.Add("rid", _t_handle.t_base_code_type);
                    break;

                case "Getbase":
                    _dic.Add("rid", _t_handle.t_base_code);
                    break;

                case "Getoper":
                    _dic.Add("rid", _t_handle.t_operator);
                    break;

                case "Getpmaster":
                    _dic.Add("rid", _t_handle.t_rm_plan_master);
                    break;

                case "Getcomb":
                    _dic.Add("rid", _t_handle.t_bd_item_combsplit);
                    break;

                case "Getpdetail":
                    _dic.Add("rid", _t_handle.t_rm_plan_detail);
                    break;
                }
                string errorMessage = string.Empty;
                bool   isok1        = true;
                obj = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/" + mark, _dic, ref isok1, ref errorMessage);
                if (isok1)
                {
                    //if (isok)
                    //{
                    //    //获取数据
                    //    //插入数据
                    //    if (mark != "GetPosSet")
                    //    {
                    string result1 = ExtendUtility.Instance.ParseToString(obj);
                    //if (!string.IsNullOrEmpty(result1))
                    {
                        if (result1 != "-10" && result1 != "-20")
                        {
                            table = JsonUtility.Instance.JsonToDataTable(result1);

                            if (!SIString.IsNullOrEmptyDataTable(table))
                            {
                                decimal rid = 0M;
                                switch (mark)
                                {
                                case "Getitemcls":
                                    result = Gattr.Bll.InsertItemClsData(table, _t_handle.t_product_food_type, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_product_food_type = rid;
                                    }
                                    break;

                                case "Getbarcode":
                                    result = Gattr.Bll.InsertBarcodeData(table, _t_handle.t_product_food_barcode, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_product_food_barcode = rid;
                                    }
                                    break;

                                case "Getiteminfo":
                                    result = Gattr.Bll.InsertItemData(table, _t_handle.t_product_food, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_product_food = rid;
                                    }
                                    break;

                                case "Getoper":
                                    result = Gattr.Bll.InsertCashierData(table, _t_handle.t_operator, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_operator = rid;
                                    }
                                    break;

                                case "Getbasecode":
                                    result = Gattr.Bll.InsertBaseTypeData(table, _t_handle.t_base_code_type, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_base_code_type = rid;
                                    }
                                    break;

                                case "Getbase":
                                    result = Gattr.Bll.InsertBaseData(table, _t_handle.t_base_code, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_base_code = rid;
                                    }
                                    break;

                                case "Getpayinfo":
                                    result = Gattr.Bll.InsertPaymentInfo(table);
                                    break;

                                case "Getkey":
                                    result = Gattr.Bll.InsertFunction(table);
                                    break;

                                case "Getbrninfo":
                                    result = Gattr.Bll.InsertBrancheList(table);
                                    break;

                                case "Getbraprc":
                                    result = Gattr.Bll.UpdateItemPrice(table, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_product_food_jg = rid;
                                    }
                                    break;

                                case "Getbrastock":
                                    result = Gattr.Bll.UpdateItemStock(table, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_product_food_kc = rid;
                                    }
                                    break;

                                case "Getprule":
                                    result = Gattr.Bll.InsertPlanRule(table);
                                    break;

                                case "Getpmaster":
                                    result = Gattr.Bll.InsertPlanMaster(table, _t_handle.t_rm_plan_master, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_rm_plan_master = rid;
                                    }
                                    break;

                                case "Getpdetail":
                                    result = Gattr.Bll.InsertPlanDetail(table, _t_handle.t_rm_plan_detail, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_rm_plan_detail = rid;
                                    }
                                    break;

                                case "Getcomb":
                                    result = Gattr.Bll.InsertItemComb(table, _t_handle.t_bd_item_combsplit, ref rid);
                                    if (result)
                                    {
                                        _t_handle.t_bd_item_combsplit = rid;
                                    }
                                    break;

                                case "Getsup":
                                    result = Gattr.Bll.InsertSupinfo(table);
                                    break;

                                default:
                                    break;
                                }
                                //如果数据更新成功则更新标识信息
                                if (result)
                                {
                                    Gattr.Bll.UpdateHandleData(_t_handle);
                                }
                            }
                            else
                            {
                                result = true;
                            }
                        }
                    }
                    //    }
                    //    else
                    //    {
                    //        // List<t_sys_pos_set> sets = JsonUtility.Instance.JsonToObject<List<t_sys_pos_set>>(obj.ToString());
                    //        // result = Gattr.Bll.InsertPosSysSet(sets);
                    //    }
                    //}
                    //else
                    //{
                    //    MessageBox.Show(SIString.TryStr(obj), Gattr.AppTitle);
                    //}
                }
                else
                {
                    MessageBox.Show(errorMessage, Gattr.AppTitle);
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Log("MsmkLogger", ex.ToString(), LogEnum.ExceptionLog);
            }
            return(result);
        }
コード例 #2
0
 /// <summary>
 /// 更新增量更新的标识
 /// </summary>
 /// <param name="t_h"></param>
 public bool UpdateHandleData(t_handle t_h)
 {
     return(this._dal.UpdateHandleDate(t_h));
 }