public async Task <IActionResult> Edit(long id, [Bind("Id,Name")] OwnershipType ownershipType) { if (id != ownershipType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ownershipType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OwnershipTypeExists(ownershipType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ownershipType)); }
private void BindFormElements() { //Bind the Region Lookup (Zone and Woredas will be bind after selection Region) lkRegion.Properties.DataSource = BLL.Region.GetAllRegions().DefaultView; lkRegion.EditValue = GeneralInfo.Current.Region; //Bind the Receiving units Types Lookup InstitutionType institutionsTypes = new InstitutionType(); institutionsTypes.LoadAll(); institutionsTypes.Sort = "Name ASC"; lkType.Properties.DataSource = institutionsTypes.DefaultView; lkType.EditValue = InstitutionType.Constants.HEALTH_CENTER; //Bind the Ownership Type Lookup OwnershipType ownershipTypes = new OwnershipType(); ownershipTypes.LoadAll(); ownershipTypes.Sort = "Name ASC"; lkOwnership.Properties.DataSource = ownershipTypes.DefaultView; lkOwnership.EditValue = OwnershipType.Constants.Public; //Bind the Active lookup lkActive.Properties.ValueMember = lkActive.Properties.DisplayMember = "Column"; lkActive.Properties.DataSource = new string[3] { "All", "Active", "InActive" }; lkActive.ItemIndex = 0; LoadReceivingUnits(); }
public EntityInfoAttribute(string displayName, OwnershipType ownershipType, string pluralDisplayName = null, string description = null) { Guard.This(displayName).AgainstNullOrEmpty(); DisplayName = displayName; OwnershipType = ownershipType.ToSimilarEnum <OwnershipTypes>(); PluralDisplayName = string.IsNullOrEmpty(pluralDisplayName) ? displayName + "s" : pluralDisplayName; Description = string.IsNullOrEmpty(description) ? displayName : description; }
public async Task <IActionResult> GetById(Guid id) { OwnershipType ownershipType = await _repository.GetByIdAsync(id); if (ownershipType == null) { return(NotFound()); } return(Ok(_mapper.Map(ownershipType))); }
public async Task <IActionResult> Create([Bind("Id,Name")] OwnershipType ownershipType) { if (ModelState.IsValid) { _context.Add(ownershipType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ownershipType)); }
private void AddCompanyValues() { try { _objCompanyDetailsSetup = new CompanyDetailsSetup(); _objCompanyDetailsSetup.CountryID = Convert.ToInt32(ddlCountry.SelectedValue); _objCompanyDetailsSetup.CompanyName = txtCompanyName.Text == string.Empty ? null : txtCompanyName.Text; _objCompanyDetailsSetup.CompanyEmail = txtEmail.Text == string.Empty ? null : txtEmail.Text; _objCompanyDetailsSetup.CompanyMobile = txtMobile.Text == string.Empty ? null : txtMobile.Text; _objCompanyDetailsSetup.CompanyLogo = (byte[])ViewState["profileImage"]; _objCompanyDetailsSetup.CompanyShortName = txtShortName.Text == string.Empty ? null : txtShortName.Text; _objCompanyDetailsSetup.CompanySlogun = txtSlogun.Text == string.Empty ? null : txtSlogun.Text; _objCompanyDetailsSetup.House = txtHouse.Text == string.Empty ? null : txtHouse.Text; _objCompanyDetailsSetup.Road = txtRoad.Text == string.Empty ? null : txtRoad.Text; _objCompanyDetailsSetup.Sector = txtSector.Text == string.Empty ? null : txtSector.Text; _objCompanyDetailsSetup.Landmark = txtLandmark.Text == string.Empty ? null : txtLandmark.Text; _objCompanyDetailsSetup.ContactPersonName = txtContactPersonName.Text == string.Empty ? null : txtContactPersonName.Text; _objCompanyDetailsSetup.ContactPersonDesignation = ddlContactPersonDesignation.SelectedValue == "-1" ? null : ddlContactPersonDesignation.SelectedValue; _objCompanyDetailsSetup.ContactPersonContactNumber = txtContactNumber.Text == string.Empty ? null : txtContactNumber.Text; _objCompanyDetailsSetup.AlternateContactPersonName = txtAltContName.Text == string.Empty ? null : txtAltContName.Text; _objCompanyDetailsSetup.AlternateContactPersonDesignation = ddlAltContDesignation.SelectedValue == "-1" ? null : ddlAltContDesignation.SelectedValue; _objCompanyDetailsSetup.AlternateContactPersonContactNumber = txtAltContactNumber.Text == string.Empty ? null : txtAltContactNumber.Text; _objCompanyDetailsSetup.CompanyPhones = txtPhone.Text == string.Empty ? null : txtPhone.Text; _objCompanyDetailsSetup.CompanyFax = txtFax.Text == string.Empty ? null : txtFax.Text; _objCompanyDetailsSetup.CompanyURL = txtURL.Text == string.Empty ? null : txtURL.Text; _objCompanyDetailsSetup.LicenceID = Convert.ToInt32(txtLicence.Text == string.Empty ? null : txtLicence.Text); _objCompanyDetailsSetup.FaceBookID = txtFaceBook.Text == string.Empty ? null : txtFaceBook.Text; _objCompanyDetailsSetup.LinkedInID = txtLinkedInID.Text == string.Empty ? null : txtLinkedInID.Text; _objCompanyDetailsSetup.TwitterID = txtTwitterID.Text == string.Empty ? null : txtTwitterID.Text; _objCompanyDetailsSetup.YouTubeID = txtYouTubeID.Text == string.Empty ? null : txtYouTubeID.Text; _objBusinessType = new BusinessType(); _objBusinessType.BusinessTypeID = ddlBusinessType.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlBusinessType.SelectedValue); _objOwnershipType = new OwnershipType(); _objOwnershipType.OwnershipTypeID = ddlOwnershipType.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlOwnershipType.SelectedValue); _objDistrictSetup = new DistrictSetup(); _objDistrictSetup.DistrictID = ddlDistrict.SelectedValue == "-1" ? Convert.ToInt32(null) : Convert.ToInt32(ddlDistrict.SelectedValue); _objCompanySetupController = new CompanySetupController(); if (btnSave.Text == "Update") { _objCompanyDetailsSetup.CompanyID = Convert.ToInt32(Session["selectedCompanyID"].ToString()); _objCompanySetupController.Update(_objCompanyDetailsSetup); _objCompanySetupController.UpdateByUser(_objCompanyDetailsSetup, _objBusinessType, _objOwnershipType, _objDistrictSetup); } } catch (Exception msgException) { throw msgException; } }
public async Task <IActionResult> Post(OwnershipTypeRequest request) { try { OwnershipType ownershipType = _mapper.Map(request); ownershipType = await _repository.AddAsync(ownershipType); return(CreatedAtAction(nameof(GetById), new { id = ownershipType.Id }, _mapper.Map(ownershipType))); } catch (DataStoreException e) { _logger.LogError(e.Message, e, request); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
private void LoadReceivingUnits() { BLL.Region reg = new BLL.Region(); reg.LoadAll(); lkRegion.Properties.DataSource = reg.DefaultView; BLL.InstitutionType ruType = new InstitutionType(); ruType.Where.IsActive.Value = 1; ruType.Query.Load(); lkRUType.Properties.DataSource = ruType.DefaultView; BLL.OwnershipType ownershipType = new OwnershipType(); ownershipType.LoadAll(); lkOwnership.Properties.DataSource = ownershipType.DefaultView; Route r = new Route(); r.LoadAll(); lkRoute.Properties.DataSource = r.DefaultView; }
public async Task <IActionResult> Delete(Guid id) { try { OwnershipType ownershipType = await _repository.GetByIdAsync(id); if (ownershipType == null) { return(NotFound()); } await _repository.DeleteAsync(ownershipType); return(Ok(id)); } catch (DataStoreException e) { _logger.LogError(e.Message, e, id); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public async Task <IActionResult> Put(Guid id, OwnershipTypeRequest request) { try { OwnershipType ownershipType = await _repository.GetByIdAsync(id); if (ownershipType == null) { return(NotFound()); } _mapper.Map(ownershipType, request); await _repository.UpdateAsync(ownershipType); return(Ok()); } catch (DataStoreException e) { _logger.LogError(e.Message, e, request); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
private void gridItemsView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gridItemsView.GetFocusedDataRow(); lblIssueType.Text = dr["OrderType"] != DBNull.Value ? (string)dr["OrderType"] : "-"; if ((dr["ReceivingUnitID"]) != DBNull.Value) { var ins = new Institution(); ins.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivingUnitID"])); lblRegion.Text = ins.RegionName ?? "-"; lblWoreda.Text = ins.WoredaName ?? "-"; lblZone.Text = ins.ZoneName ?? "-"; var own = new OwnershipType(); own.LoadByPrimaryKey(ins.Ownership); lblOwnership.Text = own.Name ?? "-"; var iss = new Issue(); iss.LoadByPrimaryKey(Convert.ToInt32(dr["STVID"])); if (!iss.IsColumnNull("PaymentTypeID")) { var pType = new PaymentType(); pType.LoadByPrimaryKey(iss.PaymentTypeID); lblPaymentType.Text = pType.Name; } lblPaymentType.Text = "-"; if (!iss.IsColumnNull("VoidRequestDateTime")) { lblVoidRequestedDate.Text = iss.VoidRequestDateTime.ToShortDateString(); } else { lblVoidRequestedDate.Text = "-"; } if (!iss.IsColumnNull("VoidApprovalDateTime")) { lblVoidConfirmedDate.Text = iss.VoidApprovalDateTime.ToShortDateString(); } else { lblVoidConfirmedDate.Text = "-"; } var user = new User(); if (!iss.IsColumnNull("VoidRequestUserID")) { user.LoadByPrimaryKey(iss.VoidRequestUserID); lblVoidRequestedBy.Text = user.FullName; } else { lblVoidRequestedBy.Text = "-"; } if (!iss.IsColumnNull("VoidApprovedByUserID")) { user.LoadByPrimaryKey(iss.VoidApprovedByUserID); lblVoidConfirmedBy.Text = user.FullName; } else { lblVoidConfirmedBy.Text = "-"; } lblInstitutionType.Text = ins.InstitutionTypeName; if (!iss.IsColumnNull("DocumentTypeID")) { lblDocumentType.Text = DocumentType.GetDocumentType(iss.DocumentTypeID).Name; } else { lblDocumentType.Text = ""; } } else { lblRegion.Text = lblWoreda.Text = lblZone.Text = "-"; } lblPrintedDate.Text = string.IsNullOrEmpty((Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString()) ? "-" : (Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString(); lblAccount.Text = string.IsNullOrEmpty(dr["AccountName"].ToString()) ? "-" : dr["AccountName"].ToString(); lblSubAccount.Text = string.IsNullOrEmpty(dr["SubAccountName"].ToString()) ? "-" : dr["SubAccountName"].ToString(); lblActivity.Text = string.IsNullOrEmpty(dr["ActivityName"].ToString()) ? "-" : dr["ActivityName"].ToString(); lblPrintedBy.Text = string.IsNullOrEmpty(dr["IssuedBy"].ToString()) ? "-" : dr["IssuedBy"].ToString(); lblIssueStatus.Text = string.IsNullOrEmpty(dr["Status"].ToString()) ? "-" : dr["Status"].ToString(); int accountid = Convert.ToInt32(dr["AccountID"]); Account account = new Account(); account.LoadByPrimaryKey(accountid); Mode mode = new Mode(); mode.LoadByPrimaryKey(account.ModeID); lblMode.Text = mode.TypeName; }
internal void UpdateByUser(CompanyDetailsSetup objCompanyDetailsSetup, BusinessType objBusinessType, OwnershipType objOwnershipType, DistrictSetup objDistrictSetup) { try { var storedProcedureComandText = "UPDATE [comCompanySetup] " + " SET [CompanyShortName] = ISNULL('" + objCompanyDetailsSetup.CompanyShortName + "',[CompanyShortName]) " + " ,[CompanySlogun] = ISNULL('" + objCompanyDetailsSetup.CompanySlogun + "',[CompanySlogun]) " + " ,[House] = ISNULL('" + objCompanyDetailsSetup.House + "',[House]) " + " ,[Road] = ISNULL('" + objCompanyDetailsSetup.Road + "',[Road]) " + " ,[Sector] = ISNULL('" + objCompanyDetailsSetup.Sector + "',[Sector]) " + " ,[Landmark] = ISNULL('" + objCompanyDetailsSetup.Landmark + "',[Landmark]) " + " ,[ContactPersonName] = ISNULL('" + objCompanyDetailsSetup.ContactPersonName + "',[ContactPersonName]) " + " ,[ContactPersonDesignation] = ISNULL('" + objCompanyDetailsSetup.ContactPersonDesignation + "',[ContactPersonDesignation]) " + " ,[ContactPersonContactNumber] = ISNULL('" + objCompanyDetailsSetup.ContactPersonContactNumber + "',[ContactPersonContactNumber]) " + " ,[AlternateContactPersonName] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonName + "',[AlternateContactPersonName]) " + " ,[AlternateContactPersonDesignation] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonDesignation + "',[AlternateContactPersonDesignation]) " + " ,[AlternateContactPersonContactNumber] = ISNULL('" + objCompanyDetailsSetup.AlternateContactPersonContactNumber + "',[AlternateContactPersonContactNumber]) " + " ,[CompanyPhones] = ISNULL('" + objCompanyDetailsSetup.CompanyPhones + "',[CompanyPhones]) " + " ,[CompanyFax] = ISNULL('" + objCompanyDetailsSetup.CompanyFax + "',[CompanyFax]) " + " ,[CompanyURL] = ISNULL('" + objCompanyDetailsSetup.CompanyURL + "',[CompanyURL]) " + " ,[LicenceID] = ISNULL(" + objCompanyDetailsSetup.LicenceID + ",[LicenceID]) " + " ,[FaceBookID] = ISNULL('" + objCompanyDetailsSetup.FaceBookID + "',[FaceBookID]) " + " ,[LinkedInID] = ISNULL('" + objCompanyDetailsSetup.LinkedInID + "',[LinkedInID]) " + " ,[TwitterID] = ISNULL('" + objCompanyDetailsSetup.TwitterID + "',[TwitterID]) " + " ,[YouTubeID] = ISNULL('" + objCompanyDetailsSetup.YouTubeID + "',[YouTubeID]) " + " ,[BusinessTypeID] = ISNULL(" + objBusinessType.BusinessTypeID + ",[BusinessTypeID]) " + " ,[OwnershipTypeID] = ISNULL(" + objOwnershipType.OwnershipTypeID + ",[OwnershipTypeID]) " + " ,[DistrictID] = ISNULL(" + objDistrictSetup.DistrictID + ",[DistrictID]) " + " ,[LastUpdateDate] = CAST(GETDATE() AS DateTime) " + " ,[LastUpdateUserID] = '160ea939-7633-46a8-ae49-f661d12abfd5' " + " WHERE [CompanyID] = " + objCompanyDetailsSetup.CompanyID + ""; clsDataManipulation.StoredProcedureExecuteNonQuery(this.ConnectionString, storedProcedureComandText); this.UpdateCompanyChart(objCompanyDetailsSetup); } catch (Exception msgException) { throw msgException; } }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewReferences control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs" /> instance containing the event data.</param> private void gridViewReferences_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e != null && e.PrevFocusedRowHandle < -1) { return; } dtDate.Value = DateTimeHelper.ServerDateTime; _reprintId = null; DataRow dr = gridViewReferences.GetFocusedDataRow(); if (dr == null) { return; } string[] referenceNo = new string[2]; referenceNo[0] = dr["RefNo"].ToString(); if (Convert.ToBoolean(dr["isConvertedDN"])) { _isConvertedDn = true; _stvLogIdChosen = (int?)dr["IsReprintOf"]; } else if (dr != null && dr["ID"] != DBNull.Value) { _isConvertedDn = false; _stvLogIdChosen = (int?)dr["ID"]; } UpdateReprintedNumbers(dr); // Enable and disable STV reprint // STV SHouldn't be reprinted off a reprint. if (dr["IsReprintOf"] != DBNull.Value && !Convert.ToBoolean(dr["isConvertedDN"])) { btnExport.Enabled = btnReprint.Enabled = false; var permission = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Print") : true; btnPrint.Enabled = permission; _reprintId = _stvLogIdChosen; _stvLogIdChosen = Convert.ToInt32(dr["IsReprintOf"]); } else if (dr["IsDeliveryNote"] != DBNull.Value && Convert.ToBoolean(dr["IsDeliveryNote"])) { btnExport.Enabled = false; btnReprint.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Re-Print") : true; btnPrint.Enabled = false; } else { btnPrint.Enabled = this.HasPermission("Print"); btnReprint.Enabled = this.HasPermission("Re-Print"); btnExport.Enabled = this.HasPermission("Export"); } if (_stvLogIdChosen != null) { Issue log = new Issue(); log.LoadByPrimaryKey(_stvLogIdChosen.Value); Institution rus = new Institution(); IssueDoc iss = new IssueDoc(); if (!log.IsColumnNull("ReceivingUnitID")) { rus.LoadByPrimaryKey(log.ReceivingUnitID); //FacilityName.Text = rus.Name; HeaderSection.Text = rus.Name; var activity = new Activity(); activity.LoadByPrimaryKey(log.StoreID); lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; lblRegion.Text = rus.RegionName; lblWoreda.Text = rus.WoredaName; lblZone.Text = rus.ZoneName; lblInstType.Text = rus.InstitutionTypeName; var ownership = new OwnershipType(); ownership.LoadByPrimaryKey(rus.Ownership); lblOwnership.Text = ownership.Name; lblVoidConDate.Text = (dr["approvalDate"]) != DBNull.Value ? Convert.ToDateTime(dr["approvalDate"]).ToShortDateString(): "-"; lblIssueType.Text = (string)dr["OrderType"]; User user = new User(); if (dr["approvedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(dr["approvedBy"])); lblConfirmedBy.Text = user.FullName; } else { lblConfirmedBy.Text = "-"; } var doc = new DocumentType(); doc.LoadByPrimaryKey(log.DocumentTypeID); lblDocType.Text = doc.Name; lblPrintedDate.Text = log.PrintedDate.ToShortDateString(); var pt = new PaymentType(); if (!rus.IsColumnNull("PaymentTypeID")) { pt.LoadByPrimaryKey(rus.PaymentTypeID); lblPaymentType.Text = pt.Name; } else { lblPaymentType.Text = "-"; } // Show user name user.LoadByPrimaryKey(log.UserID); lblPrintedBy.Text = (user.FullName == "") ? user.UserName : user.FullName; // show contact person PickList pl = new PickList(); pl.LoadByPrimaryKey(log.PickListID); Order order = new Order(); order.LoadByPrimaryKey(pl.OrderID); var os = new OrderStatus(); os.LoadByPrimaryKey(order.OrderStatusID); lblIssueStatus.Text = os.OrderStatus; if (!order.IsColumnNull("ContactPerson")) { lblRecivedBy.Text = order.ContactPerson; } else { lblRecivedBy.Text = @"-"; } lblReceivedDate.Text = order.EurDate.ToShortDateString(); } dtDate.Value = log.PrintedDate; //PrintedDate.Text = dtDate.Text; lblPrintedDate.Text = dtDate.Text; gridTransactions.DataSource = iss.GetIssueBySTV(_stvLogIdChosen.Value); layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; if (BLL.Settings.ShowMissingSTVsOnIssueLog) { DataView view = iss.GetPossibleUnconfirmedIssues(_stvLogIdChosen.Value); if (view.Count > 0) { gridUnconfirmed.DataSource = view; layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Always; } else { layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; } } } }