Example #1
0
        private void LoadTotals(WorksheetBase ws, CashType cashType, CategoryType categoryType)
        {
            var totals = dataContext.CategoriesByType(cashType, categoryType);

            if (totals.Count() < 2)
            {
                return;
            }

            curRow += 2;
            ws.Cells[curRow, 1].EntireRow.Locked = true;
            if (!Greyscale)
            {
                ws.Cells[curRow, 1].EntireRow.Interior.Color = Color.GreenYellow;
            }
            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle    = Excel.XlLineStyle.xlContinuous;
            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeTop].Weight       = Excel.XlBorderWeight.xlThin;
            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight    = Excel.XlBorderWeight.xlThin;
            ws.Cells[curRow, 1].Value          = $"{totals.Select(s => s.CashType).First()} {Properties.Resources.TextTotals}";
            ws.Cells[curRow, 1].Font.Bold      = true;
            ws.Cells[curRow, 1].Font.Underline = false;

            foreach (Data.fnFlowCategoriesByTypeResult total in totals)
            {
                curRow++;
                ws.Cells[curRow, 1].EntireRow.Locked = true;
                ws.Cells[curRow, 1].Value            = "=" + "\"" + total.CategoryCode + "\"";
                ws.Cells[curRow, 2].Value            = total.Category;
                ws.Cells[curRow, 3].Value            = "=" + "\"" + total.CategoryCode + "\"";
            }

            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
            ws.Cells[curRow, 1].EntireRow.Cells.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight    = Excel.XlBorderWeight.xlThick;
        }
Example #2
0
        public static CashSuper createCashAccept(CashType type)
        {
            CashSuper cs = null;

            switch (type)
            {
            case CashType.Normal:
                cs = new CashNormal();
                break;

            case CashType.Return:
                CashReturn cr = new CashReturn("300", "100");
                cs = cr;
                break;

            case CashType.Rebate:
                CashRebate cr2 = new CashRebate("0.8");
                cs = cr2;
                break;

            default:
                break;
            }
            return(cs);
        }
 public void SetNewValue(string name, CashType type, int layoutOrder, int cashflowTypeId)
 {
     Name           = name;
     Type           = type;
     LayoutOrder    = layoutOrder;
     CashflowTypeId = cashflowTypeId;
 }
