Exemplo n.º 1
0
    public string ApplyCustomerAndUnit(string userId, string customerInfo, string unitInfo)
    {
        //userId = "AB90F0708E324BBAB016DEE062022430";
        //customerInfo = "{\"status\":0,\"customerList\":[{\"iD\":\"9057BC8D9A8E474680631DAF143342A9\",\"code\":\"mob_cus_1\",\"name\":\"mob_cus_1_name\",\"status\":0,\"creater\":{},\"createTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastEditor\":{},\"lastEditTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"}],\"creater\":{},\"createTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastEditor\":{},\"lastEditTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"}";
        //unitInfo = "{\"customer\":{\"status\":0,\"creater\":{},\"createTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastEditor\":{},\"lastEditTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"},\"status\":0,\"customerShopList\":[{\"customer\":{\"status\":0,\"creater\":{},\"createTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastEditor\":{},\"lastEditTime\":\"0001-01-01T00:00:00.0000000+08:00\",\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"},\"iD\":\"A8CCA2FFCA7844629AD7E71ED0083469\",\"code\":\"mob_unit_1\",\"name\":\"mob_unit_1_name\",\"status\":0,\"customer_id\":\"9057BC8D9A8E474680631DAF143342A9\",\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"}],\"lastSystemModifyStamp\":\"0001-01-01T00:00:00.0000000+08:00\"}";

        cPos.Model.LoggingSessionInfo loggingSessionInfo = new cPos.Model.LoggingSessionInfo();
        var customerService = new CustomerService();

        cPos.Admin.Model.Customer.CustomerInfo customer     = null;
        cPos.Admin.Model.Customer.CustomerInfo unitCustomer = null;
        if (customerInfo != null && customerInfo.Length > 0)
        {
            customer = JsonConvert.Import <cPos.Admin.Model.Customer.CustomerInfo>(customerInfo);
        }
        if (unitInfo != null && unitInfo.Length > 0)
        {
            unitCustomer = JsonConvert.Import <cPos.Admin.Model.Customer.CustomerInfo>(unitInfo);
        }

        string error = string.Empty;

        // 处理客户/门店
        if ((customer != null && customer.CustomerList != null) ||
            unitCustomer != null && unitCustomer.CustomerShopList != null)
        {
            customerService.SetMobileCustomerInfoBatch(customer.CustomerList, unitCustomer.CustomerShopList, out error);
        }
        return(error);
    }
Exemplo n.º 2
0
        /// <summary>
        /// 根据市获取地区
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="city_code">市号码</param>
        /// <returns></returns>
        public IList <CityInfo> GetAreaListByCity(cPos.Model.LoggingSessionInfo loggingSessionInfo, string city_code)
        {
            Hashtable _ht = new Hashtable();

            _ht.Add("CityCode", city_code);
            return(MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).QueryForList <CityInfo>("City.SelectArea", _ht));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取单个城市信息
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="city_id"></param>
        /// <returns></returns>
        public CityInfo GetCityById(cPos.Model.LoggingSessionInfo loggingSessionInfo, string city_id)
        {
            Hashtable _ht = new Hashtable();

            _ht.Add("CityId", city_id);
            return((CityInfo)MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).QueryForObject("City.SelectById", _ht));
        }
