Ejemplo n.º 1
0
        private void RmvBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows.Count != 0)
                {
                    DialogResult result = MessageBox.Show("Do You Want to Delete?", "Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (result.Equals(DialogResult.OK))
                    {
                        DataGridViewRow row   = this.dataGridView1.SelectedRows[0];
                        string          id    = row.Cells["id"].Value.ToString();
                        StoreDao        store = new StoreDao();
                        store.delete(id);
                        showlist();
                        MessageBox.Show("Deleted");
                    }
                }

                else
                {
                    MessageBox.Show("Select the row you want to delete");
                    Store_Load(sender, e);
                }
            }
            catch (SqlException error)
            {
                if (error.Message.ToString() != "")
                {
                    MessageBox.Show("Shop cannot be removed without clearing the inventory");
                }
            }
            dataGridView1.ClearSelection();
        }
Ejemplo n.º 2
0
        public object Do_PickupOrderGoods(BaseApi baseApi)
        {
            PickupOrderGoodsParam pickupOrderGoodsParam = JsonConvert.DeserializeObject <PickupOrderGoodsParam>(baseApi.param.ToString());

            if (pickupOrderGoodsParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));
            StoreDao  storeDao  = new StoreDao();

            if (!storeDao.UpdateOrderState(pickupOrderGoodsParam.orderId, storeUser.storeUserId))
            {
                throw new ApiException(CodeMessage.PickupGoodsError, "PickupGoodsError");
            }
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = pickupOrderGoodsParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.ORDER,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);
            return("");
        }
Ejemplo n.º 3
0
        public object Do_ScanOrderCode(BaseApi baseApi)
        {
            ScanOrderCodeParam scanOrderCodeParam = JsonConvert.DeserializeObject <ScanOrderCodeParam>(baseApi.param.ToString());

            if (scanOrderCodeParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }

            StoreGoodsCode storeGoodsCode = Utils.GetCache <StoreGoodsCode>(scanOrderCodeParam);

            if (storeGoodsCode == null)
            {
                throw new ApiException(CodeMessage.InvalidOrderCode, "InvalidOrderCode");
            }
            StoreDao  storeDao  = new StoreDao();
            string    storeId   = storeDao.GetStoreId(storeGoodsCode.order.storeCode);
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            if (storeUser.storeId != storeId)
            {
                throw new ApiException(CodeMessage.NotStoreUserOrder, "NotStoreUserOrder");
            }
            Utils.DeleteCache <StoreGoodsCode>(scanOrderCodeParam);
            return(storeGoodsCode.order);
        }
Ejemplo n.º 4
0
        public object Do_GetStoreAccount(BaseApi baseApi)
        {
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            StoreDao storeDao = new StoreDao();

            return(storeDao.GetStoreAccount(storeUser.storeId));
        }
Ejemplo n.º 5
0
        public object Do_MemberCheckStore(BaseApi baseApi)
        {
            MemberCheckStoreParam memberCheckStoreParam = JsonConvert.DeserializeObject <MemberCheckStoreParam>(baseApi.param.ToString());

            if (memberCheckStoreParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            MemberCheckStoreCodeParam memberCheckStoreCodeParam = new MemberCheckStoreCodeParam
            {
                code = memberCheckStoreParam.code,
            };

            MemberCheckStoreCode memberCheckStoreCode = Utils.GetCache <MemberCheckStoreCode>(memberCheckStoreCodeParam);

            if (memberCheckStoreCode == null)
            {
                throw new ApiException(CodeMessage.InvalidMemberCkeckStoreCode, "InvalidMemberCkeckStoreCode");
            }

            StoreDao storeDao = new StoreDao();
            string   phone    = storeDao.CheckStoreMember(storeUser.storeId, memberCheckStoreCode.memberId);

            if (phone == "")
            {
                throw new ApiException(CodeMessage.NeedStoreMember, "NeedStoreMember");
            }

            if (memberCheckStoreParam.consume == 0 && !storeDao.CheckMemberCheckStore(storeUser.storeId, memberCheckStoreCode.memberId))
            {
                throw new ApiException(CodeMessage.AlreadyCheckThisStoreToday, "AlreadyCheckThisStoreToday");
            }

            if (!storeDao.InserMemberCheckStore(storeUser.storeId, memberCheckStoreCode.memberId, memberCheckStoreParam.consume, storeUser.storeUserId))
            {
                throw new ApiException(CodeMessage.MemberCkeckStoreError, "MemberCkeckStoreError");
            }

            Utils.DeleteCache <MemberCheckStoreCode>(memberCheckStoreCodeParam);
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = memberCheckStoreCodeParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.CHECK,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);

            return("");
        }
Ejemplo n.º 6
0
        public object Do_GetAsnAndStock(BaseApi baseApi)
        {
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            StoreDao          storeDao  = new StoreDao();
            List <StockGoods> listStock = storeDao.GetStockGoodsList(storeUser.storeId);
            List <AsnGoods>   listAsn   = storeDao.GetAsnGoodsList(storeUser.storeId);

            return(new { listAsn, listStock });
        }