Example #4
0
        public CashType SaveCashType()
        {
            //数据验证
            if (_CashTypeBean.Code == null || _CashTypeBean.Code.Length > 10 || _CashTypeBean.Code.Length < 1)
            {
                MessageBox.Show("编号长度必须在1到10位之间!");
                return(null);
            }
            //收银方式
            if (_CashTypeBean.Name == null || _CashTypeBean.Name.Length > 12 || _CashTypeBean.Name.Length < 2)
            {
                MessageBox.Show("编号长度必须在1到20位之间!");
                return(null);
            }
            //组合键方式
            if (!CommonUtil.RegexpNumber(_CashTypeBean.Keys))
            {
                MessageBox.Show("快捷键格式为 A  或者 A-Z ");
                return(null);
            }
            CashType cashType = _DataService.addCashType(_CashTypeBean.CreateCashType(_CashTypeBean));

            if (cashType == null)
            {
                MessageBox.Show(" 新增失败 , 可能 快捷键有冲突 !");
            }
            return(cashType);
        }
 public void SetGroup(bool isUseGroup, int groupRowSpan, CashType type)
 {
     IsUseGroup   = isUseGroup;
     GroupRowSpan = groupRowSpan;
     Type         = type;
     TypeName     = type.ToDescriptionString();
 }
        public CashType CreateCashType(CashTypeBean cashType)
        {
            CashType ct = new CashType();

            ct.AllDiscount     = cashType.AllDiscount;
            ct.CashBaseTypeId  = cashType.CashBaseTypeId;
            ct.Code            = cashType.Code;
            ct.CreateBy        = cashType.CreateBy;
            ct.CreateDatetime  = cashType.CreateDatetime;
            ct.Deleted         = cashType.Deleted;
            ct.Id              = cashType.Id;
            ct.IsBillIncome    = cashType.IsBillIncome;
            ct.IsPaid          = cashType.IsPaid;
            ct.IsPrivilege     = cashType.IsPrivilege;
            ct.IsScore         = cashType.IsScore;
            ct.KeepRecharge    = cashType.KeepRecharge;
            ct.Keys            = cashType.Keys;
            ct.LossesUsing     = cashType.LossesUsing;
            ct.Name            = cashType.Name;
            ct.Rate            = cashType.Rate;
            ct.ReceptionUseing = cashType.ReceptionUseing;
            ct.RechargeUsing   = cashType.RechargeUsing;
            ct.Status          = cashType.Status;
            ct.SupplierUsing   = cashType.SupplierUsing;
            ct.UpdateBy        = cashType.UpdateBy;
            ct.UpdateDatetime  = cashType.UpdateDatetime;
            ct.UseingKeys      = cashType.UseingKeys;
            return(ct);
        }
        private CashOperationsFeeModel GetCashOperationsFeeModel(decimal volume, CashType cashType)
        {
            var result = new CashOperationsFeeModel
            {
                BrokerId = BrokerId,
                Asset    = Btc
            };

            switch (cashType)
            {
            case CashType.CashIn:
                result.CashInValue   = volume;
                result.CashInFeeType = CashOperationsFeeTypeModel.Percentage;
                break;

            case CashType.CashOut:
                result.CashOutValue   = volume;
                result.CashOutFeeType = CashOperationsFeeTypeModel.Percentage;
                break;

            case CashType.Transfer:
                result.CashTransferValue   = volume;
                result.CashTransferFeeType = CashOperationsFeeTypeModel.Percentage;
                break;
            }

            return(result);
        }
 public CashTypeBean CreateCashTypeBean(CashType cashType)
 {
     this.AllDiscount      = cashType.AllDiscount;
     this.CashBaseTypeId   = cashType.CashBaseTypeId;
     this.Code             = cashType.Code;
     this.CreateBy         = cashType.CreateBy;
     this.CreateDatetime   = cashType.CreateDatetime;
     this.Deleted          = cashType.Deleted;
     this.Id               = cashType.Id;
     this.IsBillIncome     = cashType.IsBillIncome;
     this.IsPaid           = cashType.IsPaid;
     this.IsPrivilege      = cashType.IsPrivilege;
     this.IsScore          = cashType.IsScore;
     this.KeepRecharge     = cashType.KeepRecharge;
     this.Keys             = cashType.Keys;
     this.LossesUsing      = cashType.LossesUsing;
     this.Name             = cashType.Name;
     this.Rate             = cashType.Rate;
     this.ReceptionUseing  = cashType.ReceptionUseing;
     this.RechargeUsing    = cashType.RechargeUsing;
     this.Status           = cashType.Status;
     this.SupplierUsing    = cashType.SupplierUsing;
     this.UpdateBy         = cashType.UpdateBy;
     this.UpdateDatetime   = cashType.UpdateDatetime;
     this.UseingKeys       = cashType.UseingKeys;
     this.CashBaseTypeName = TiQuName(cashType.CashBaseTypeId);
     return(this);
 }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            var version = writer.SetVersion(2);

            switch (version)
            {
            case 2:
                writer.WriteTextDef(_CashAbbr);
                goto case 1;

            case 1:
                CashProperty.Serialize(writer);
                goto case 0;

            case 0:
            {
                CashType.Serialize(writer);

                writer.WriteTextDef(_CashName);
                writer.Write(_ShowCashName);

                writer.Write(_Trading);

                writer.Write(Discount);
                writer.Write(DiscountEnabled);
                writer.Write(DiscountYell);
            }
            break;
            }
        }
