Пример #1
0
        // Seed the program with some sample data.
        // For a real application, the customer would be created from
        // another form and start with zero balances.
        private static Customer createCustomer()
        {
            Customer customer = new Customer();

            customer.FirstName = "Freida";
            customer.LastName  = "Franklin";

            decimal        savingsAccountBalance = 2000m;
            SavingsAccount savingsAccount        = new SavingsAccount(savingsAccountBalance);

            customer.AddBankAccount(savingsAccount);

            decimal    creditLimit        = 10000m;
            decimal    creditLimitBalance = -3456m;
            CreditLine creditLineAccount  = new CreditLine(creditLimit, creditLimitBalance);

            customer.AddBankAccount(creditLineAccount);

            decimal        savingsAccountBalance2 = 3502m;
            SavingsAccount savingsAccount2        = new SavingsAccount(savingsAccountBalance2);

            customer.AddBankAccount(savingsAccount2);


            return(customer);
        }
Пример #2
0
        public void SetUp()
        {
            CreditLineDt  = new CreditLineDt();
            _mockedCredit = new Mock <ICredit>();

            BaseCreditLine = _creditLine = new CreditLine(_mockedCredit.Object, CreditLineDt);
        }
Пример #3
0
        //需要调用窗体名称
        System.Windows.Forms.Control INetUserControl.CreateControl(UFSoft.U8.Framework.Login.UI.clsLogin login, string MenuID, string Paramters)
        {
            UFSoft.U8.Framework.LoginContext.UserData LoginInfo = new UFSoft.U8.Framework.LoginContext.UserData();
            LoginInfo = login.GetLoginInfo();
            string conn = LoginInfo.ConnString;

            conn = Utils.ConvertConn(conn);
            DbHelperSQL.connectionString = conn;

            string sLogUserid   = LoginInfo.UserId;
            string sLogUserName = LoginInfo.UserName;
            string sLogDate     = LoginInfo.operDate;
            string sAccID       = LoginInfo.AccID;

            ClsUserRight clsUser = new ClsUserRight();

            if (clsUser.chkRight(login, "TH_9"))
            {
                CreditLine fm = new CreditLine();
                fm.Conn      = conn;
                fm.sUserID   = sLogUserid;
                fm.sUserName = sLogUserName;
                fm.sLogDate  = sLogDate;
                fm.sAccID    = sAccID;

                this._Title = "Credit Line";

                return(fm);
            }
            else
            {
                MessageBox.Show("no rights");
                return(null);
            }
        }
Пример #4
0
    public void beginCredits()
    {
        if (!started)
        {
            // Sanitize input
            speed = Mathf.Clamp(speed, 50, 1000);

            // Calculate margin
            height = (int)GetComponent <RectTransform>().rect.height;

            // Load from XML and calculate position
            XmlReader reader = XmlReader.Create(new StringReader(creditsFile.text));
            while (reader.ReadToFollowing("credit"))
            {
                CreditType type  = CreditType.EmptySpace;
                string     data  = "";
                string     data2 = "";

                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == "type")
                    {
                        type = CreditLine.textToType(reader.Value);
                    }
                    else if (reader.Name == "data")
                    {
                        data = reader.Value;
                    }
                    else if (reader.Name == "data2")
                    {
                        data2 = reader.Value;
                    }
                }

                if (type == CreditType.EmptySpace)
                {
                    int n = Mathf.Clamp(int.Parse(data), 1, 100);
                    for (int i = 0; i < n; ++i)
                    {
                        lines.Add(new CreditLine(CreditType.EmptySpace, "", ""));
                    }
                }
                else
                {
                    lines.Add(new CreditLine(type, data, data2));
                }
            }

            count = lines.Count;

            // Start
            started = true;
            spawnNext();
        }
    }