Exemplo n.º 4
0
        ///// <summary>
        ///// 根据组织门店获取库存
        ///// </summary>
        ///// <param name="loggingSessionInfo">登录model</param>
        ///// <param name="unit_id">组织标识</param>
        ///// <param name="warehouse_id">门店标识</param>
        ///// <param name="maxRowCount">最大数量</param>
        ///// <param name="startRowIndex">开始数量</param>
        ///// <returns></returns>
        //public StockBalanceInfo GetStockBalanceListByUnitIdWarehouseId(LoggingSessionInfo loggingSessionInfo
        //                                                                    , string unit_id
        //                                                                    , string warehouse_id
        //                                                                    , int maxRowCount
        //                                                                    , int startRowIndex
        //                                                                    )
        //{
        //    try
        //    {
        //        Hashtable _ht = new Hashtable();
        //        _ht.Add("StartRow", startRowIndex);
        //        _ht.Add("EndRow", startRowIndex + maxRowCount);
        //        _ht.Add("UnitId", unit_id);
        //        _ht.Add("WarehouseId", warehouse_id);
        //        _ht.Add("TypeValue", "1");

        //        StockBalanceInfo stockBalanceInfo = new StockBalanceInfo();

        //        int iCount = cSqlMapper.Instance().QueryForObject<int>("StockBalance.SearchCount", _ht);

        //        IList<StockBalanceInfo> stockBalanceInfoList = new List<StockBalanceInfo>();
        //        stockBalanceInfoList = cSqlMapper.Instance().QueryForList<StockBalanceInfo>("StockBalance.Search", _ht);
        //        stockBalanceInfo.icount = iCount;
        //        stockBalanceInfo.StockBalanceInfoList = stockBalanceInfoList;

        //        return stockBalanceInfo;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw (ex);
        //    }
        //}
        #endregion

        #region 扣库存
        /// <summary>
        /// 扣库存
        /// </summary>
        /// <param name="loggingSessionInfo">登录model</param>
        /// <param name="order_id">单据标识</param>
        /// <returns></returns>
        public void SetStockBalance(cPos.Model.LoggingSessionInfo loggingSessionInfo, string order_id)
        {
            Hashtable _ht = new Hashtable();

            _ht.Add("OrderId", order_id);
            _ht.Add("UserId", loggingSessionInfo.CurrentUser.User_Id);
            MSSqlMapper.Instance().Update("StockBalance.SetStockBalance", _ht);
        }
Exemplo n.º 5
0
    public string GetItemInfoByBarcode(string barcode)
    {
        cPos.Model.LoggingSessionInfo loggingSessionInfo = new cPos.Model.LoggingSessionInfo();
        var      itemService = new ItemService();
        var      skuService  = new SkuService();
        ItemInfo item        = new ItemInfo();
        SkuInfo  sku         = skuService.GetSkuByBarcode(barcode);

        item.SkuInfoByBarcode = sku;
        if (sku != null)
        {
            item.ItemInfoByBarcode = itemService.GetItemInfoById(loggingSessionInfo, sku.item_id);
        }
        return(XMLGenerator.Serialize(item));
    }
Exemplo n.º 6
0
    public string GetUserUnitRelations(string userId, string type)
    {
        cPos.Model.LoggingSessionInfo loggingSessionInfo = new cPos.Model.LoggingSessionInfo();
        var customerService = new CustomerService();

        CustomerUserInfo user = new CustomerUserInfo();

        user = customerService.GetCustomerUserInfoByMobileUser(userId);

        string content = string.Empty;

        Jayrock.Json.JsonTextWriter writer = new Jayrock.Json.JsonTextWriter();
        Jayrock.Json.Conversion.JsonConvert.Export(user, writer);
        content = writer.ToString();
        return(content);
    }