Example #10
0
 public void SetGroup(CashType type, int groupRows)
 {
     TypeName   = type.ToDescriptionString();
     Type       = type;
     IsUseGroup = true;
     GroupRows  = groupRows;
 }
 //添加收银方式 返回添加成功后的收银方式
 public CashType addCashType(CashType cashType)
 {
     try
     {
         if (cashType == null)
         {
             return(null);
         }
         CashType newCashType = null;
         using (ChooseDishesEntities entities = new ChooseDishesEntities())
         {
             var type = entities.CashType.SingleOrDefault(bt => bt.Code == cashType.Code);
             if (type != null)
             {
                 return(null);
             }
             entities.CashType.Add(cashType);
             entities.SaveChanges();
             var typenew = entities.CashType.SingleOrDefault(bt => bt.Code == cashType.Code);
             if (typenew != null)
             {
                 newCashType = type;
             }
         }
         return(newCashType);
     }
     catch (Exception e)
     {
         e.ToString();
         return(null);
     }
 }
        public JsonResult _UpdateCashTypes(CashType ins)
        {
            //...Update Object
            CashType ins2 = CashRep.Update(ins);

            //...Repopulate Grid...
            return(Json(new GridModel(CashRep.GetAllCashType())));
        }
        public JsonResult _InsertCashTypes(CashType ins)
        {
            //...Insert Object
            CashType ins2 = CashRep.Insert(ins);

            //...Repopulate Grid...
            return(Json(new GridModel(CashRep.GetAllCashType())));
        }
 public BudgetCashflowCategoryModel(string name, CashType type, int cashflowTypeId, int layoutOrder, bool isLabelOnly)
 {
     Name           = name;
     Type           = type;
     CashflowTypeId = cashflowTypeId;
     LayoutOrder    = layoutOrder;
     IsLabelOnly    = isLabelOnly;
 }
Example #15
0
 public BudgetCashflowDivisionItemDto(BudgetCashflowTypeModel cashflowType, CashType type, CurrencyDto currency, bool isShowSummaryLabel)
 {
     CashflowType       = cashflowType;
     Type               = type;
     SummaryLabel       = type == CashType.In ? $"Total Penerimaan {cashflowType.Name}" : $"Total Pengeluaran {cashflowType.Name}";
     Currency           = currency;
     IsSummary          = true;
     IsShowSummaryLabel = isShowSummaryLabel;
 }
Example #16
0
 public DivisionTemporaryDivisionUnitDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, DivisionDto division)
 {
     CashflowType        = cashflowType;
     Type                = type;
     CashflowCategory    = cashflowCategory;
     CashflowSubCategory = cashflowSubCategory;
     Currency            = currency;
     Division            = division;
 }
 public TotalCashType(int cashflowTypeId, CashType cashType, int currencyId, double nominal, double currencyNominal, double total)
 {
     CashflowTypeId  = cashflowTypeId;
     CashType        = cashType;
     CurrencyId      = currencyId;
     Nominal         = nominal;
     CurrencyNominal = currencyNominal;
     Total           = total;
 }
Example #18
0
        /// <summary>
        /// Cash type changing
        /// </summary>
        /// <param name="cashId">Cash ID</param>
        /// <param name="cashType">Cash type</param>
        public void ChangeCashType(int cashId, CashType cashType)
        {
            CashCreator cashCreator = new CashCreator();
            Cash        cash        = FindCash(cashId);
            int         money       = cash.Amount;

            cash        = cashCreator.CreateCash(cash.ID, cash.Currency, cashType);
            cash.Amount = money;
        }
        private double SetType(CashType type, double price, double num)
        {
            CashSuper cashsuper = CashFactory.createCashAccept(type);

            double totalPrices = 0d;

            totalPrices = cashsuper.AcceptCash(price * num);

            return(totalPrices);
        }