Ejemplo n.º 7
0
        public object Do_Exchange(BaseApi baseApi)
        {
            ExchangeParam exchangeParam = JsonConvert.DeserializeObject <ExchangeParam>(baseApi.param.ToString());

            if (exchangeParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }

            ScanExchangeCodeParam scanExchangeCodeParam = new ScanExchangeCodeParam
            {
                code = exchangeParam.code
            };

            ExchangeCode exchangeCode = Utils.GetCache <ExchangeCode>(scanExchangeCodeParam);

            if (exchangeCode == null)
            {
                throw new ApiException(CodeMessage.InvalidExchangeCode, "InvalidExchangeCode");
            }

            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));

            StoreDao storeDao = new StoreDao();
            string   phone    = storeDao.CheckStoreMember(storeUser.storeId, exchangeCode.memberId);

            if (phone == "")
            {
                throw new ApiException(CodeMessage.NeedStoreMember, "NeedStoreMember");
            }

            if (!storeDao.InserRemoteCommit(storeUser.storeId, phone, exchangeParam.score))
            {
                throw new ApiException(CodeMessage.ExchangeError, "ExchangeError");
            }

            Utils.DeleteCache <ExchangeCode>(scanExchangeCodeParam);
            WsPayStateParam wsPayStateParam = new WsPayStateParam
            {
                scanCode = scanExchangeCodeParam.code,
            };
            WsPayState wsPayState = new WsPayState
            {
                wsType = WsType.EXCHANGE,
                Unique = wsPayStateParam.GetUnique(),
            };

            Utils.SetCache(wsPayState, 0, 0, 10);
            return("");
        }
Ejemplo n.º 8
0
        private void AUbtn_Click(object sender, EventArgs e)
        {
            if (AUbtn.Text == "Edit")
            {
                if (Nametxt.Text.Equals("") || Typetxt.Text.Equals(""))
                {
                    MessageBox.Show("Required Fields are empty");
                }
                else
                {
                    StoreDao store = new StoreDao();

                    String name = Nametxt.Text;
                    String Type = Typetxt.Text;
                    String id   = idtext.Text;

                    store.Update(id, name, Type);

                    MessageBox.Show("Edited!");

                    Store_Load(sender, e);
                }
            }
            if (AUbtn.Text == "Add")
            {
                if (Nametxt.Text.Equals("") || Typetxt.Text.Equals(""))
                {
                    MessageBox.Show("Required Fields are empty");
                }
                else
                {
                    StoreDao store = new StoreDao();

                    String name = Nametxt.Text;
                    String Type = Typetxt.Text;

                    store.insert(name, Type);

                    AddBtn.Enabled  = true;
                    EditBtn.Enabled = true;

                    MessageBox.Show("Added!");

                    Store_Load(sender, e);
                }
            }
        }
Ejemplo n.º 9
0
        public object Do_CheckAsnGoods(BaseApi baseApi)
        {
            CheckAsnGoodsParam checkAsnGoodsParam = JsonConvert.DeserializeObject <CheckAsnGoodsParam>(baseApi.param.ToString());

            if (checkAsnGoodsParam == null)
            {
                throw new ApiException(CodeMessage.InvalidParam, "InvalidParam");
            }
            OpenDao   openDao   = new OpenDao();
            StoreUser storeUser = openDao.GetStoreUser(Utils.GetOpenID(baseApi.token));
            StoreDao  storeDao  = new StoreDao();

            if (!storeDao.CheckAsnGoods(storeUser.storeId, checkAsnGoodsParam.goodsId, storeUser.storeUserId))
            {
                throw new ApiException(CodeMessage.CheckAsnGoodsError, "CheckAsnGoodsError");
            }

            return("");
        }
        static DependencyResolver()
        {
            Logger = new Log4net();

            RoleDao          = new RoleDao(Logger);
            UserDao          = new UserDao(Logger, RoleDao);
            CategoryDao      = new CategoryDao(Logger);
            ProductDao       = new ProductDao(Logger, CategoryDao);
            StoreDao         = new StoreDao(Logger);
            VendorDao        = new VendorDao(Logger);
            StatusDao        = new StatusDao(Logger);
            CommodityUnitDao = new CommodityUnitDao(Logger, ProductDao, StatusDao, StoreDao, VendorDao);

            RoleBll          = new RoleBll(Logger, RoleDao);
            UserBll          = new UserBll(Logger, RoleBll, UserDao);
            CategoryBll      = new CategoryBll(Logger, CategoryDao, CommodityUnitDao);
            ProductBll       = new ProductBll(Logger, CategoryBll, ProductDao, CommodityUnitDao);
            StoreBll         = new StoreBll(Logger, StoreDao, CommodityUnitDao);
            VendorBll        = new VendorBll(Logger, VendorDao, CommodityUnitDao);
            StatusBll        = new StatusBll(Logger, StatusDao, CommodityUnitDao);
            CommodityUnitBll = new CommodityUnitBll(Logger, CategoryBll, ProductBll, StatusBll, StoreBll, VendorBll, CommodityUnitDao);

            AuthenticationBll = new AuthenticationBll(UserBll);
        }
Ejemplo n.º 11
0
 public PurchaseService()
 {
     dao      = new PurchaseDao();
     daoStore = new StoreDao();
 }
Ejemplo n.º 12
0
 public StoreService()
 {
     dao = new StoreDao();
 }
Ejemplo n.º 13
0
 public WarehouseInfoService()
 {
     dao      = new WarehouseInfoDao();
     daoStore = new StoreDao();
 }
Ejemplo n.º 14
0
 public SaleService()
 {
     dao      = new SaleDao();
     daoStore = new StoreDao();
 }
Ejemplo n.º 15
0
 public void Setup()
 {
     _tested = new StoreDao();
 }
Ejemplo n.º 16
0
 public AdjustService()
 {
     dao      = new AdjustDao();
     daoStore = new StoreDao();
 }
Ejemplo n.º 17
0
 public PurchaseReturnService()
 {
     dao      = new PurchaseReturnDao();
     daoStore = new StoreDao();
 }
Ejemplo n.º 18
0
 public SaleReturnService()
 {
     dao      = new SaleReturnDao();
     daoStore = new StoreDao();
 }