Esempio n. 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(TblPayments).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblPaymentsExists(TblPayments.PaymentId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(TblFinancialBalance).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblFinancialBalanceExists(TblFinancialBalance.BusinessId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            Message = "اطلاعات به روز شد.";
            TabPage = "payment";
            return(RedirectToPage("./Index"));
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.TblMembers.Add(TblMembers);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Esempio n. 4
0
        public async Task <IActionResult> OnPostAsync(IFormFile Binary, string Subject, string Description)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            try
            {
                var res = await Services.Upload(Binary);

                TblBinarys binarys = new TblBinarys
                {
                    Subject     = Subject,
                    Ddate       = Services.ToShamsi(DateTime.Now.Date),
                    Description = Description,
                    FileFormat  = Path.GetExtension(Binary.FileName).Replace(".", ""),
                    Binary      = res
                };
                _context.TblBinarys.Add(binarys);
                await _context.SaveChangesAsync();

                var member = _context.TblMembers.SingleOrDefault(m => m.MemberId == Services.UserMemberId);
                member.BinaryIds      += binarys.BinaryId + ",";
                Services.CurrentMember = member;
                _context.TblMembers.Update(member);
                await _context.SaveChangesAsync();

                ViewData["OnTab"] = "upload";
                Message           = "مدرک '" + Subject + "' ثبت شد.";
                return(Redirect("./Index"));
            }
            catch (Exception ex)
            {
                Message = ex.Message;
                return(Redirect("./Index"));
            }
        }
Esempio n. 5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            TblFinancialBalance.SystemCode = Services.UserMemberId;
            TblFinancialBalance.CodeYekta  = Services.CurrentMember.کدیکتا;
            TblFinancialBalance.CreateTime = DateTime.Now;
            _context.TblFinancialBalances.Add(TblFinancialBalance);
            await _context.SaveChangesAsync();

            Message = "اطلاعات مالی با موفقیت ثبت شد.";
            TabPage = "payment";
            return(RedirectToPage("./Index"));
        }
Esempio n. 6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TblFinancialBalance = await _context.TblFinancialBalances.FindAsync(id);

            if (TblFinancialBalance != null)
            {
                _context.TblFinancialBalances.Remove(TblFinancialBalance);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TblOfficeMember = await _context.TblOfficeMembers.FindAsync(id);

            if (TblOfficeMember != null)
            {
                _context.TblOfficeMembers.Remove(TblOfficeMember);
                await _context.SaveChangesAsync();
            }
            Error   = "اطلاعات عضو حذف شد.";
            TabPage = "payment";
            return(RedirectToPage("../FinancialBalance/Index"));
        }
Esempio n. 8
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TblBinarys = await _context.TblBinarys.FindAsync(id);

            if (TblBinarys != null)
            {
                _context.TblBinarys.Remove(TblBinarys);
                await _context.SaveChangesAsync();
            }
            TabPage = "upload";
            Message = "مدرک  '" + TblBinarys.Subject + "' حذف شد.";
            return(RedirectToPage("./Index"));
        }
Esempio n. 9
0
        public async Task <IActionResult> OnPostAsync(IFormFile Binary, string Subject)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Binary != null)
            {
                var res = await Services.Upload(Binary);

                tblBinarys.Binary     = res;
                tblBinarys.FileFormat = Path.GetExtension(Binary.FileName).Replace(".", "");
            }
            tblBinarys.Subject = Subject;
            _context.Attach(tblBinarys).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            ViewData["OnTab"]   = "upload";
            TabPage             = "upload";
            Message             = "مدرک '" + tblBinarys.Subject + "' ویرایش شد.";
            TempData["Message"] = "مدرک '" + tblBinarys.Subject + "' ویرایش شد.";
            try
            {
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblBinarysExists(tblBinarys.BinaryId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(RedirectToPage("./Index"));
        }
Esempio n. 10
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (User.Identity.IsAuthenticated)
            {
                if (!ModelState.IsValid)
                {
                    return(Page());
                }
                if (await Services.CheckDuplicate(_context, tblOfficeMember.ShMelli))
                {
                    Error   = "این عضو قبلا اضافه شده است.";
                    TabPage = "payment";
                    return(RedirectToPage("../FinancialBalance/Index"));
                }
                tblOfficeMember.SystemCode = Services.UserMemberId;
                _context.TblOfficeMembers.Add(tblOfficeMember);
                await _context.SaveChangesAsync();

                Message = "عضو جدید اضافه شد";
                TabPage = "payment";
                return(RedirectToPage("../FinancialBalance/Index"));
            }
            return(RedirectToPage("/Index"));
        }