Example #20
0
 public static BchAddrData Create(CashFormat format, CashNetwork network, CashType type, byte[] hash)
 {
     return(new BchAddrData
     {
         Format = format,
         Network = network,
         Type = type,
         Hash = hash,
     });
 }
        public override int GetPriceScalar()
        {
            var scalar = CashType.TypeEquals <Gold>() ? base.GetPriceScalar() : 100;

            if (DiscountEnabled)
            {
                scalar -= Math.Max(0, Math.Min(100, Discount));
            }

            return(Math.Max(0, scalar));
        }
Example #22
0
 public BudgetCashflowDivisionItemDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, bool isShowSubCategoryLabel) : this(cashflowType, type)
 {
     CashflowType           = cashflowType;
     Type                   = type;
     TypeName               = type.ToDescriptionString();
     CashflowCategory       = cashflowCategory;
     CashflowSubCategory    = cashflowSubCategory;
     Currency               = currency;
     IsSubCategory          = true;
     IsShowSubCategoryLabel = isShowSubCategoryLabel;
     Items                  = new List <BudgetCashflowDivisionUnitItemDto>();
 }
        /// <summary>
        /// 簡單工廠pattern
        /// </summary>
        /// <returns></returns>
        public static ICash CreateCashFactory(CashType cashType)
        {
            ICash instance = cashType switch
            {
                CashType.Normal => new CashNormal(),
                CashType.Rebate => new CashRebate(0.8),
                CashType.Return => new CashReturn(300, 100),
                _ => throw new Exception("不知名外星人")
            };

            return(instance);
        }
    }
Example #24
0
        /// <summary>
        /// Cash creating
        /// </summary>
        /// <param name="cashId">Cash ID</param>
        /// <param name="currency">Currency</param>
        /// <param name="cashType">Cash type</param>
        /// <exception cref="ArgumentException">When cash with this id was created</exception>
        public Cash CreateCash(int cashId, Currency currency, CashType cashType)
        {
            foreach (Cash cash in Cashs)
            {
                if (cash.ID == cashId)
                {
                    throw new ArgumentException("Cash with this ID was created");
                }
            }
            Cash tempCash = cashCreator.CreateCash(cashId, currency, cashType);

            Cashs.Add(tempCash);
            return(tempCash);
        }
        public static string ToDescriptionString(this CashType me)
        {
            var enumType   = me.GetType();
            var memberInfo = enumType.GetMember(me.ToString());

            if (memberInfo != null && memberInfo.Length > 0)
            {
                var _attr = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                if (_attr != null && _attr.Count() > 0)
                {
                    return(((DescriptionAttribute)_attr.ElementAt(0)).Description);
                }
            }
            return(me.ToString());
        }
Example #26
0
 public DivisionTemporaryDivisionUnitDto(BudgetCashflowTypeModel cashflowType, CashType type, BudgetCashflowCategoryModel cashflowCategory, BudgetCashflowSubCategoryModel cashflowSubCategory, CurrencyDto currency, DivisionDto division, UnitAccountingDto unitAccounting, BudgetCashflowUnitModel cashflowUnit)
 {
     CashflowType        = cashflowType;
     Type                = type;
     CashflowCategory    = cashflowCategory;
     CashflowSubCategory = cashflowSubCategory;
     Currency            = currency;
     Division            = division;
     Unit                = new UnitDto {
         Code       = unitAccounting.Code,
         DivisionId = unitAccounting.DivisionId,
         Id         = unitAccounting.Id,
         Name       = unitAccounting.Name
     };
     CashflowUnit = cashflowUnit;
 }