Пример #5
0
        // If the account is a credit line, get the credit limit; otherwise show "N/A"
        public static string accountCreditDisplay(BankAccount account)
        {
            string     display    = "N/A";
            CreditLine creditLine = account as CreditLine;

            if (creditLine != null)
            {
                display = creditLine.CreditLimit.ToString("N2");
            }
            return(display);
        }
        public IActionResult GetCreditLine(ProductIdRequest request)
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <CreditLine>()
                {
                    ResultCode = ResultCodes.normal
                };
                response.Result = _xbService.GetCreditLine(request.ProductId);
                response.Result.HasContractFile = _xbService.HasUploadedContract(response.Result.LoanAccount.AccountNumber, 1);
                List <CreditLineGrafik> grafik = _xbService.GetCreditLineGrafik((ulong)response.Result.ProductId);
                if (grafik.Count != 0)
                {
                    grafik.Sort((x, y) => x.EndDate.CompareTo(y.EndDate));
                    var selectedRow = grafik.Find(x => x.EndDate >= _xbService.GetNextOperDay() && x.Amount - x.MaturedAmount > 0);

                    if (selectedRow != null)
                    {
                        response.Result.NextRepaymentAmount = selectedRow.Amount - selectedRow.MaturedAmount;
                        response.Result.NextRepaymentDate   = selectedRow.EndDate;
                    }
                }
                //վարտային վարկային քիժ
                if (response.Result.ConnectAccount.AccountType == 11)
                {
                    response.Result.CardSystem = _xbService.GetCardByCardNumber(response.Result.CardNumber).CardSystem;
                }
                //Քարտային վարկային գիծ
                if (response.Result.ConnectAccount.AccountType == 11)
                {
                    response.Result.LoanAccount.CardSystem = _xbService.GetCardByCardNumber(response.Result.LoanAccount.ProductNumber).CardSystem;
                }

                response.Result.TotalDebt = Math.Abs(response.Result.Quality == 11 || response.Result.Quality == 12 ? response.Result.OutCapital : response.Result.CurrentCapital)
                                            + Math.Abs(response.Result.CurrentRateValue) + Math.Abs(response.Result.PenaltyAdd) + response.Result.JudgmentRate;
                if ((!string.IsNullOrWhiteSpace(response.Result.CardNumber)) && response.Result.CardNumber != "0")
                {
                    CreditLine overdraft = _xbService.GetCardOverDraft(response.Result.CardNumber);
                    response.Result.CardOverdraft = Math.Abs(overdraft.Quality == 11 || overdraft.Quality == 12 ? overdraft.OutCapital : overdraft.CurrentCapital)
                                                    + Math.Abs(overdraft.CurrentRateValue) + Math.Abs(overdraft.PenaltyAdd) + overdraft.JudgmentRate;
                    response.Result.TotalDebt += response.Result.CardOverdraft;
                }

                response.Result.PenaltyAdd -= response.Result.JudgmentRate;

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
        public IActionResult GetCreditLines(ProductQualityFilterRequest request)
        {
            if (ModelState.IsValid)
            {
                SingleResponse <List <CreditLine> > response = new SingleResponse <List <CreditLine> >();
                response.Result = _xbService.GetCreditLines(request.Filter);
                response.Result.RemoveAll(m => m.Type == 25 || m.Type == 18 || m.Type == 46 || m.Type == 36 || m.Type == 60);
                Parallel.ForEach(response.Result, x => x.HasContractFile = _xbService.HasUploadedContract(x.LoanAccount.AccountNumber, 1));
                Parallel.ForEach(response.Result, item =>
                {
                    List <CreditLineGrafik> grafik = _xbService.GetCreditLineGrafik((ulong)item.ProductId);
                    if (grafik.Count != 0)
                    {
                        grafik.Sort((x, y) => x.EndDate.CompareTo(y.EndDate));
                        var selectedRow = grafik.Find(x => x.EndDate >= _xbService.GetNextOperDay() && x.Amount - x.MaturedAmount > 0);

                        if (selectedRow != null)
                        {
                            item.NextRepaymentAmount = selectedRow.Amount - selectedRow.MaturedAmount;
                            item.NextRepaymentDate   = selectedRow.EndDate;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(item.CardNumber))
                    {
                        item.CardSystem = _xbService.GetCardSystem(item.CardNumber);
                    }
                    if (!string.IsNullOrWhiteSpace(item.LoanAccount.ProductNumber))
                    {
                        item.LoanAccount.CardSystem = _xbService.GetCardSystem(item.LoanAccount.ProductNumber);
                    }

                    item.TotalDebt = Math.Abs(item.Quality == 11 || item.Quality == 12 ? item.OutCapital : item.CurrentCapital)
                                     + Math.Abs(item.CurrentRateValue) + Math.Abs(item.PenaltyAdd) + item.JudgmentRate;
                    if ((!string.IsNullOrWhiteSpace(item.CardNumber)) && item.CardNumber != "0")
                    {
                        CreditLine overdraft = _xbService.GetCardOverDraft(item.CardNumber);
                        item.CardOverdraft   = Math.Abs(overdraft.Quality == 11 || overdraft.Quality == 12 ? overdraft.OutCapital : overdraft.CurrentCapital)
                                               + Math.Abs(overdraft.CurrentRateValue) + Math.Abs(overdraft.PenaltyAdd) + overdraft.JudgmentRate;
                        item.TotalDebt += item.CardOverdraft;
                    }

                    item.PenaltyAdd -= item.JudgmentRate;
                });
                response.ResultCode = ResultCodes.normal;
                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }
 public IActionResult GetCreditLineStatement(LoanStatementRequest request)
 {
     if (ModelState.IsValid)
     {
         var response = new SingleResponse <LoanStatement>()
         {
             ResultCode = ResultCodes.normal
         };
         CreditLine creditLine = _xbService.GetCreditLine(request.ProductId);
         response.Result = _xbService.GetLoanStatement(creditLine.LoanAccount.AccountNumber, request.DateFrom, request.DateTo, request.MinAmount, request.MaxAmount, request.DebCred, request.TransactionsCount, request.OrderByAscDesc);
         return(ResponseExtensions.ToHttpResponse(response));
     }
     else
     {
         return(ValidationError.GetValidationErrorResponse(ModelState));
     }
 }
    void saveFile()
    {
        // Lazy try-catching :(
        try
        {
            XmlDocument doc     = new XmlDocument();
            XmlNode     docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);
            XmlNode creditsNode = doc.CreateElement("credits");
            doc.AppendChild(creditsNode);

            XmlNode      creditNode;
            XmlAttribute attrType;
            XmlAttribute attrData;
            XmlAttribute attrData2;
            for (int i = 0; i < lines.Count; i++)
            {
                creditNode      = doc.CreateElement("credit");
                attrType        = doc.CreateAttribute("type");
                attrType.Value  = CreditLine.typeToText(lines[i].type);
                attrData        = doc.CreateAttribute("data");
                attrData.Value  = lines[i].data;
                attrData2       = doc.CreateAttribute("data2");
                attrData2.Value = lines[i].data2;
                creditNode.Attributes.Append(attrType);
                creditNode.Attributes.Append(attrData);
                creditNode.Attributes.Append(attrData2);
                creditsNode.AppendChild(creditNode);
            }

            doc.Save(currentFile);
            AssetDatabase.Refresh();
            this.ShowNotification(new GUIContent("Credits saved."));

            // Save the directory
            EditorPrefs.SetString("credits_folder", Path.GetDirectoryName(currentFile));
        }
        catch
        {
            this.ShowNotification(new GUIContent("Error while saving."));
        }
    }
Пример #10
0
        public async Task <SingleResponse <byte[]> > PrintCreditLineStatement(ulong productId, DateTime dateFrom, DateTime dateTo, int lang, string exportFormat = "pdf")
        {
            SingleResponse <byte[]> response = new SingleResponse <byte[]>();
            CreditLine creditLine            = _xBService.GetCreditLine(productId);
            string     account = creditLine.LoanAccount.AccountNumber.ToString();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add(key: "account", value: account);
            parameters.Add(key: "start_date", value: dateFrom.ToString("dd/MMM/yy"));
            parameters.Add(key: "end_date", value: dateTo.ToString("dd/MMM/yy"));
            parameters.Add(key: "filial_code", value: "22000");
            parameters.Add(key: "lang_id", value: lang.ToString());
            string path     = $"/{_reportName}/Loan_Statment";
            string fileName = "CreditLineStatement";

            response.Result = await _reportService.RenderReport(path, parameters, ReportService.GetExportFormatEnumeration(exportFormat), fileName);

            response.ResultCode = ResultCodes.normal;
            return(response);
        }
    void openFile(string filename = "")
    {
        // Lazy try-catching :(
        try
        {
            if (filename == "")
            {
                filename = EditorUtility.OpenFilePanel("Open Credits file", EditorPrefs.GetString("credits_folder", ""), "xml");
            }
            if (filename != "")
            {
                // Clear precedent info
                lines.Clear();
                currentFile     = filename;
                currentFilename = Path.GetFileName(currentFile);

                // Load XML
                string      content = File.ReadAllText(filename);
                XmlDocument root    = new XmlDocument();
                root.LoadXml(content);

                // Read credits
                foreach (XmlNode node in root.SelectNodes("credits/credit"))
                {
                    CreditType type  = CreditLine.textToType(node.Attributes.GetNamedItem("type").Value);
                    string     data  = node.Attributes.GetNamedItem("data").Value;
                    string     data2 = node.Attributes.GetNamedItem("data2").Value;
                    lines.Add(new CreditLine(type, data, data2));
                }

                // Save the directory
                EditorPrefs.SetString("credits_folder", Path.GetDirectoryName(filename));
            }
        }
        catch
        {
            lines.Clear();
            currentFile = "";
            this.ShowNotification(new GUIContent("Incorrect file."));
        }
    }
Пример #12
0
    public void spawnNext()
    {
        if (lines.Count > 0)
        {
            CreditLine line = lines[0];
            lines.RemoveAt(0);            // Done here because this will remove recursive bugs that doesn't exists.

            if (line.type == CreditType.EmptySpace)
            {
                GameObject g = Instantiate(prefabEmptySpace);
                g.GetComponent <RectTransform>().SetParent(transform, false);
                g.GetComponent <CreditLineInstanceSpace>().go(line.data, line.data2, height, speed, fadeTime);
            }
            else if (line.type == CreditType.Title)
            {
                GameObject g = Instantiate(prefabTitle);
                g.GetComponent <RectTransform>().SetParent(transform, false);
                g.GetComponent <CreditLineInstanceTitle>().go(line.data, line.data2, height, speed, fadeTime);
            }
            else if (line.type == CreditType.SingleColumn)
            {
                GameObject g = Instantiate(prefabSingleColumn);
                g.GetComponent <RectTransform>().SetParent(transform, false);
                g.GetComponent <CreditLineInstanceSingleColumn>().go(line.data, line.data2, height, speed, fadeTime);
            }
            else if (line.type == CreditType.TwoColumns)
            {
                GameObject g = Instantiate(prefabTwoColumns);
                g.GetComponent <RectTransform>().SetParent(transform, false);
                g.GetComponent <CreditLineInstanceTwoColumns>().go(line.data, line.data2, height, speed, fadeTime);
            }
            else if (line.type == CreditType.Image)
            {
                GameObject g = Instantiate(prefabImage);
                g.GetComponent <RectTransform>().SetParent(transform, false);
                g.GetComponent <CreditLineInstanceImage>().go(line.data, line.data2, height, speed, fadeTime);
            }
        }
    }
Пример #13
0
    public void beginCredits()
    {
        // Sanitize input
        if (speed <= 0)
        {
            speed = 50;
        }

        // Calculate margin & fade %
        if (marginPercent < 0)
        {
            marginPercent = 0;
        }
        if (marginPercent > 45)
        {
            marginPercent = 45;
        }
        if (fadePercent < 0)
        {
            fadePercent = 0;
        }
        if (fadePercent > 50 - marginPercent)
        {
            fadePercent = 50 - marginPercent;
        }
        marginTop = (int)(Screen.height * marginPercent * 0.01);
        fadeTop   = (int)(marginTop + Screen.height * fadePercent * 0.01);
        marginBot = Screen.height - marginTop;
        fadeBot   = Screen.height - fadeTop;

        // Get font line height
        int lineHeight   = (int)baseSkin.label.CalcHeight(new GUIContent("lp"), Screen.width) + 1;
        int originalSize = baseSkin.label.fontSize;

        baseSkin.label.fontSize = titleSize;
        int lineTitleHeight = (int)baseSkin.label.CalcHeight(new GUIContent("lp"), Screen.width) + 1;

        baseSkin.label.fontSize = originalSize;

        // Starting Y
        int y = Screen.height + lineSpacing;

        // Min position
        minPosition = Mathf.Max(lineHeight, lineTitleHeight);

        // Helpers
        int screenWidth = Screen.width;
        int middle      = (int)(screenWidth * 0.5f);

        // Load from XML and calculate position
        XmlDocument root = new XmlDocument();

        root.LoadXml(creditsFile.text);
        foreach (XmlNode node in root.SelectNodes("credits/credit"))
        {
            CreditType type  = CreditLine.textToType(node.Attributes.GetNamedItem("type").Value);
            string     data  = node.Attributes.GetNamedItem("data").Value;
            string     data2 = node.Attributes.GetNamedItem("data2").Value;

            if (type == CreditType.EmptySpace)
            {
                int v = 1;
                try{ v = int.Parse(data); }catch {}
                y += v * (lineHeight + lineSpacing);
            }
            else if (type == CreditType.Image)
            {
                CreditText line = new CreditText();
                line.type    = CreditTextType.Image;
                line.texture = Resources.Load(data, typeof(Texture2D)) as Texture2D;
                if (line.texture != null)
                {
                    line.position = new Rect(middle - (line.texture.width / 2), y, line.texture.width, line.texture.height);
                    lines.Add(line);
                    y += line.texture.height + lineSpacing;
                }

                // Min/Max
                if (minPosition < line.texture.height)
                {
                    minPosition = line.texture.height;
                }
            }
            else if (type == CreditType.SingleColumn)
            {
                CreditText line = new CreditText();
                line.type     = CreditTextType.SingleColumn;
                line.text     = data;
                line.position = new Rect(0, y, screenWidth, lineHeight);
                lines.Add(line);
                y += lineHeight + lineSpacing;
            }
            else if (type == CreditType.Title)
            {
                CreditText line = new CreditText();
                line.type     = CreditTextType.Title;
                line.text     = data;
                line.position = new Rect(0, y, screenWidth, lineTitleHeight);
                lines.Add(line);
                y += lineTitleHeight + lineSpacing;
            }
            else if (type == CreditType.TwoColumns)
            {
                CreditText line = new CreditText();
                line.type     = CreditTextType.TwoColumnHeader;
                line.text     = data;
                line.position = new Rect(0, y, middle - 20, lineHeight);
                CreditText line2 = new CreditText();
                line2.type     = CreditTextType.TwoColumnText;
                line2.text     = data2;
                line2.position = new Rect(middle + 20, y, middle - 20, lineHeight);
                lines.Add(line);
                lines.Add(line2);
                y += lineHeight + lineSpacing;
            }
        }

        // Start
        started    = true;
        startTime  = Time.time;
        lastUpdate = startTime;
    }
    // The GUI
    void OnGUI()
    {
        if (!init)
        {
            initGUI();
        }

        // Super silly: Create an empty textfield to give focus when we will move lines.
        GUI.SetNextControlName("sillydummytextfield");
        EditorGUI.TextField(new Rect(-10, -10, 0, 0), "");

        // Top
        if (GUI.Button(iconNewRect, iconNew, buttonLeft))
        {
            EditorGUI.FocusTextInControl("sillydummytextfield");
            newFile();
        }
        if (GUI.Button(iconOpenRect, iconOpen, buttonRight))
        {
            EditorGUI.FocusTextInControl("sillydummytextfield");
            openFile();
        }
        if (currentFile != "")
        {
            if (GUI.Button(iconSaveRect, iconSave, buttonLeft))
            {
                EditorGUI.FocusTextInControl("sillydummytextfield");
                saveFile();
            }
            if (GUI.Button(iconAddRect, iconAdd, buttonRight))
            {
                EditorGUI.FocusTextInControl("sillydummytextfield");
                addLine();
            }
        }

        // Central
        if (currentFile != "")
        {
            // Display current line
            GUI.Label(new Rect(165, 12, 200, 20), "File: " + currentFilename);

            // Lines
            scrollPos = GUI.BeginScrollView(new Rect(0, 45, position.width, position.height - 45), scrollPos, new Rect(0, 0, position.width - 15, 10 + (25 * lines.Count)));
            for (int i = 0; i < lines.Count; i++)
            {
                lines[i].type = (CreditType)EditorGUI.EnumPopup(new Rect(10, 10 + (i * 25), 110, 17), "", lines[i].type);

                if (lines[i].type == CreditType.TwoColumns)
                {
                    lines[i].data  = EditorGUI.TextField(new Rect(130, 10 + (i * 25), (position.width - 298) / 2, 17), lines[i].data, styleright);
                    lines[i].data2 = EditorGUI.TextField(new Rect(130 + ((position.width - 298) / 2) + 10, 10 + (i * 25), (position.width - 298) / 2, 17), lines[i].data2);
                }
                else if (lines[i].type == CreditType.EmptySpace)
                {
                    int v = 1;
                    try{ v = int.Parse(lines[i].data); }catch {}
                    lines[i].data = "" + EditorGUI.IntField(new Rect(130, 10 + (i * 25), position.width - 288, 17), "Empty lines:", v);
                }
                else
                {
                    lines[i].data = EditorGUI.TextField(new Rect(130, 10 + (i * 25), position.width - 288, 17), lines[i].data, stylecenter);
                }

                if (i > 0 && GUI.Button(new Rect(position.width - 148, 8 + (i * 25), 27, 21), iconUp))
                {
                    EditorGUI.FocusTextInControl("sillydummytextfield");
                    CreditLine line = lines[i];
                    lines.RemoveAt(i);
                    lines.Insert(i - 1, line);
                    return;
                }
                if (i < lines.Count - 1)
                {
                    if (GUI.Button(new Rect(position.width - 116, 8 + (i * 25), 27, 21), iconDown))
                    {
                        EditorGUI.FocusTextInControl("sillydummytextfield");
                        CreditLine line = lines[i];
                        lines.RemoveAt(i);
                        lines.Insert(i + 1, line);
                        return;
                    }
                }
                if (GUI.Button(new Rect(position.width - 84, 8 + (i * 25), 27, 21), iconAdd))
                {
                    EditorGUI.FocusTextInControl("sillydummytextfield");
                    lines.Insert(i, new CreditLine(CreditType.TwoColumns, "", ""));
                    return;
                }
                if (GUI.Button(new Rect(position.width - 52, 8 + (i * 25), 27, 21), iconDelete))
                {
                    EditorGUI.FocusTextInControl("sillydummytextfield");
                    lines.RemoveAt(i); return;
                }
            }
            GUI.EndScrollView();
        }
    }