Exemplo n.º 7
0
    public string SetCCOrderList(string userId, string type, string orderList)
    {
        //userId = "B87FBC7A6D664F67B65F9AD747C5E5DD";
        //type = "MOBILE";
        //orderList = "{\"row_No\":0,\"iCount\":0,\"cCDetail_ICount\":0,\"cCInfoList\":[{\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"order_no\":\"mob_A6F0575B403149439850A3360EC0F67F\",\"order_date\":\"2013-01-01\",\"unit_id\":\"0d2bf77f765849249a0270c0a07fef07\",\"status\":\"1\",\"create_time\":\"2013-01-29 11:37:43\",\"create_user_id\":\"1\",\"row_No\":0,\"iCount\":0,\"cCDetail_ICount\":0,\"cCDetailInfoList\":[{\"order_detail_id\":\"41914F1FD64E4B19A053397BF90046E1\",\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"sku_id\":\"00000672F66A4D169FCC1A9F7C53BF49\",\"end_qty\":15,\"order_qty\":0,\"difference_qty\":0,\"display_index\":0,\"if_flag\":0,\"item_code\":\"938844\",\"item_name\":\"情森QS012TJ牛仔裤(清110526)\",\"row_no\":0,\"icount\":0,\"barcode\":\"2000001388662\",\"sku_prop_1_name\":\"74-104cm\",\"enter_price\":\"100\",\"sales_price\":\"150\"},{\"order_detail_id\":\"B00A2B10D87D4860A95779D5283B4C1C\",\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"sku_id\":\"E33384FB21664F38930CF751393D3441\",\"end_qty\":99,\"order_qty\":0,\"difference_qty\":0,\"display_index\":0,\"if_flag\":0,\"item_code\":\"938844\",\"item_name\":\"情森QS012TJ牛仔裤(清110526)\",\"row_no\":0,\"icount\":0,\"barcode\":\"m_2000001388662\",\"sku_prop_1_name\":\"74-104cm\",\"enter_price\":\"100\",\"sales_price\":\"150\"}],\"total_qty\":0}],\"total_qty\":0}";
        //orderList = "{\"row_No\":0,\"iCount\":0,\"cCDetail_ICount\":0,\"cCInfoList\":[{\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"order_no\":\"mob_A6F0575B403149439850A3360EC0F67F\",\"order_date\":\"2013-01-01\",\"unit_id\":\"0d2bf77f765849249a0270c0a07fef07\",\"status\":\"1\",\"create_time\":\"2013-01-29 14:47:44\",\"create_user_id\":\"1\",\"row_No\":0,\"iCount\":0,\"cCDetail_ICount\":0,\"cCDetailInfoList\":[{\"order_detail_id\":\"41914F1FD64E4B19A053397BF90046E1\",\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"sku_id\":\"00000672F66A4D169FCC1A9F7C53BF49\",\"end_qty\":15,\"order_qty\":0,\"difference_qty\":0,\"display_index\":0,\"if_flag\":0,\"item_code\":\"938844\",\"item_name\":\"情森QS012TJ牛仔裤(清110526)\",\"row_no\":0,\"icount\":0,\"barcode\":\"2000001388662\",\"sku_prop_1_name\":\"74-104cm\",\"enter_price\":\"100\",\"sales_price\":\"150\"},{\"order_detail_id\":\"47A5626FB7384B6AA3C540932A8D1219\",\"order_id\":\"A6F0575B403149439850A3360EC0F67F\",\"sku_id\":\"5D1D7801100C4B0EBE59302D0BA658E7\",\"end_qty\":99,\"order_qty\":0,\"difference_qty\":0,\"display_index\":0,\"if_flag\":0,\"item_code\":\"m-123456\",\"item_name\":\"M-123456\",\"row_no\":0,\"icount\":0,\"barcode\":\"M123456\",\"sku_prop_1_name\":\"mmm\",\"enter_price\":\"100\",\"sales_price\":\"150\"}],\"total_qty\":0}],\"total_qty\":0}";

        cPos.Model.LoggingSessionInfo loggingSessionInfo = new cPos.Model.LoggingSessionInfo();
        var orderService = new cPos.Admin.Service.CCOrderService();

        cPos.Admin.Model.CCInfo orderInfo = null;
        if (orderList != null && orderList.Length > 0)
        {
            orderInfo = JsonConvert.Import <cPos.Admin.Model.CCInfo>(orderList);
        }

        string error = string.Empty;

        if (orderInfo != null)
        {
            orderService.SaveCCOrderList(true, orderInfo.CCInfoList, type, userId);
        }
        return(error);
    }