Example #27
0
        public override void Serialize(GenericWriter writer)
        {
            _DynamicStock.RemoveRange(o => o.Key.Deleted || o.Value == null || o.Value.Item != o.Key);

            base.Serialize(writer);

            var version = writer.SetVersion(4);

            switch (version)
            {
            case 4:
            {
                writer.WriteDictionary(_DynamicStock, (w, item, info) => info.Serialize(w));
            }
                goto case 3;

            case 3:
            {
                writer.Write(_WasStocked);
                writer.Write(CanRestock);
            }
                goto case 2;

            case 2:
                writer.WriteTextDef(_CashAbbr);
                goto case 1;

            case 1:
                CashProperty.Serialize(writer);
                goto case 0;

            case 0:
            {
                CashType.Serialize(writer);

                writer.WriteTextDef(_CashName);
                writer.Write(_ShowCashName);

                writer.Write(_Trading);

                writer.Write(Discount);
                writer.Write(DiscountEnabled);
                writer.Write(DiscountYell);
            }
            break;
            }
        }
        /// <summary>
        /// 初始化 <see cref="CqPrivateMessageEventArgs"/> 类的一个新实例
        /// </summary>
        /// <param name="id">事件ID</param>
        /// <param name="name">事件名称</param>
        /// <param name="msgId">消息ID</param>
        /// <param name="fromQQ">来源QQ</param>
        /// <param name="msg">消息内容</param>
        public CqTransferAccountsEventArgs(long robotQQ, long fromqq, int stauts, string json)
        {
            this.RobotQQ = robotQQ;
            this.FromQQ  = fromqq;
            Root rt = JsonConvert.DeserializeObject <Root>(json);

            this.Money   = rt.Money;
            this.OrderId = rt.ID;
            this.Note    = rt.Msg;
            if (stauts == 0)
            {
                this.Stauts = CashType.Success;
            }
            else
            {
                this.Stauts = CashType.Wait;
            }
        }
Example #29
0
        /// <summary>
        /// returns the Version byte for base58 formats
        /// </summary>
        /// <param name="format"></param>
        /// <param name="network"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private static byte GetVersionByte(CashFormat format, CashNetwork network, CashType type)
        {
            switch (format)
            {
            case CashFormat.Legacy:
                if (network == CashNetwork.Mainnet && type == CashType.P2PKH)
                {
                    return(0);
                }
                else if (network == CashNetwork.Mainnet && type == CashType.P2SH)
                {
                    return(5);
                }
                break;

            case CashFormat.Bitpay:
                if (network == CashNetwork.Mainnet && type == CashType.P2PKH)
                {
                    return(28);
                }
                else if (network == CashNetwork.Mainnet && type == CashType.P2SH)
                {
                    return(40);
                }
                break;
            }
            if (network == CashNetwork.Testnet && type == CashType.P2PKH)
            {
                return(111);
            }
            else if (network == CashNetwork.Testnet && type == CashType.P2SH)
            {
                return(196);
            }
            else if (network == CashNetwork.RegTest && type == CashType.P2PKH)
            {
                return(111);
            }
            else if (network == CashNetwork.RegTest && type == CashType.P2SH)
            {
                return(196);
            }
            throw new Validation.ValidationError("Invalid parameters");
        }
Example #30
0
        /// <summary>
        /// 查询提现记录的列表
        /// </summary>
        /// <param name="cash_type">金钻还是银钻</param>
        /// <param name="cash_status">状态</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="page">页码</param>
        /// <param name="rows">条数</param>
        /// <returns></returns>
        public ActionResult SelectCashRecordList(int?cash_type, int?cash_status, DateTime?beginTime, DateTime?endTime, int page = 1, int rows = 20)
        {
            var userId = int.Parse(User.Identity.Name);

            var pageData = this.userManager.GetCashRequests(userId, null, null, cash_type, cash_status, beginTime, endTime, page, rows);

            var data = pageData.Select(c => new
            {
                user_id        = c.user_id,
                cash_type      = CashType.ToString(c.cash_type),
                cash_money     = c.cash_money,
                cash_status    = CashStatus.ToString(c.cash_status),
                cash_time1     = c.cash_time1.ToString("yyyy-MM-dd HH:mm:ss"),
                cash_record_id = c.cash_record_id
            });
            var total = this.userManager.GetCashRequestsTotal(userId, null, null, cash_type, cash_status, beginTime, endTime);

            return(Json(new { total = total, rows = data }));
        }