Esempio n. 11
0
        public async Task <IActionResult> OnPostAsync(int?yesno3, int?yesno4)
        {
            try
            {
                TblQuestionnaire Questionnaire = new TblQuestionnaire
                {
                    Question1     = tblQuestionnaire.Question1,
                    Question11    = tblQuestionnaire.Question11,
                    Question12    = tblQuestionnaire.Question12,
                    Question13    = tblQuestionnaire.Question13,
                    Question14    = tblQuestionnaire.Question14,
                    Question2     = tblQuestionnaire.Question2,
                    Question3Disp = tblQuestionnaire.Question3Disp,
                    Question4Disp = tblQuestionnaire.Question4Disp,
                    Question5     = tblQuestionnaire.Question5,
                    CreateTime    = DateTime.Now
                };
                if (yesno3 == 1)
                {
                    Questionnaire.Question3 = "بلی";
                }
                else
                {
                    Questionnaire.Question3 = "خیر";
                }
                if (yesno4 == 1)
                {
                    Questionnaire.Question4 = "بلی";
                }
                else
                {
                    Questionnaire.Question4 = "خیر";
                }

                Questionnaire.SystemCode = Services.UserMemberId;
                Questionnaire.CodeYekta  = Services.CurrentMember.کدیکتا;
                Questionnaire.Qid        = tblQuestionnaire.Qid;
                Qid = tblQuestionnaire.Qid;
                if (Qid == null || Qid == 0)
                {
                    _context.TblQuestionnaires.Update(Questionnaire);
                }
                else
                {
                    _context.Attach(Questionnaire).State = EntityState.Modified;
                }

                await _context.SaveChangesAsync();

                TempData["TabPage"] = "question";
                TempData["Message"] = "پرسشنامه ذخیره شد.";
                return(RedirectToPage("/Questionnaire/Index"));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblQuestionnaireExists(tblQuestionnaire.Qid))
                {
                    TempData["TabPage"] = "question";
                    TempData["Error"]   = "خطا.";
                    return(RedirectToPage("/Questionnaire/Index"));
                }
                else
                {
                    throw;
                }
            }
        }
Esempio n. 12
0
        public async Task <IActionResult> OnPostAsync(int?id, string کمیسیونفرعی2, string کمیسیونفرعی1, int?city, int?province)
        {
            if (!ModelState.IsValid)
            {
                var errorList = ModelState.Values.SelectMany(v => v.Errors).ToList();
                foreach (var e in errorList)
                {
                    TempData["message"] = e.ErrorMessage;
                }
                return(Page());
            }
            if (id == null || tblMembers == null)
            {
                return(NotFound());
            }

            try
            {
                var member = Services.CurrentMember;
                member.آدرس         = tblMembers.آدرس;
                member.کداستان      = province;
                member.کدشهرستان    = city;
                member.شهر          = tblMembers.شهر;
                member.کدپستی       = tblMembers.کدپستی;
                member.تلفنمغازه    = tblMembers.تلفنمغازه;
                member.فکسمغازه     = tblMembers.فکسمغازه;
                member.وبسایت       = tblMembers.وبسایت;
                member.تعدادکارکنان = tblMembers.تعدادکارکنان;
                member.رسته         = tblMembers.رسته;
                if (کمیسیونفرعی1 != null || کمیسیونفرعی2 != null)
                {
                    member.کمیسیونفرعی = "";
                }
                if (member.کمیسیونفرعی != null)
                {
                    if (member.کمیسیونفرعی.TrimEnd() != ",")
                    {
                        member.کمیسیونفرعی += "," + کمیسیونفرعی1;
                    }
                }
                else
                {
                    member.کمیسیونفرعی = کمیسیونفرعی1;
                }
                if (member.کمیسیونفرعی.TrimEnd() != ",")
                {
                    member.کمیسیونفرعی += "," + کمیسیونفرعی2;
                }
                else
                {
                    member.کمیسیونفرعی += کمیسیونفرعی2;
                }
                _context.TblMembers.Update(member);
                await _context.SaveChangesAsync();

                Services.CurrentMember = tblMembers;
                TempData["message"]    = "اطلاعات صنفی شما ثبت گردید";
                ViewData["OnTab"]      = "facilities";
                return(RedirectToPage("/SenfiDetails/Index"));
            }
            catch (Exception ex)
            {
                TempData["Erorr"] = ex.Message.ToString();
                ViewData["OnTab"] = "facilities";
                return(RedirectToPage("/SenfiDetails/Index"));
            }
        }