Exemplo n.º 8
0
    /// <summary>
    /// 用户点击登录按钮后检查用户是否合法
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        PageLog.Current.Write(string.Format("btnLogin sessionId is :{0},count:{1}", this.Session.SessionID, this.Session.Count));
        //将用户登录名密码提交到服务器检验
        string account = txtUsername.Value.Trim();
        string pwd     = txtPassword.Value.Trim();

        //string authCode = txtValidateCode.Text.Trim();

        if (string.IsNullOrEmpty(account))
        {
            lblInfor.Text = "请输入用户名!";
            txtUsername.Focus();
            return;
        }
        if (string.IsNullOrEmpty(pwd))
        {
            lblInfor.Text = "请输入密码!";
            txtPassword.Focus();
            return;
        }

        //if (string.IsNullOrEmpty(authCode))
        //{
        //    lblInfor.Text = "请输入验证码!";
        //    txtValidateCode.Focus();
        //    return;
        //}
        //if (authCode != this.Session[SessionManager.KEY_AUTH_CODE].ToString())
        //{
        //    lblInfor.Text = "验证码错误!";
        //    txtValidateCode.Focus();
        //    return;
        //}

        Hashtable ht = new Hashtable();

        try
        {
            int ret = this.GetUserService().ValidateUser(account, pwd, out ht);
            switch (ret)
            {
            case -1:
                lblInfor.Text = "用户不存在";
                return;

            case -2:
                lblInfor.Text = "用户被停用";
                return;

            case -3:
                lblInfor.Text = "密码不正确";
                return;

            case 1:
                //用户名和密码验证通过
                this.Session.Add("UserID", ht["UserID"]);    //获取到了UserID
                this.Session.Add("UserName", ht["UserName"]);
                this.Session.Add("unit_id", ht["unit_id"]);
                LoggingSessionInfo loggingSession = new LoggingSessionInfo();
                loggingSession.UserID   = ht["UserID"].ToString();
                loggingSession.UserName = ht["UserName"].ToString();
                loggingSession.unit_id  = ht["unit_id"] == null ? "" : ht["unit_id"].ToString();
                SessionManager.CurrentLoggingSession = loggingSession;
                //登录日志
                var loggingObj = new cPos.Model.LoggingSessionInfo();
                loggingObj.CurrentUser             = new cPos.Model.User.UserInfo();
                loggingObj.CurrentUser.User_Id     = loggingSession.UserID;
                loggingObj.CurrentUser.User_Name   = loggingSession.UserName;
                loggingObj.CurrentLoggingManager   = new cPos.Model.LoggingManager();
                loggingObj.CurrentUserRole         = new cPos.Model.User.UserRoleInfo();
                this.Session["loggingSessionInfo"] = loggingObj;

                break;

            default:
                lblInfor.Text = "用户名和密码不正确";
                return;
            }
        }
        catch (Exception ex)
        {
            PageLog.Current.Write(string.Format("登录失败 :{0}", ex.Message));
            lblInfor.Text = "用户名和密码不正确";
            return;
        }

        // chkRemember
        if (chkRemember.Checked)
        {
            Response.Cookies["cpos_bs_remember"].Value   = "1";
            Response.Cookies["cpos_bs_remember"].Expires = DateTime.MaxValue;

            Response.Cookies["cpos_bs_user"].Value   = account;
            Response.Cookies["cpos_bs_user"].Expires = DateTime.MaxValue;

            Response.Cookies["cpos_bs_pwd"].Value   = pwd;
            Response.Cookies["cpos_bs_pwd"].Expires = DateTime.MaxValue;
        }
        else
        {
            Response.Cookies["cpos_bs_remember"].Value = "";
            Response.Cookies["cpos_bs_user"].Value     = "";
            Response.Cookies["cpos_bs_pwd"].Value      = "";
        }

        //this.Response.Redirect("~/common/homepage.aspx");
        this.Response.Redirect("~/default.aspx");
    }
Exemplo n.º 9
0
 /// <summary>
 /// 获取省
 /// </summary>
 /// <param name="loggingSessionInfo"></param>
 /// <returns></returns>
 public IList <CityInfo> GetProvinceList(cPos.Model.LoggingSessionInfo loggingSessionInfo)
 {
     return(MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).QueryForList <CityInfo>("City.SelectProvince", ""));
 }
Exemplo n.º 10
0
        /// <summary>
        /// 获取城市信息
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <returns></returns>
        public IList <CityInfo> GetCityInfoList(cPos.Model.LoggingSessionInfo loggingSessionInfo)
        {
            Hashtable _ht = new Hashtable();

            return(MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).QueryForList <CityInfo>("City.Select", _ht));
        }