private void btnComName_Click(object sender, EventArgs e) { CompanyReport objcom = new CompanyReport(); rptViewer objView = new rptViewer(); if (!String.IsNullOrEmpty(txtSearch.Text)) { objcom.SetParameterValue("@ComID", txtSearch.Text); } CompanyBL obj = new CompanyBL() { CompanyID = Convert.ToInt32(txtSearch.Text) }; var dt = obj.SelectComId(); if (dt != null) { objcom.SetDataSource(dt); objView.crptViewer.ReportSource = objcom; objView.WindowState = FormWindowState.Maximized; objView.ShowDialog(); } else { MessageBox.Show("No Record Found"); } //crptViewerCom.ReportSource = objcom; txtSearch.Clear(); }
private void CargaTreeview() { tvwDatos.Nodes.Clear(); List <CompanyBE> lstEmpresa = null; lstEmpresa = new CompanyBL().ListaTodosActivo(0); foreach (var item in lstEmpresa) { TreeNode nuevoNodo = new TreeNode(); nuevoNodo.Text = item.NameCompany; nuevoNodo.ImageIndex = 0; nuevoNodo.SelectedImageIndex = 0; nuevoNodo.Tag = "EMP" + item.IdCompany.ToString(); tvwDatos.Nodes.Add(nuevoNodo); List <WorkAreaBE> lstWorkArea = null; lstWorkArea = new WorkAreaBL().ListaTodosActivo(item.IdCompany); foreach (var itemarea in lstWorkArea) { TreeNode nuevoNodoChild = new TreeNode(); nuevoNodoChild.ImageIndex = 2; nuevoNodoChild.SelectedImageIndex = 2; nuevoNodoChild.Text = itemarea.NameWorkArea; nuevoNodoChild.Tag = "ARE" + itemarea.IdWorkArea.ToString(); nuevoNodo.Nodes.Add(nuevoNodoChild); } } tvwDatos.ExpandAll(); }
private void btnSearch_Click(object sender, EventArgs e) { CompanyBL objCom = new CompanyBL() { CompanyID = Convert.ToInt32(txtSearch.Text) }; var dt = objCom.Search(); dgvPurRemain.Columns.Clear(); if (dt.Count > 0) { DataGridViewImageColumn edit = new DataGridViewImageColumn(); edit.Image = Properties.Resources.edit; edit.ImageLayout = DataGridViewImageCellLayout.Zoom; edit.HeaderText = "Edit"; edit.Width = 20; dgvPurRemain.Columns.Add(edit); dgvPurRemain.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvPurRemain.DataSource = dt; } else { MessageBox.Show("Record Not Found Or Invalid Record"); } }
public ActionResult Edit(int id) { CompanyBL companyBL = new CompanyBL(); var companies = companyBL.GetCompanyById(id); return(View(companies)); }
private void btnUpdate_Click(object sender, EventArgs e) { // if (txtSearch.Text == string.Empty) //{ // MessageBox.Show("Please Select A Zone ID "); // return; //} if (MessageBox.Show("Are You Sure To Update Company?", "UpdateAlert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CompanyBL objCom = new CompanyBL() { CompanyID = Convert.ToInt32(txtComID.Text), CompanyName = txtComName.Text, Email = txtEmail.Text, Contact = txtContact.Text, Address = txtAddress.Text }; objCom.Update(); MessageBox.Show("Record Updated Successfull"); ClearGroup(); } else { MessageBox.Show("Record Not Update "); } LoadData(); }
private void btnSearch_Click(object sender, EventArgs e) { if (txtSearch.Text == string.Empty) { MessageBox.Show("Please Enter ID"); } else if (!string.IsNullOrEmpty(txtSearch.Text)) { CompanyBL objCom = new CompanyBL() { CompanyID = Convert.ToInt32(txtSearch.Text) }; var dt = objCom.Search(); if (dt != null) { dgvCompany.DataSource = dt; btnDelete.Enabled = true; btnUpdate.Enabled = true; FormEnable(); } } else { MessageBox.Show("Record Not Found"); } }
public ActionResult Company() { try { int id = UserBL.ReadAll().First(u => u.Name == User.Identity.GetUserName()).Id; var company = (CompanyViewModel)CompanyBL.Read(Convert.ToInt32(id)); //ERROR Couldn't convert //company.Employees = (EmployeeViewModel)EmployeeBL.ReadByCompany(company.Id); if (company.Employees == null) { company.Employees = new List <EmployeeViewModel>(); } if (company.Groups == null) { company.Groups = new List <GroupViewModel>(); } if (company.Positions == null) { company.Positions = new List <PositionViewModel>(); } return(View(company)); } catch (Exception) { return(View((CompanyViewModel)CompanyBL.Read(Convert.ToInt32(-1)))); throw; } }
private void CargaTreeview() { tvwDatos.Nodes.Clear(); List <CompanyBE> lstEmpresa = null; lstEmpresa = new CompanyBL().ListaTodosActivo(0); foreach (var item in lstEmpresa) { TreeNode nuevoNodo = new TreeNode(); nuevoNodo.Text = item.NameCompany; nuevoNodo.ImageIndex = 0; nuevoNodo.SelectedImageIndex = 0; nuevoNodo.Tag = "EMP" + item.IdCompany.ToString(); tvwDatos.Nodes.Add(nuevoNodo); List <LoginClientDepartmentBE> lstClient = null; lstClient = new LoginClientDepartmentBL().ListaClient(Parametros.intUsuarioId); foreach (var itemclient in lstClient) { TreeNode nuevoNodoChild = new TreeNode(); nuevoNodoChild.ImageIndex = 1; nuevoNodoChild.SelectedImageIndex = 1; nuevoNodoChild.Text = itemclient.NameClient; nuevoNodoChild.Tag = "ARE" + itemclient.IdClient.ToString(); nuevoNodo.Nodes.Add(nuevoNodoChild); } } tvwDatos.SelectedNode = tvwDatos.Nodes[0]; tvwDatos.Select(); tvwDatos.ExpandAll(); }
public CompanyDetailsEntities GetCompanyDetails() { ICompanyBL companyBL = new CompanyBL(); CompanyDetailsEntities companyDetails = companyBL.GetCompanyDetails(); return(companyDetails); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.UserName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { CompanyBL.Create(UserBL.Create(model)); await SignInAsync(user, isPersistent : false); return(RedirectToAction("Index", "Home")); } else { AddErrors(result); } } // If we got this far, something failed, redisplay form return(View(model)); }
private void frmManEmpresaEdit_Load(object sender, EventArgs e) { if (pOperacion == Operacion.Nuevo) { this.Text = "Company - New"; } else if (pOperacion == Operacion.Modificar) { this.Text = "Company Update"; CompanyBE objE_Empresa = new CompanyBE(); objE_Empresa = new CompanyBL().Selecciona(IdCompany); IdCompany = objE_Empresa.IdCompany; txtRuc.Text = objE_Empresa.Ruc; txtRazonSocial.Text = objE_Empresa.NameCompany; txtDireccion.Text = objE_Empresa.Address; txtTelefono.Text = objE_Empresa.Phone; txtActividadEconomica.Text = objE_Empresa.EconomyActivity; if (objE_Empresa.Logo != null) { this.picImage.Image = new FuncionBase().Bytes2Image((byte[])objE_Empresa.Logo); } else { this.picImage.Image = ERP.Presentacion.Properties.Resources.noImage; } } txtRuc.Select(); }
/// <summary> /// Gets all initialize data for user. /// </summary> /// <param name="userId">The user identifier.</param> /// <returns></returns> public static MobileInitialData GetAllInitializeDataForUser(int userId) { using (StageBitzDB dataContext = new StageBitzDB()) { MobileInitialData mobileInitialData = new MobileInitialData(); //Get the Companies that the user can access CompanyBL companyBL = new CompanyBL(dataContext); List <CompanyListInfo> companyList = companyBL.GetCompanyList(userId, false, false, true); var extractedcompanyList = (from cl in companyList select new CompanyListOfUser { Id = cl.CompanyId, Name = cl.CompanyName, IsCompanyUser = cl.IsInventoryStaff ? 1 : 0 }).ToList <CompanyListOfUser>(); mobileInitialData.CompanyList = extractedcompanyList; //Get all the system Item Types InventoryBL inventoryBL = new InventoryBL(dataContext); List <ItemTypeData> itemTypeList = inventoryBL.GetAllSystemItemTypes(); mobileInitialData.ItemTypeList = itemTypeList; return(mobileInitialData); } }
private void tlbMenu_DeleteClick() { try { Cursor = Cursors.WaitCursor; if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ValidarIngreso()) { CompanyBE objE_Empresa = new CompanyBE(); objE_Empresa.IdCompany = int.Parse(gvEmpresa.GetFocusedRowCellValue("IdCompany").ToString()); objE_Empresa.Login = Parametros.strUsuarioLogin; objE_Empresa.Machine = WindowsIdentity.GetCurrent().Name.ToString(); CompanyBL objBL_Empresa = new CompanyBL(); objBL_Empresa.Elimina(objE_Empresa); XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Cargar(); } } Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dgvCompany_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { int rowindex = e.RowIndex; int columnindex = e.ColumnIndex; if (columnindex == 0) { txtComID.Text = dgvCompany.Rows[rowindex].Cells[2].Value.ToString(); txtComName.Text = dgvCompany.Rows[rowindex].Cells[3].Value.ToString(); txtEmail.Text = dgvCompany.Rows[rowindex].Cells[4].Value.ToString(); txtContact.Text = dgvCompany.Rows[rowindex].Cells[5].Value.ToString(); txtAddress.Text = dgvCompany.Rows[rowindex].Cells[6].Value.ToString(); FormEnable(); btnSave.Enabled = false; btnUpdate.Enabled = true; btnDelete.Enabled = true; btnClear.Enabled = true; } else if (columnindex == 1) { string message = "Are You Sure To Delete Company " + txtComName.Text + "?"; if (MessageBox.Show(message, "Delete Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { CompanyBL objCom = new CompanyBL() { CompanyID = Convert.ToInt32(dgvCompany.Rows[rowindex].Cells[2].Value.ToString()) }; objCom.Delete(); MessageBox.Show("Record Deleted Successfull"); LoadData(); ClearGroup(); } } }
private void btnAllRecord_Click(object sender, EventArgs e) { CompanyGeneralReport objCom = new CompanyGeneralReport(); rptViewer objView = new rptViewer(); CompanyBL objBL = new CompanyBL(); var dt = objBL.SelectAllCom(); if (dt != null) { objCom.SetDataSource(dt); objView.crptViewer.ReportSource = objCom; objView.WindowState = FormWindowState.Maximized; objView.ShowDialog(); } else { MessageBox.Show("No Record Found"); } //objCom.SetParameterValue("@ComID", null); //CompanyBL obj = new CompanyBL(); //var dt = obj.Select(); //if (dt.Count > 0) //{ // objCom.SetDataSource(dt); //} // crptViewerCom.ReportSource = objCom; }
public CompanyForm(int id, bool readOnly) { _id = id; _readOnly = readOnly; InitializeComponent(); _companyBL = new CompanyBL(); init(); }
//public IEnumerable<ShippingAddressEntity> GetShippingDetails(int CompanyId, string EntityType) //{ // ICompanyBL companyBL = new CompanyBL(); // IEnumerable<ShippingAddressEntity> result = companyBL.GetShippingDetails(CompanyId, EntityType); // return result; //} //public IEnumerable<ShippingAddressEntity> GetSelectedShipDetails(int ShipId) //{ // ICompanyBL companyBL = new CompanyBL(); // IEnumerable<ShippingAddressEntity> result = companyBL.GetSelectedShipDetails(ShipId); // return result; //} public bool AddCompany(CompanyDetailsEntities companyDetail) { ICompanyBL AddCompanyBL = new CompanyBL(); var addcomp = AddCompanyBL.AddCompany(companyDetail); var abc = companyDetail; return(addcomp); }
// GET: Employee public ActionResult Create() { var id = UserBL.ReadAll().First(u => u.Name == User.Identity.GetUserName()).Id; ViewBag.Positions = PositionBL.ReadByCompany(CompanyBL.Read(id).Id); ViewBag.Groups = GroupBL.ReadByCompany(CompanyBL.Read(id).Id); return(View(new EmployeeViewModel())); }
public CompanyForm(int id) { _id = id; InitializeComponent(); _companyBL = new CompanyBL(); init(); }
/// <summary> /// To be called by the daily agent /// </summary> public static void UpdateCompanyExpirations(DateTime dateToConsider, StageBitzDB dataContext) { FinanceBL financeBL = new FinanceBL(dataContext); CompanyBL companyBL = new CompanyBL(dataContext); ProjectBL projectBL = new ProjectBL(dataContext); #region SuspendPaymentFailureCompanies int companyGracePeriodStatus = Utils.GetCodeIdByCodeValue("CompanyStatus", "GRACEPERIOD"); int companyPaymentFailedStatus = Utils.GetCodeIdByCodeValue("CompanyStatus", "SUSPENDEDFORPAYMENTFAILED"); int companyActiveStatus = Utils.GetCodeIdByCodeValue("CompanyStatus", "ACTIVE"); int suspendedForNoPaymentPackageStatus = Utils.GetCodeIdByCodeValue("CompanyStatus", "SUSPENDEDFORNOPAYMENTPACKAGE"); int suspendForNoPaymentOptions = Utils.GetCodeIdByCodeValue("CompanyStatus", "SUSPENDEDFORNOPAYMENTOPTIONS"); var companies = from c in dataContext.Companies where (c.CompanyStatusCodeId == companyGracePeriodStatus || c.CompanyStatusCodeId == companyActiveStatus) && c.ExpirationDate != null && dateToConsider >= c.ExpirationDate select c; foreach (Data.Company company in companies) { if (company.CompanyStatusCodeId == companyActiveStatus) { //Get the current Company package to check. CompanyPaymentPackage companyPaymentPackage = financeBL.GetCurrentPaymentPackageFortheCompanyIncludingFreeTrial(company.CompanyId, dateToConsider); DiscountCodeUsage discountCodeUsage = financeBL.GetDiscountCodeUsageByDate(dateToConsider, company.CompanyId); // suspend payment package not setup companies after free trial. if (companyPaymentPackage == null) { company.CompanyStatusCodeId = suspendedForNoPaymentPackageStatus; } else { decimal totalAmount = financeBL.CalculateALLPackageAmountsByPeriod(companyPaymentPackage.ProjectPaymentPackageTypeId, companyPaymentPackage.InventoryPaymentPackageTypeId, companyPaymentPackage.PaymentDurationCodeId); //Check if it is a Free package. if (!companyPaymentPackage.PaymentMethodCodeId.HasValue && ((discountCodeUsage != null && discountCodeUsage.DiscountCode.Discount != 100) || (discountCodeUsage == null && totalAmount != 0))) { company.CompanyStatusCodeId = suspendForNoPaymentOptions; SuspendProjectsForCompany(company.CompanyId, dataContext); } } } //For Grace period companies, if it exceeded the grace period change it to Payment Failed. else if (companyBL.IsCompanyInPaymentFailedGracePeriod(company.CompanyId)) { company.CompanyStatusCodeId = companyPaymentFailedStatus; company.LastUpdatedByUserId = 0; company.LastUpdatedDate = Utils.Now; } company.ExpirationDate = null; } #endregion }
/// <summary> /// Exports the files. /// </summary> public void ExportFiles() { CompanyBL companyBL = new CompanyBL(DataContext); int queuedStatusCodeId = Utils.GetCodeIdByCodeValue("ExportFileStatus", "QUEUED"); int deletedStatusCodeId = Utils.GetCodeIdByCodeValue("ExportFileStatus", "DELETED"); long fileSize = 0; var queuedExportFileRequests = companyBL.GetAllQueuedExportFileRequests(); // Loop all export file requests. foreach (ExportFile exportFileRequest in queuedExportFileRequests) { bool isSuccess = false; // If a new request if (exportFileRequest.ExportFileStatusCodeId == queuedStatusCodeId) { switch (exportFileRequest.RelatedTable) { case "Project": isSuccess = CreateProjectExportFile(exportFileRequest.RelatedId, exportFileRequest.CreatedByUserId, out fileSize); break; case "Company": isSuccess = CreateCompanyExportFile(exportFileRequest.RelatedId, exportFileRequest.CreatedByUserId, out fileSize); break; } if (isSuccess) { exportFileRequest.ExportFileStatusCodeId = Utils.GetCodeIdByCodeValue("ExportFileStatus", "COMPLETED"); exportFileRequest.FileSize = fileSize; } } // If a delete request. else if (exportFileRequest.ExportFileStatusCodeId == deletedStatusCodeId) //Pending Delete { switch (exportFileRequest.RelatedTable) { case "Project": isSuccess = DeletePendingRemovalProjectFiles(exportFileRequest.RelatedId); break; case "Company": isSuccess = DeletePendingRemovalCompanyFiles(exportFileRequest.RelatedId); break; } if (isSuccess) { exportFileRequest.IsActive = false; } } } DataContext.SaveChanges();//Should not be placed with in the foreach }
/// <summary> /// Deletes the exported files. /// </summary> private void DeleteExportedFiles() { //Delete unwanted zipped files if they are being there for more than the defined days from its creation date using (StageBitzDB dataContext = new StageBitzDB()) { CompanyBL companyBL = new CompanyBL(dataContext); companyBL.RemoveGeneratedExportFiles(); } }
public async Task <ActionResult> Create(FormCollection collection) { ReturnResult returnResult = new ReturnResult(); CompanyMaster objCompany = new CompanyMaster(); try { // TODO: Add insert logic here CompanyBL objcompanyBL = new CompanyBL(); objCompany.CompanyId = 0; objCompany.CompanyCode = Convert.ToString(collection["CompanyCode"]); objCompany.CompanyName = Convert.ToString(collection["CompanyName"]); objCompany.Address = Convert.ToString(collection["Address"]); objCompany.City = Convert.ToString(collection["City"]); objCompany.ContactEmail = Convert.ToString(collection["City"]); objCompany.OwnedBy = Convert.ToString(collection["OwnedBy"]); objCompany.Phone1 = Convert.ToString(collection["Phone1"]); objCompany.Phone2 = Convert.ToString(collection["Phone2"]); objCompany.RegistrationNo = Convert.ToString(collection["RegistrationNo"]); objCompany.Tin = Convert.ToString(collection["Tin"]); objCompany.Website = Convert.ToString(collection["Website"]); WebAPI webapi = new WebAPI(); HttpResponseMessage response = await webapi.CallToWebAPI(APICallType.Post, "APICompany", "", Convert.ToString(Session["DBConnectionString"]), Convert.ToString(Session["UserAccount"]), Convert.ToString(Session["RoleId"]), Convert.ToString(Session["CompanyCode"]), "0", objCompany); if (response.IsSuccessStatusCode) { var data = await response.Content.ReadAsStringAsync(); // convert json in IEnumerable object list of category returnResult = JsonConvert.DeserializeObject <ReturnResult>(data); if (returnResult.IsSuccess) { return(RedirectToAction("Index")); } else { TempData["CreateCompanyMessage"] = returnResult.Message; return(View(objCompany)); } } else { TempData["CreateCompanyMessage"] = "Error while saving data."; return(View(objCompany)); } } catch { TempData["CreateCompanyMessage"] = returnResult.Message; return(View(objCompany)); } }
private void LoadCompany() { //string query = "Select * from tbl_Company"; //DataTable dt = DB.Select(query); CompanyBL objcom = new CompanyBL(); var dt = objcom.Select(); txtComName.DataSource = dt; txtComName.DisplayMember = "CompanyName"; txtComName.ValueMember = "CompanyID"; }
public CompanyList() { _gridTools = new GridTools(); InitializeComponent(); _companyBL = new CompanyBL(); checkPerm(); initList(); }
void ExportarExcel(string filename) { Excel._Application xlApp; Excel._Workbook xlLibro; Excel._Worksheet xlHoja; Excel.Sheets xlHojas; xlApp = new Excel.Application(); filename = Path.Combine(Directory.GetCurrentDirectory(), "Excel\\Company.xlsx"); xlLibro = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlHojas = xlLibro.Sheets; xlHoja = (Excel._Worksheet)xlHojas[1]; Cursor.Current = Cursors.WaitCursor; try { int Row = 6; int Secuencia = 1; List <CompanyBE> lstCompany = null; lstCompany = new CompanyBL().ListaTodosActivo(0); if (lstCompany.Count > 0) { xlHoja.Shapes.AddPicture(Path.Combine(Directory.GetCurrentDirectory(), "Logo.jpg"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 1, 1, 100, 60); foreach (var item in lstCompany) { xlHoja.Cells[Row, 1] = item.IdCompany; xlHoja.Cells[Row, 2] = item.Ruc; xlHoja.Cells[Row, 3] = item.NameCompany; xlHoja.Cells[Row, 4] = item.Address; xlHoja.Cells[Row, 5] = item.Phone; Row = Row + 1; Secuencia = Secuencia + 1; } } xlLibro.SaveAs("C:\\Excel\\Company.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlLibro.Close(true, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; BSUtils.OpenExcel("C:\\Excel\\Company.xlsx"); //XtraMessageBox.Show("It was imported correctly \n The file was generated C:\\Excel\\Company.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void LoadComp() { CompanyBL objCom = new CompanyBL(); List <tbl_Company> dt = objCom.Select(); txtCompanyName.DataSource = dt; txtCompanyName.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtCompanyName.AutoCompleteSource = AutoCompleteSource.ListItems; txtCompanyName.DisplayMember = "CompanyName"; txtCompanyName.ValueMember = "CompanyID"; }
/// <summary> /// Creates the payment summaries. /// This will create payment summaries/Invoice Requests for the repeat payments to be charged at the end of the cycle /// </summary> /// <param name="dateToConsider">The date to consider.</param> public static void CreatePaymentSummaries(DateTime dateToConsider) { using (StageBitzDB dataContext = new StageBitzDB()) { FinanceBL financeBL = new FinanceBL(dataContext); CompanyBL companyBL = new CompanyBL(dataContext); //This will get all the CompanyPaymentPackages that needs to be Charged for considering cycle List <CompanyPaymentPackage> companyPaymentPackages = (from cpp in dataContext.CompanyPaymentPackages join cps in dataContext.CompanyPaymentSummaries on cpp.CompanyId equals cps.CompanyId where cps.IsImmidiateFutureRecordCreated == false && cpp.StartDate <= dateToConsider && (cpp.EndDate > dateToConsider || cpp.EndDate == null) && cps.NextPaymentCycleStartingDate <= dateToConsider select cpp).Distinct().ToList(); foreach (CompanyPaymentPackage companyPaymentPackage in companyPaymentPackages) { Data.Company company = companyPaymentPackage.Company; PaymentSummaryDetails paymentSummaryDetails = new PaymentSummaryDetails() { CompanyPaymentPackage = companyPaymentPackage, CompanyId = companyPaymentPackage.CompanyId, ShouldProcess = !(companyBL.IsCompanySuspended(companyPaymentPackage.CompanyId) || companyBL.HasCompanySuspendedbySBAdmin(companyPaymentPackage.CompanyId)), UserId = 0, PackageStartDate = companyPaymentPackage.StartDate, PaymentMethodCodeId = companyPaymentPackage.PaymentMethodCodeId, HasPackageChanged = false, ProjectPaymentPackageTypeId = companyPaymentPackage.ProjectPaymentPackageTypeId, InventoryPaymentPackageTypeId = companyPaymentPackage.InventoryPaymentPackageTypeId, IsEducationPackage = companyPaymentPackage.IsEducationalPackage, PaymentDurationTypeCodeId = companyPaymentPackage.PaymentDurationCodeId, DiscountCodeUsageToApply = financeBL.GetLatestDiscountCodeUsage(companyPaymentPackage.CompanyId) }; //Get IsImmidiateFutureRecordCreated "False" Future Anual Summary records and make them as "True".(To commit as Processed) var unprocessedFutureSummaries = (from cps in dataContext.CompanyPaymentSummaries where cps.IsImmidiateFutureRecordCreated == false && cps.CompanyId == companyPaymentPackage.CompanyId && cps.ToDate <= dateToConsider select cps).ToList(); foreach (CompanyPaymentSummary cps in unprocessedFutureSummaries) { cps.IsImmidiateFutureRecordCreated = true; cps.LastUpdatedDate = Utils.Today; cps.LastUpdatedBy = 0; } CreateCompanyPaymentSummaries(paymentSummaryDetails, dateToConsider, dataContext); } dataContext.SaveChanges(); } }
public ActionResult Delete(int id) { CompanyBL companyBL = new CompanyBL(); ReturnResult result = companyBL.DeleteCompany(id); //if (!result.IsSuccess) //{ // TempData["Message"] = "Error while deleting category."; //} return(RedirectToAction("Index")); //return View(); }
private void ddlState_SelectedIndexChanged(object sender, EventArgs e) { if (ddlState.SelectedValue.ToString() != null) { int stateId = Convert.ToInt32(ddlState.SelectedValue); CompanyBL companyBL = new CompanyBL(); List <City> cities = companyBL.GetCities(stateId); ddlCity.ValueMember = "ID"; ddlCity.DisplayMember = "Name"; ddlCity.DataSource = cities; } }