Files
Backend-Api/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs
2025-05-10 20:29:08 +03:30

1081 lines
44 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.EmployeeAgg;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InsuranceList;
using CompanyManagment.App.Contracts.InsuranceWorkshopInfo;
using CompanyManagment.App.Contracts.Job;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.YearlySalary;
using MD.PersianDateTime.Standard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using SocialExplorer.IO.FastDBF;
namespace ServiceHost.Areas.Admin.Pages.Company.InsuranceList;
[Authorize]
public class IndexModel : PageModel
{
private readonly IEmployeeApplication _employeeApplication;
private readonly IEmployerApplication _employerApplication;
private readonly IInsuranceListApplication _insuranceListApplication;
private readonly IInsuranceWorkshopInfoApplication _insuranceWorkshopInfoApplication;
private readonly IJobApplication _jobApplication;
//private readonly IInsuranceEmployeeInfoApplication _insuranceEmployeeInfoApplication;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly IWorkshopApplication _workshopApplication;
private readonly IYearlySalaryApplication _yearlySalaryApplication;
public string BeforCurrentMonth_;
public string CurrentYear_;
public string EmployerFullName;
public InsuranceListSearchModel searchModel;
public string WorkshopFullName;
public List<string> YearlyList;
public IndexModel(IInsuranceListApplication insuranceListApplication, IWorkshopApplication workshopApplication,
IYearlySalaryApplication yearlySalaryApplication, IEmployerApplication employerApplication,
IInsuranceWorkshopInfoApplication insuranceWorkshopInfoApplication, IEmployeeApplication employeeApplication,
IJobApplication jobApplication,
IWebHostEnvironment webHostEnvironment) // , IInsuranceEmployeeInfoApplication insuranceEmployeeInfoApplication )
{
_jobApplication = jobApplication;
_insuranceListApplication = insuranceListApplication;
_workshopApplication = workshopApplication;
_yearlySalaryApplication = yearlySalaryApplication;
_employerApplication = employerApplication;
_insuranceWorkshopInfoApplication = insuranceWorkshopInfoApplication;
_employeeApplication = employeeApplication;
//_insuranceEmployeeInfoApplication = insuranceEmployeeInfoApplication;
_webHostEnvironment = webHostEnvironment;
}
#region MainPageList
public void OnGet()
{
var date = DateTime.Now.ToFarsi();
var year = Convert.ToInt32(date.Substring(0, 4));
var month = Convert.ToInt32(date.Substring(5, 2));
var day = Convert.ToInt32(date.Substring(8, 2));
var persianDate = new PersianDateTime(year, month, day);
var persianBeforeDate = persianDate.AddMonths(-1).ToString("yyyy/MM/dd");
BeforCurrentMonth_ = persianBeforeDate.Substring(5, 2);
CurrentYear_ = persianBeforeDate.Substring(0, 4);
YearlyList = _yearlySalaryApplication.GetYears();
}
/// <summary>
/// لیستهای بیمه صفحه اصلی
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public IActionResult OnGetSearch(InsuranceListSearchModel searchModel)
{
var searchResult = _insuranceListApplication.Search(searchModel);
var result = new MainViewModel();
result.MainList = searchResult;
return Partial("./MainSearch", result);
}
#endregion
#region CreateInsurance
//-1
/// <summary>
/// دکمه ایجاد لیست بیمه
/// </summary>
/// <returns></returns>
public IActionResult OnGetCreate()
{
var date = DateTime.Now.ToFarsi();
var year = Convert.ToInt32(date.Substring(0, 4));
var month = Convert.ToInt32(date.Substring(5, 2));
var day = Convert.ToInt32(date.Substring(8, 2));
var persianDate = new PersianDateTime(year, month, day);
var persianBeforeDate = persianDate.AddMonths(-1).ToString("yyyy/MM/dd");
//کارگاه هایی نوع ارسال لیست بیمه آنها مشخص شده
var workshopList = _workshopApplication.GetWorkshopSelectListInsuransce();
var command = new CreateInsuranceList
{
WorkShopSelectList = new SelectList(workshopList, "Id", "WorkshopFullName"),
YearList = _yearlySalaryApplication.GetYears(),
//ماه قبل
BeforCurrentMonth = persianBeforeDate.Substring(5, 2),
//سال جاری
CurrentYear = persianBeforeDate.Substring(0, 4),
InsuranceWorkshopInfo = new InsuranceWorkshopInfoViewModel(),
};
return Partial("./Create", command);
}
//-2
/// <summary>
/// دریافت اطلاعات کارگاه وکارفرما برای نمایش در مودال ایجاد بیمه
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
public IActionResult OnPostGetEmployerAndWorkshopInfo(int workshopId)
{
var workshopInfo = _insuranceWorkshopInfoApplication.GetDetails(workshopId);
var employer = _employerApplication.InsuranceEmployerByWorkshopId(workshopId);
return new JsonResult(new
{
EmployerNames = employer.employerName,
WorkshopInfo = workshopInfo,
IsLegal = employer.isLegal
});
}
//-3
/// <summary>
/// لود اطلاعات پرسنل در مودال ایجاد بیمه -- DSKWOR
/// محاسبه تب پرسنل
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public IActionResult OnGetEmployeeSearch(EmployeeForCreateInsuranceListSearchModel searchModel)
{
var result = _insuranceListApplication.SearchEmployeeForCreateInsuranceList(searchModel);
return Partial("./EmployeeDatatable", result);
}
// -4
/// <summary>
/// زمان لود مودال ایجاد یا ویرایش محاسبه - DSSKAR
/// محاسبه تب کارگاه
/// </summary>
/// <param name="employeeDetailsForInsuranceList"></param>
/// <param name="typeOfInsuranceSendWorkshop"></param>
/// <returns></returns>
public IActionResult OnPostComputeInsuranceList(
List<EmployeeDetailsForInsuranceListViewModel> employeeDetailsForInsuranceList,
string typeOfInsuranceSendWorkshop)
{
double sumOfEmployees = employeeDetailsForInsuranceList.Count();
double included = 0; //مشمول
double sumOfWorkingDays = 0;
double benefitsIncludedNonContinuous = 0; //مزایای ماهانه غیر مشمول
double sumOfSalaries = 0;
double sumOfDailyWage = 0;
double insuredShare = 0;
double employerShare = 0; //سهم بیمه کارفرما
double sumOfIncluded = 0;
double unEmploymentInsurance = 0; //سهم بیمه بیکاری
double monthlyBenefits = 0; //مزایای ماهیانه
double sumForunEmploymentInsurance = 0;
double benefitsIncludedContinuous = 0;
double sumOfIncludedKarfarma = 0;
var hasKarfarma = false;
double countWithoutLeft = 0;
double sumOfBaseYears = 0;
double sumOfMarriedAllowance = 0;
double sumOfDailyWagePlusBaseYear = 0;
double sumOfBenefitIncludedAndNotIncluded = 0; //مشمول و غیر مشمول
for (var i = 0; i < employeeDetailsForInsuranceList.Count; i++)
{
var leftWorkDay = "";
if (!string.IsNullOrWhiteSpace(employeeDetailsForInsuranceList[i].LeftWorkDate))
{
leftWorkDay = employeeDetailsForInsuranceList[i].LeftWorkDate.Substring(8, 2);
if (leftWorkDay == "01")
countWithoutLeft = countWithoutLeft + 1;
else
leftWorkDay = "";
}
else
{
leftWorkDay = "";
}
//بدست آوردن جمع پایه سنواتی
var baseYear = employeeDetailsForInsuranceList[i].BaseYears *
employeeDetailsForInsuranceList[i].WorkingDays;
sumOfBaseYears += baseYear;
//بدست آوردن جمع حق تاهل
sumOfMarriedAllowance += employeeDetailsForInsuranceList[i].MarriedAllowance;
// if (employeeDetailsForInsuranceList[i].IncludeStatus && (employeeDetailsForInsuranceList[i].JobId == 10 || employeeDetailsForInsuranceList[i].JobId == 17 || employeeDetailsForInsuranceList[i].JobId == 18 || employeeDetailsForInsuranceList[i].JobId == 16))// 10 --> karfarma
if (!employeeDetailsForInsuranceList[i].IncludeStatus &&
(employeeDetailsForInsuranceList[i].JobCode == "027079" ||
employeeDetailsForInsuranceList[i].JobCode == "024398" ||
employeeDetailsForInsuranceList[i].JobCode == "011015" ||
employeeDetailsForInsuranceList[i].JobCode == "020010")) // 10 --> karfarma
{
benefitsIncludedContinuous = 0;
sumForunEmploymentInsurance = sumForunEmploymentInsurance;
}
else
{
sumForunEmploymentInsurance = sumForunEmploymentInsurance +
employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
//if (employeeDetailsForInsuranceList[i].JobId == 10)//کارفرما
if (employeeDetailsForInsuranceList[i].JobCode == "024398") //کارفرما
{
hasKarfarma = true;
sumOfIncludedKarfarma = employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
sumOfWorkingDays = sumOfWorkingDays + employeeDetailsForInsuranceList[i].WorkingDays;
sumOfDailyWage = sumOfDailyWage + employeeDetailsForInsuranceList[i].DailyWage;
sumOfSalaries = sumOfSalaries + employeeDetailsForInsuranceList[i].MonthlySalary;
monthlyBenefits = monthlyBenefits + +employeeDetailsForInsuranceList[i].MonthlyBenefits;
sumOfIncluded = sumOfIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
sumOfDailyWagePlusBaseYear += employeeDetailsForInsuranceList[i].DailyWagePlusBaseYears;
if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود
sumOfBenefitIncludedAndNotIncluded += employeeDetailsForInsuranceList[i].IncludedAndNotIncluded;
benefitsIncludedNonContinuous += employeeDetailsForInsuranceList[i].BenefitsIncludedNonContinuous;
insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare;
}
employerShare = GetRoundValueWhitGovermentlist(sumOfIncluded * 20 / 100, typeOfInsuranceSendWorkshop);
unEmploymentInsurance =
GetRoundValueWhitGovermentlist(sumForunEmploymentInsurance * 3 / 100, typeOfInsuranceSendWorkshop);
var totalEmployee = sumOfEmployees;
//sumOfEmployees = sumOfEmployees - countWithoutLeft;
#region heydari
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 5 && !hasKarfarma)
//console.log(1);
employerShare = 0;
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 6 && hasKarfarma)
{
//console.log(sumOfIncludedKarfarma);
var result = sumOfIncludedKarfarma * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft >= 6 && !hasKarfarma)
{
//ابتدا جمع کل مزایا به دست می آید
//جمع کل مزایا تقسیم بر تعداد کارگران منهای کسانی که ترک کار کرده اند.
//حاصل عبارت بالا در 5 ضرب میشو یعنی میانگینی برای محاسبه قیمت 5 نفر حساب می کنیم تا از طریق دولت پرداخت شود
var result = (sumOfIncluded - sumOfIncluded / (sumOfEmployees - countWithoutLeft) * 5) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft > 6 && hasKarfarma)
{
// console.log(4);
//مجموع حقوق و مزایای ماهانه مشمول - حقوق و مزایای ماهانه مشمول کارفرما
var sum = sumOfIncluded - sumOfIncludedKarfarma; //ستون مربوط به کارفرما محاسبه نمی شود
var result = (sum - sum / (sumOfEmployees - countWithoutLeft - 1) * 5 + sumOfIncludedKarfarma) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
#endregion
//sumOfIncluded مجموع حقوق و مزایای ماهیانه مشمول
// عادی
//if (typeOfInsuranceSendWorkshop != "Govermentlist" && !hasKarfarma)
//{
// var empployerShare = (sumOfIncluded * 20) / 100; //سهم حق کارفرما
// insuredShare = (sumOfIncluded * 7) / 100; //سهم حق بیمه شده
// unEmploymentInsurance = (sumOfIncluded * 3) / 100; //بیمه بیکاری
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
//else if (typeOfInsuranceSendWorkshop != "Govermentlist" && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// var tweni= (sum * 20) / 100;
// var empployerShare = tweniSeven + tweni;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
// کمک دولت
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 5 && !hasKarfarma)
//{ //console.log(1);
// employerShare = 0;
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 6 && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(tweniSeven, typeOfInsuranceSendWorkshop);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees >= 6 && !hasKarfarma)
//{
// var person = sumOfEmployees - 5;
// var divide = sumOfIncluded / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// employerShare = GetRoundValueWhitGovermentlist(finalresult, typeOfInsuranceSendWorkshop);
// // employerShare =getRoundValue(((sumOfIncluded/sumOfEmployees)*(sumOfEmployees-5))*20/100);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees > 6 && hasKarfarma)
//{ // console.log(4);
// var sum = sumOfIncluded - sumOfIncludedKarfarma;//ستون مربوط به کارفرما محاسبه نمی شود
// sumOfEmployees = sumOfEmployees - 1;
// var person = sumOfEmployees - 5;
// var divide = sum / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// var toeniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sumOfUp = finalresult + toeniSeven;
// insuredShare = (sum * 7) / 100;
// var treePercent = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(sumOfUp, typeOfInsuranceSendWorkshop);
//}
return new JsonResult(new
{
//تعداد نفرات
SumOfEmployees = totalEmployee,
//جمع حقوق ماهیانه
SumOfSalaries = sumOfSalaries.ToMoney(),
//جمع دستمزد روزانه
SumOfDailyWage = sumOfDailyWage.ToMoney(),
//جمع روزهای کارکرد
SumOfWorkingDays = sumOfWorkingDays,
//جمع مزایای ماهانه مشمول
SumOfBenefitsIncluded = monthlyBenefits.ToMoney(),
//مشمول
Included = sumOfIncluded.ToMoney(),
////مشمول و غیر مشمول
IncludedAndNotIncluded = sumOfBenefitIncludedAndNotIncluded.ToMoney(),
////IncludedAndNotIncluded = (sumOfIncluded + benefitsIncludedNonContinuous).ToMoney(),
//سهم حق بیمه شده
InsuredShare = insuredShare.ToMoney(),
//سهم حق کارفرما
EmployerShare = employerShare.ToMoney(),
//بیمه بیکاری
UnEmploymentInsurance = unEmploymentInsurance.ToMoney(),
//جمع پایه سنواتی
SumOfBaseYears = sumOfBaseYears.ToMoney(),
//جمع حق تاهل
SumOfMarriedAllowance = sumOfMarriedAllowance.ToMoney(),
//جمع دستمزد روزانه + پایه سنوات روزانه
SumOfDailyWagePlusBaseYears = sumOfDailyWagePlusBaseYear.ToMoney(),
//جمع مزایای غیر مشمول
SumOfBenefitsIncludedNonContinuous = benefitsIncludedNonContinuous.ToMoney(),
});
}
public IActionResult OnPostCreate(CreateInsuranceList command)
{
//var result =new OperationResult();
//result.IsSuccedded = true;
var result = _insuranceListApplication.Create(command);
if (result.IsSuccedded)
{
var saveFileResult = SaveFile(command);
if (saveFileResult)
{
result.IsSuccedded = true;
result.Message = "ثبت اطلاعات با موفقیت انجام شد";
}
else
{
result.Failed("ایجاد فایل بیمه با خطا مواجه شد");
}
}
//else
//{
// result.Failed("ثبت اطلاعات با خطا مواجه شد");
//}
return new JsonResult(result);
}
#endregion
public IActionResult OnPostCreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
{
TempData["EmployeeDetails"] = command;
var result = new OperationResult();
if (command.InsuranceEmployeeInformationId == 0)
result = _insuranceListApplication.CreateEmployeeDetailsInfo(command);
else
result = _insuranceListApplication.EditEmployeeDetailsInfo(command);
return new JsonResult(result);
}
public IActionResult OnPostJobList()
{
var jobs = _jobApplication.GetJob();
return new JsonResult(new
{
IsSuccedded = true,
jobList = jobs
});
}
/// <summary>
/// حذف لیست بیمه
/// </summary>
/// <param name="id"></param>
/// <param name="pathDSKKAR00"></param>
/// <param name="pathDSKWOR00"></param>
/// <returns></returns>
public IActionResult OnPostRemoveInsuranceList(long id, string pathDSKKAR00, string pathDSKWOR00)
{
var result = _insuranceListApplication.Remove(id);
if (result.IsSuccedded)
{
pathDSKKAR00 = pathDSKKAR00.Replace("-", "\\");
var filePathDSKKAR00 = $"{_webHostEnvironment.ContentRootPath}\\InsuranceList\\{pathDSKKAR00}";
if (System.IO.File.Exists(filePathDSKKAR00))
System.IO.File.Delete(filePathDSKKAR00);
pathDSKWOR00 = pathDSKWOR00.Replace("-", "\\");
var filePathDSKWOR00 = $"{_webHostEnvironment.ContentRootPath}\\InsuranceList\\{pathDSKWOR00}";
if (System.IO.File.Exists(filePathDSKWOR00))
System.IO.File.Delete(filePathDSKWOR00);
}
return new JsonResult(result);
}
public IActionResult OnPostConfirmInsuranceList(long id)
{
var result = _insuranceListApplication.ConfirmInsuranceList(id);
return new JsonResult(result);
}
public IActionResult OnGetDownloadFile(string path, string fileName)
{
//var path= "11\\1402_03\\DSKWOR00.dbf";
// Replace "file.dbf" with the name of your .dbf file
var filePath = $"{_webHostEnvironment.ContentRootPath}\\InsuranceList\\{path}";
;
// Read the file content into a byte array
var fileContent = System.IO.File.ReadAllBytes(filePath);
// Return the file content as a FileResult with the appropriate MIME type and file name
return File(fileContent, "application/dbase", fileName);
}
private string GetSpecifiedCharactes(string str, int MaxLength)
{
return str.Length <= MaxLength ? str : str.Substring(0, MaxLength);
}
private bool SaveFile(CreateInsuranceList createInsuranceList)
{
try
{
//var path = $"profilePhotos";
var path = createInsuranceList.InsuranceWorkshopInfo.WorkshopId;
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\InsuranceList\\{path}";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
//ایجاد پوشه با توجه به هر ماه و سال
var monthPath = directoryPath + "\\" + createInsuranceList.Year + "_" + createInsuranceList.Month;
if (!Directory.Exists(monthPath))
Directory.CreateDirectory(monthPath);
var currentdate = DateTime.Now;
var currentDay = Convert.ToInt32(currentdate.ToFarsi().Substring(8, 2));
////ایجاد پوشه با توجه به هر روز و ساعت و دقیقه و ثانیه
//var dayPath = monthPath +"\\"+ currentDay+"_"+ currentdate.Hour + "_" + currentdate.Month + "_" + currentdate.Second;
//if (!Directory.Exists(dayPath))
// Directory.CreateDirectory(dayPath);
//فعلا قرار شد روی فایل قبلی ریپلیس بشه
// string fileName = currentDay + "_" + currentdate.Hour + "_" + currentdate.Month + "_" + currentdate.Second +"_";
//ایجاد فایل کارگاه - DSK
if (createInsuranceList.InsuranceWorkshopInfo != null)
{
var odbf = new DbfFile(Encoding.GetEncoding(1256));
odbf.Open(Path.Combine(monthPath, "DSKKAR00.dbf"), FileMode.Create);
//کد کارگاه
odbf.Header.AddColumn(new DbfColumn("DSK_ID", DbfColumn.DbfColumnType.Character, 10, 0));
//نام کارگاه
odbf.Header.AddColumn(new DbfColumn("DSK_NAME", DbfColumn.DbfColumnType.Character, 100, 0));
//نام کارفرما
odbf.Header.AddColumn(new DbfColumn("DSK_FARM", DbfColumn.DbfColumnType.Character, 100, 0));
//نام آدرس
odbf.Header.AddColumn(new DbfColumn("DSK_ADRS", DbfColumn.DbfColumnType.Character, 100, 0));
//نوع لیست
odbf.Header.AddColumn(new DbfColumn("DSK_KIND", DbfColumn.DbfColumnType.Number, 1, 0));
//سال عملکرد
odbf.Header.AddColumn(new DbfColumn("DSK_YY", DbfColumn.DbfColumnType.Number, 2, 0));
//ماه عملکرد
odbf.Header.AddColumn(new DbfColumn("DSK_MM", DbfColumn.DbfColumnType.Number, 2, 0));
//شماره لیست
odbf.Header.AddColumn(new DbfColumn("DSK_LISTNO", DbfColumn.DbfColumnType.Character, 12, 0));
//شرح لیست
odbf.Header.AddColumn(new DbfColumn("DSK_DISC", DbfColumn.DbfColumnType.Character, 100, 0));
//تعداد کارکنان
odbf.Header.AddColumn(new DbfColumn("DSK_NUM", DbfColumn.DbfColumnType.Number, 5, 0));
//مجموع روزهای کارکرد کارکنان
odbf.Header.AddColumn(new DbfColumn("DSK_TDD", DbfColumn.DbfColumnType.Number, 6, 0));
//مجموع دستمزد روزانه کارکنان
odbf.Header.AddColumn(new DbfColumn("DSK_TROOZ", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع دستمزد ماهانه کارکنان
odbf.Header.AddColumn(new DbfColumn("DSK_TMAH", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع مزایای ماهانه مشمول
odbf.Header.AddColumn(new DbfColumn("DSK_TMAZ", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع دستمزد و مزایای ماهانه مشمول
odbf.Header.AddColumn(new DbfColumn("DSK_TMASH", DbfColumn.DbfColumnType.Number, 12, 0));
// مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
odbf.Header.AddColumn(new DbfColumn("DSK_TTOTL", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع حق بیمه سهم بیمه شده
odbf.Header.AddColumn(new DbfColumn("DSK_TBIME", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع حق بیمه سهم کارفرما
odbf.Header.AddColumn(new DbfColumn("DSK_TKOSO", DbfColumn.DbfColumnType.Number, 12, 0));
//مجموع حق بیمه بیکاری
odbf.Header.AddColumn(new DbfColumn("DSK_BIC", DbfColumn.DbfColumnType.Number, 12, 0));
//نرخ حق بیمه
odbf.Header.AddColumn(new DbfColumn("DSK_RATE", DbfColumn.DbfColumnType.Number, 5, 0));
//نرخ پورسانتاژ
odbf.Header.AddColumn(new DbfColumn("DSK_PRATE", DbfColumn.DbfColumnType.Number, 2, 0));
//نرخ مشاغل سخت زیان آور
odbf.Header.AddColumn(new DbfColumn("DSK_BIMH", DbfColumn.DbfColumnType.Number, 12, 0));
//ردیف پیمان
odbf.Header.AddColumn(new DbfColumn("MON_PYM", DbfColumn.DbfColumnType.Character, 3, 0));
//مجموع پایه سنواتی ها
odbf.Header.AddColumn(new DbfColumn("DSK_INC", DbfColumn.DbfColumnType.Character, 12, 0));
//مجموع حق تاهل ها
odbf.Header.AddColumn(new DbfColumn("DSK_SPOUSE", DbfColumn.DbfColumnType.Character, 12, 0));
var orec = new DbfRecord(odbf.Header);
//کد کارگاه
orec[0] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.InsuranceCode, 10);
orec[1] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.WorkshopName, 100)
.ToIranSystem();
orec[2] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.EmployerName, 100)
.ToIranSystem();
orec[3] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.Address, 100).ToIranSystem();
//orec[3] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("رشت - بلوار شهدای گمنام - کوچه شهید علی قربانی - ساختمان پیام نور - طبقه اول واحد 2", 100), IranSystemNumbers.DontConvert);
// نوع لیست
orec[4] = "0";
//سال
orec[5] = Convert.ToInt32(createInsuranceList.Year.Substring(2, 2)).ToString();
//ماه
orec[6] = Convert.ToInt32(createInsuranceList.Month).ToString();
//شماره لیست
orec[7] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.ListNumber, 12);
//شرح لیست
orec[8] = GetSpecifiedCharactes("", 100).ToIranSystem();
//تعداد کرکنان
orec[9] = createInsuranceList.SumOfEmployees.ToString();
//مجموع روزهای کارکرد کارکنان
orec[10] = createInsuranceList.SumOfWorkingDays.ToString();
//مجموع دستمزد روزانه کارکنان
orec[11] = createInsuranceList.SumOfDailyWage.ToString();
//مجموع دستمزد ماهانه کارکنان
orec[12] = createInsuranceList.SumOfSalaries.ToString();
//مجموع مزایای ماهانه مشمول
orec[13] = createInsuranceList.SumOfBenefitsIncluded.ToString();
//مجموع دستمزد و مزایای ماهانه مشمول
orec[14] = createInsuranceList.Included.ToString();
//مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
orec[15] = createInsuranceList.IncludedAndNotIncluded.ToString();
// مجموع حق بیمه سهم بیمه شده
orec[16] = createInsuranceList.InsuredShare.ToString();
//مجموع حق بیمه سهم کارفرما
orec[17] = createInsuranceList.EmployerShare.ToString(); //"44911361";
//مجموع حق بیمه بیکاری
orec[18] = createInsuranceList.UnEmploymentInsurance.ToString();
//نرخ حق بیمه
orec[19] = "23";
//نرخ پورسانتاژ
orec[20] = "0";
//نرخ مشاغل سخت زیان آور
orec[21] = createInsuranceList.DifficultJobsInsuranc.ToString();
//ردیف پیمان
orec[22] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.AgreementNumber, 12);
//مجموع پایه سنواتی ها
orec[23] = createInsuranceList.SumOfBaseYears.ToString();
//مجموع حق تاهل ها
orec[24] = createInsuranceList.SumOfMarriedAllowance.ToString();
odbf.Write(orec);
//odbf.Header.RecordCount = 50;
odbf.WriteHeader();
odbf.Close();
}
//ایجاد فایل پرسنل - DSW
if (createInsuranceList.EmployeeInsurancListDataList != null)
{
//لیست پرسنل
var dsw = new DbfFile(Encoding.GetEncoding(1256));
dsw.Open(Path.Combine(monthPath, "DSKWOR00.dbf"), FileMode.Create);
//کد کارگاه
dsw.Header.AddColumn(new DbfColumn("DSW_ID", DbfColumn.DbfColumnType.Character, 10, 0));
//سال عملکرد
dsw.Header.AddColumn(new DbfColumn("DSW_YY", DbfColumn.DbfColumnType.Number, 2, 0));
//ماه عملکرد
dsw.Header.AddColumn(new DbfColumn("DSW_MM", DbfColumn.DbfColumnType.Number, 2, 0));
//شماره لیست
dsw.Header.AddColumn(new DbfColumn("DSW_LISTNO", DbfColumn.DbfColumnType.Character, 12, 0));
//شماره بیمه
dsw.Header.AddColumn(new DbfColumn("DSW_ID1", DbfColumn.DbfColumnType.Character, 10, 0));
// نام
dsw.Header.AddColumn(new DbfColumn("DSW_FNAME", DbfColumn.DbfColumnType.Character, 100, 0));
// نام خانوادگی
dsw.Header.AddColumn(new DbfColumn("DSW_LNAME", DbfColumn.DbfColumnType.Character, 100, 0));
//نام پدر
dsw.Header.AddColumn(new DbfColumn("DSW_DNAME", DbfColumn.DbfColumnType.Character, 100, 0));
// شماره شناسنامه
dsw.Header.AddColumn(new DbfColumn("DSW_IDNO", DbfColumn.DbfColumnType.Character, 15, 0));
// محل صدور
dsw.Header.AddColumn(new DbfColumn("DSW_IDPLC", DbfColumn.DbfColumnType.Character, 100, 0));
// تاریخ صدور
dsw.Header.AddColumn(new DbfColumn("DSW_IDATE", DbfColumn.DbfColumnType.Character, 8, 0));
// تاریخ تولد
dsw.Header.AddColumn(new DbfColumn("DSW_BDATE", DbfColumn.DbfColumnType.Character, 8, 0));
// جنسیت
dsw.Header.AddColumn(new DbfColumn("DSW_SEX", DbfColumn.DbfColumnType.Character, 3, 0));
// ملیت
dsw.Header.AddColumn(new DbfColumn("DSW_NAT", DbfColumn.DbfColumnType.Character, 10, 0));
// شرح شغل
dsw.Header.AddColumn(new DbfColumn("DSW_OCP", DbfColumn.DbfColumnType.Character, 100, 0));
// تاریخ شروع بکار
dsw.Header.AddColumn(new DbfColumn("DSW_SDATE", DbfColumn.DbfColumnType.Character, 8, 0));
// تاریخ ترک کار
dsw.Header.AddColumn(new DbfColumn("DSW_EDATE", DbfColumn.DbfColumnType.Character, 8, 0));
// تعداد روزهای کارکرد
dsw.Header.AddColumn(new DbfColumn("DSW_DD", DbfColumn.DbfColumnType.Number, 2, 0));
// دستمزد روزانه
dsw.Header.AddColumn(new DbfColumn("DSW_ROOZ", DbfColumn.DbfColumnType.Number, 12, 0));
// دستمزد ماهانه
dsw.Header.AddColumn(new DbfColumn("DSW_MAH", DbfColumn.DbfColumnType.Number, 12, 0));
// مزایای ماهانه
dsw.Header.AddColumn(new DbfColumn("DSW_MAZ", DbfColumn.DbfColumnType.Number, 12, 0));
// جمع دستمزد و مزایای ماهانه مشمول
dsw.Header.AddColumn(new DbfColumn("DSW_MASH", DbfColumn.DbfColumnType.Number, 12, 0));
// جمع کل دستمزد و مزایای ماهانه
dsw.Header.AddColumn(new DbfColumn("DSW_TOTL", DbfColumn.DbfColumnType.Number, 12, 0));
//حق بیمه سهم بیمه شده
dsw.Header.AddColumn(new DbfColumn("DSW_BIME", DbfColumn.DbfColumnType.Number, 12, 0));
//نرخ پورسانتاژ
dsw.Header.AddColumn(new DbfColumn("DSW_PRATE", DbfColumn.DbfColumnType.Number, 2, 0));
// کد شغل
dsw.Header.AddColumn(new DbfColumn("DSW_JOB", DbfColumn.DbfColumnType.Character, 6, 0));
// کد ملی
dsw.Header.AddColumn(new DbfColumn("PER_NATCOD", DbfColumn.DbfColumnType.Character, 10, 0));
// پایه سنوات
dsw.Header.AddColumn(new DbfColumn("DSW_INC", DbfColumn.DbfColumnType.Number, 12, 0));
// حق تاهل
dsw.Header.AddColumn(new DbfColumn("DSW_SPOUSE", DbfColumn.DbfColumnType.Number, 12, 0));
foreach (var item in createInsuranceList.EmployeeInsurancListDataList)
{
var employee = createInsuranceList.EmployeeDetailsForInsuranceList.FirstOrDefault(p => p.EmployeeId == item.EmployeeId);
//var employeeObj = _employeeApplication.GetDetails(item.EmployeeId);
var dswrec = new DbfRecord(dsw.Header);
//کد کارگاه
dswrec[0] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.InsuranceCode, 10);
//سال
dswrec[1] = Convert.ToInt32(createInsuranceList.Year.Substring(2, 2)).ToString();
//ماه
dswrec[2] = Convert.ToInt32(createInsuranceList.Month).ToString();
//شماره لیست
dswrec[3] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.ListNumber, 12);
//شماره بیمه
dswrec[4] = GetSpecifiedCharactes(employee.InsuranceCode, 8);
// نام
dswrec[5] = GetSpecifiedCharactes(employee.FName, 100).ToIranSystem();
//var x = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes(employee.FName, 100), IranSystemNumbers.DontConvert);
//byte[] bytes = Encoding.Default.GetBytes(x);
//string resultString = Encoding.UTF8.GetString(bytes);
//خانوادگی نام
dswrec[6] = GetSpecifiedCharactes(employee.LName, 100).ToIranSystem();
//پدر نام
dswrec[7] = GetSpecifiedCharactes(employee.FatherName, 100).ToIranSystem();
//شماره شناسنامه
dswrec[8] = employee.IdNumber;
//محل صدور
dswrec[9] = GetSpecifiedCharactes(employee.PlaceOfIssue, 100).ToIranSystem();
//تاریخ صدور
dswrec[10] = employee.DateOfIssue == "1300/10/11" || string.IsNullOrEmpty(employee.DateOfIssue)
? ""
: employee.DateOfIssue.Replace("/", "");
//تاریخ تولد
dswrec[11] = employee.DateOfBirth == "1300/10/11" || string.IsNullOrEmpty(employee.DateOfIssue)
? ""
: employee.DateOfBirth.Replace("/", "");
;
//جنسیت
dswrec[12] = GetSpecifiedCharactes(employee.Gender, 3).ToIranSystem();
//ملیت
//dswrec[13] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("ایرانی", 10),
dswrec[13] = GetSpecifiedCharactes(employee.Nationality, 10).ToIranSystem();
//شرح شغل
dswrec[14] = GetSpecifiedCharactes(item.JobName, 100).ToIranSystem();
//تاریخ شروع بکار
dswrec[15] = item.StartWorkDate.ToFarsi().Replace("/", "");
//تاریخ ترک کار
if (item.LeftWorkDate != null)
dswrec[16] = item.LeftWorkDate.ToFarsi().Replace("/", "");
else
dswrec[16] = "";
//تعداد روزهای کارکرد
dswrec[17] = item.WorkingDays.ToString();
//دستمزد روزانه
dswrec[18] = item.DailyWage.ToString();
//دستمزد مااهانه
dswrec[19] = item.MonthlySalary.ToString();
//مزایای ماهانه
dswrec[20] = item.MonthlyBenefits.ToString();
//دستمزد و مزایای ماهانه مشمول
dswrec[21] = item.MonthlyBenefitsIncluded.ToString();
//جمع کل دستمزد و مزایای ماهانه مشمول غیرمشمول
dswrec[22] = item.IncludedAndNotIncluded.ToString();
//حق بیمه سهم بیمه شده
dswrec[23] = item.InsuranceShare.ToString();
//نرخ پورسانتاژ
dswrec[24] = "0";
//کد شغل
dswrec[25] = item.JobCode;
//کد ملی
dswrec[26] = employee.NationalCode;
//پایه سنوات
dswrec[27] = item.BaseYears.ToString();
//حق تاهل
dswrec[28] = item.MarriedAllowance.ToString();
dsw.Write(dswrec);
}
dsw.WriteHeader();
dsw.Close();
}
return true;
}
catch (Exception er)
{
return false;
}
}
#region EditInsurance
//-1
/// <summary>
/// متد لود اطلاعات بیمه برای ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public IActionResult OnGetEdit(long id)
{
var insurance = _insuranceListApplication.GetDetailsForEdit(id);
var workshopList = _workshopApplication.GetWorkshopSelectListInsuransce();
var workshopObj = workshopList.Where(x => x.Id == insurance.WorkshopId)?.FirstOrDefault();
insurance.WorkshopName = workshopObj == null ? string.Empty : workshopObj.WorkshopFullName;
insurance.TypeOfInsuranceSend = workshopObj.TypeOfInsuranceSend;
insurance.Population = workshopObj.Population;
insurance.FixedSalary = workshopObj.FixedSalary;
insurance.InsuranceJobId = workshopObj.InsuranceJobId;
workshopList = workshopList
.Where(x => !string.IsNullOrWhiteSpace(x.TypeOfInsuranceSend) && x.TypeOfInsuranceSend != "false").ToList();
insurance.WorkShopSelectList = new SelectList(workshopList, "Id", "WorkshopFullName");
//insurance.YearList = _yearlySalaryApplication.GetYears();
return Partial("Edit", insurance);
}
//-2
/// <summary>
/// لود اطلاعات پرسنل در مودال ویرایش بیمه -- DSKWOR
/// محاسبه تب پرسنل
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public IActionResult OnGetEmployeeListForEdit(EmployeeForEditInsuranceListSearchModel searchModel)
{
// var result = _insuranceListApplication.SearchEmployeeListForEditByInsuranceListId(searchModel);
var result = _insuranceListApplication.GetEmployeeListForEditByInsuranceListId(searchModel);
return Partial("./EmployeeListForEdit", result);
}
//-3
/// <summary>
/// ذخیره ویرایش
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public IActionResult OnPostEdit(EditInsuranceList command)
{
//var result =new OperationResult();
//result.IsSuccedded = true;
var result = _insuranceListApplication.Edit(command);
if (result.IsSuccedded)
{
var path = command.InsuranceWorkshopInfo.WorkshopId;
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\InsuranceList\\{path}";
var monthPath = directoryPath + "\\" + command.Year + "_" + command.Month;
//if (Directory.Exists(monthPath))
// Directory.Delete(monthPath);
var filePathDSKKAR00 = monthPath + "\\DSKKAR00.dbf";
if (System.IO.File.Exists(filePathDSKKAR00))
System.IO.File.Delete(filePathDSKKAR00);
var filePathDSKWOR00 = monthPath + "\\DSKWOR00.dbf";
if (System.IO.File.Exists(filePathDSKWOR00))
System.IO.File.Delete(filePathDSKWOR00);
var saveFileResult = SaveFile(command);
if (saveFileResult)
{
result.IsSuccedded = true;
result.Message = "ویرایش اطلاعات با موفقیت انجام شد";
}
else
{
result.Failed("ایجاد فایل بیمه با خطا مواجه شد");
}
}
return new JsonResult(result);
}
#endregion
public IActionResult OnGetInsuranceSummary(long id)
{
var insurance = _insuranceListApplication.GetDetails(id);
return Partial("InsuranceSummary", insurance);
}
public IActionResult OnGetInsuranceConfirm(long id)
{
var insurance = _insuranceListApplication.GetDetails(id);
return Partial("InsuranceConfirm", insurance);
}
public IActionResult OnGetInspectionReport(long id)
{
var insurance = _insuranceListApplication.GetDetails(id);
return Partial("InspectionReport", insurance);
}
public IActionResult OnPostMonthlySalary(string dailyWage, string workingDays, string insuranceShare,
string benefitsIncludedContinuous, string jobId, string housingAllowance, string includeStatus,
string consumableItems, string endMonthCurrentDay, long employeeId, double maritalStatus, double baseYear)
{
if(workingDays == "0")
return new JsonResult(new
{
monthlySalaryPlusBaseYear = "0",
monthlySalary = "0",
benefitsIncludedContinuous = "0",
insuranceShare = "0",
workingDay = 0,
dailyWag = "0",
dailyWagePlusBaseYear = "0",
marriedAllowance = "0",
baseYears = "0",
});
var benefitsIncludedContinuousL = benefitsIncludedContinuous.MoneyToDouble();
bool isManager = jobId is "10" or "16" or "17" or "18" or "3498";
//if (isManager && includeStatus !="1") شنبه
if (isManager)
maritalStatus = 0;
double sum = 0;
var employeeMaritalStatus = _employeeApplication.GetDetails(employeeId);
if (employeeMaritalStatus.MaritalStatus == "متاهل")
sum = consumableItems.MoneyToDouble() + housingAllowance.MoneyToDouble() + maritalStatus;
else
sum = consumableItems.MoneyToDouble() + housingAllowance.MoneyToDouble();
var workingDaysL = Convert.ToInt64(workingDays);
var endMonthCurrentDayL = Convert.ToInt64(endMonthCurrentDay);
var jobIdL = Convert.ToInt64(jobId);
var includeStatusL = Convert.ToInt64(includeStatus);
var dailyWageL = (dailyWage.MoneyToDouble()) + baseYear;
var dailyWageWithOutBaseYear = dailyWage.MoneyToDouble();
if (workingDaysL == endMonthCurrentDayL) benefitsIncludedContinuousL = sum;
//farokhiChanges
if (employeeId == 42783)
benefitsIncludedContinuousL = 53082855;
if (workingDaysL < endMonthCurrentDayL)
{
if (endMonthCurrentDayL == 29)
//farokhiChanges عدد پایین 30 بود به 29 تبدیل کردم
endMonthCurrentDayL = 29;
else if (endMonthCurrentDayL == 30) //farokhiChanges این شرط رو اضافه کردم
endMonthCurrentDayL = 30;
else if (endMonthCurrentDayL == 31) //farokhiChanges این شرط رو اضافه کردم
endMonthCurrentDayL = 31;
var a = sum * workingDaysL / endMonthCurrentDayL;
benefitsIncludedContinuousL = _insuranceListApplication.GetRoundValue(a);
}
//if (dailyWageL == 0)
//{
// benefitsIncludedContinuousL = 0;
//}
if (isManager && includeStatus != "1")
benefitsIncludedContinuousL = 0;
var monthlySalaryL = workingDaysL * dailyWageL;
var insuranceShareL = (benefitsIncludedContinuousL + monthlySalaryL) * 7 / 100;
insuranceShareL = _insuranceListApplication.GetRoundValue(insuranceShareL);
var monthlySalaryWithOutBaseYear = workingDaysL * dailyWageWithOutBaseYear;
//var persianBefore = "";
//var year = Convert.ToInt32(date.Substring(0, 4));
//var month = Convert.ToInt32(date.Substring(5, 2));
//var day = Convert.ToInt32(date.Substring(8, 2));
//var persianDate = new PersianDateTime(year, month, day);
//var persianBeforeDate = persianDate.AddDays(-1);
//persianBefore = persianBeforeDate.ToString("yyyy/MM/dd");
if (benefitsIncludedContinuousL == 0 && monthlySalaryL == 0 && insuranceShareL == 0 && dailyWageL == 0)
workingDaysL = 0;
if (benefitsIncludedContinuousL == 0 && monthlySalaryL == 0 && insuranceShareL == 0 &&
workingDaysL == 0) dailyWageL = 0;
var includeStatusBool = includeStatus == "1";
double marridAllowance = 0;
if (employeeMaritalStatus.MaritalStatus == "متاهل" && !isManager)
{
marridAllowance = _insuranceListApplication.MarriedAllowance(employeeMaritalStatus.MaritalStatus, 0,
includeStatusBool, Convert.ToInt32(workingDays), maritalStatus, Convert.ToInt32(endMonthCurrentDay));
}
var baseYears = baseYear;
Console.WriteLine(baseYears);
return new JsonResult(new
{
monthlySalaryPlusBaseYear = monthlySalaryL.ToMoney(),
monthlySalary = monthlySalaryWithOutBaseYear.ToMoney(),
benefitsIncludedContinuous = benefitsIncludedContinuousL.ToMoney(),
insuranceShare = insuranceShareL.ToMoney(),
workingDay = workingDaysL,
dailyWag = dailyWageWithOutBaseYear.ToMoney(),
dailyWagePlusBaseYear = dailyWageL,
marriedAllowance = marridAllowance.ToMoney(),
baseYears = baseYears.ToMoney(),
});
}
public double GetRoundValueWhitGovermentlist(double value, string type)
{
var strValue = value.ToString();
if (strValue.IndexOf('.') > -1)
{
var a = strValue.Substring(strValue.IndexOf('.') + 1, 1);
if (type == "Govermentlist")
{
if (int.Parse(a) >= 4)
return Math.Round(value, MidpointRounding.ToPositiveInfinity);
return Math.Round(value, MidpointRounding.ToNegativeInfinity);
}
if (int.Parse(a) > 5)
return Math.Round(value, MidpointRounding.ToPositiveInfinity);
return Math.Round(value, MidpointRounding.ToNegativeInfinity);
}
return value;
}
#region New by heydari
/// <summary>
/// جستجوی کارگاه در صفحه اصلی بیمه
/// </summary>
/// <param name="searchText"></param>
/// <returns></returns>
public IActionResult OnGetWorkshopName(string searchText)
{
var result = _workshopApplication.GetWorkshopByTextSearch(searchText);
result = result.OrderBy(x => x.WorkshopFullName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result
});
}
public IActionResult OnGetEmployerName(string searchText)
{
var result = _employerApplication.GetEmployerWithFNameOrLName(searchText);
result = result.OrderBy(x => x.LName.Length).ToList();
return new JsonResult(new
{
IsSuccedded = true,
mylist = result
});
}
#endregion
}