Esempio n. 1
0
        public async Task <IActionResult> Step1End(int id, Ins_BiznesOverdraft model, List <Ins_BiznesOverdraft_DovrueList> dovrueLists)
        {
            #region reportcreate
            LocalReport report = new LocalReport(Path.Combine(Environment.WebRootPath, "report", "Report1.rdlc"));
            Dictionary <string, string> parametrs = new Dictionary <string, string>();
            parametrs.Add("Name", model.Name);
            parametrs.Add("Amount", model.Amount.ToString());
            var result = report.Execute(RenderType.Pdf, parameters: parametrs);
            #endregion
            #region fileCreate
            var filename = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss-Muqavile") + ".pdf";
            using (var fs = new FileStream(Path.Combine(Environment.WebRootPath, "documents", filename), FileMode.OpenOrCreate))
            {
                using var stream = new MemoryStream(result.MainStream);
                await stream.CopyToAsync(fs);
            }
            #endregion
            #region UpdateIns
            string   dovryeJson = JsonConvert.SerializeObject(dovrueLists);
            string[] names      = { "Name", "Rate",     "Voen", "Amount",
                                    "Aylar",     "BranchId", "Cif",  "DovruyyeNovu","DovruyelerJson", "FileNames" };
            object[] valuse = { model.Name,     model.Rate, model.Voen,         model.Amount, model.Aylar,
                                model.BranchId, model.Cif,  model.DovruyyeNovu, dovryeJson,   filename };
            var      b = Repository.Update(names, valuse, id);
            #endregion

            #region UpdateAssing
            Repository.Update <Pos_Ins_User>(
                new string[] { "Step", "InsName" }
                , new object[] { "Step2", $"BiznesOverdarft/{model.Name}/{model.Cif}" }
                , Repository.GetPosInsId(id));
            #endregion
            return(Step2(id));
        }
Esempio n. 2
0
        public IActionResult Start()
        {
            #region CreateInstance
            var inistance = new Ins_BiznesOverdraft
            {
                InitiatorId   = getUserId(),
                ResponsibleId = getUserId(),
                StartDate     = DateTime.Now,
                Status        = ProcessStatus.Active,
            };
            #region addMounrs inistance.DovruyeList
            var e = Enumerable.Range(0, 6).Select(x => DateTime.Now.AddMonths(x - 6).ToString("dd-MM-yyyy")).ToList();
            e.ForEach(x => inistance.Dovruyeler.Add(new Ins_BiznesOverdraft_DovrueList {
                Date = x
            }));
            inistance.DovruyelerJson = JsonConvert.SerializeObject(inistance.Dovruyeler);
            #endregion
            var(id, b) = Repository.Insert(inistance);
            if (b !)
            {
                RedirectToAction("Index", "Home");
            }
            #endregion

            #region assingcreate
            Repository.Insert(new Pos_Ins_User
            {
                PosesName = "BiznesOverdraft",
                InsName   = "BiznesOverdraft/",
                Role      = "Kad",
                ProsessId = id,
                Step      = "Step1",
                UserId    = getUserId(),
                Active    = true
            });
            #endregion
            return(Step1(id));
        }