public List <PaymentTypeEntity> GetPaymentAllPaymentType() { List <PaymentTypeEntity> result = new PaymentTypeBusiness().Get_PaymentType(new SearchEntity() { IsDeleted = false }).Result; return(result); }
public IHttpActionResult ChangeActivePaymentType(int idPaymentType, bool isActive) { try { var paymentTypeDTO = new PaymentTypeBusiness().ChangeActivePaymentType(idPaymentType, isActive); return(Ok(paymentTypeDTO)); } catch (Exception ex) { return(BadRequest(ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public DataResultArgs <PaymentTypeEntity> UpdatePaymentType(string id) { DataResultArgs <PaymentTypeEntity> result = new DataResultArgs <PaymentTypeEntity> { HasError = true, ErrorDescription = "Entity ulaşılamadı..." }; if (!string.IsNullOrEmpty(id)) { int.TryParse(Cipher.Decrypt(id), out var idInt); if (idInt > 0) { result = new PaymentTypeBusiness().Get_PaymentTypeWithId(GeneralFunctions.GetData <int>(id)); if (result.Result != null) { result.HasError = false; } } } return(result); }
public DataResultArgs <bool> DeletePaymentType(string id) { DataResultArgs <bool> result = new DataResultArgs <bool> { HasError = true, ErrorDescription = "Id bilgisine ulaşılamadı." }; if (!string.IsNullOrEmpty(id)) { int.TryParse(Cipher.Decrypt(id), out var idInt); if (idInt > 0) { PaymentTypeEntity entity = new PaymentTypeEntity { Id = idInt, DatabaseProcess = DatabaseProcess.Deleted }; result = new PaymentTypeBusiness().Set_PaymentType(entity); } } return(result); }
private void InitializeDocumentAndSave(StudentEntity entity, string fileName) { DataResultArgs <List <PaymentTypeEntity> > resultSet = new PaymentTypeBusiness().Get_PaymentType(new SearchEntity() { IsActive = true, IsDeleted = false }); List <EmailPaymentEntity> emailPaymentList = GetEmailPaymentList(resultSet.Result, entity.PaymentList); Dictionary <int, string> selectedMonthList = GetSelectedMonthList(); string templatePath = Server.MapPath("/Template"); byte[] byteArray = File.ReadAllBytes(templatePath + "/odemePlani2.docx"); using (MemoryStream stream = new MemoryStream()) { stream.Write(byteArray, 0, (int)byteArray.Length); using (WordprocessingDocument doc = WordprocessingDocument.Open(stream, true)) { setFullName(doc, entity.FullName); DocumentFormat.OpenXml.Wordprocessing.Table table = doc.MainDocumentPart.Document.Body.Elements <DocumentFormat.OpenXml.Wordprocessing.Table>().First(); AddWordCell(selectedMonthList, emailPaymentList, table); } // Save the file with the new name File.WriteAllBytes(fileName + ".docx", stream.ToArray()); FileStream fs = new FileStream(fileName + ".docx", FileMode.OpenOrCreate, FileAccess.Read); fs.Flush(); fs.Close(); GC.Collect(); } }
protected void Page_Load(object sender, EventArgs e) { divInformation.InformationVisible = false; divInformation.ListRecordPage = "PaymentPlan.aspx"; divInformation.SetVisibleLink(true, false); if (this.Master is kindergarten master) { master.SetActiveMenuAttiributes(MenuList.PaymentPlan); master.SetVisibleSearchText(false); } if (!Page.IsPostBack) { btnSendEmailCopy.Attributes.Add("Style", "display:none;"); object Id = Request.QueryString["Id"]; if (Id == null) { divInformation.ErrorText = studentDoesNotFound; divInformation.ErrorLinkText = "Ödeme Listesi için tıklayınız ..."; divInformation.ErrorLink = "PaymentPlan.aspx"; } string IdDecrypt = Cipher.Decrypt(Id.ToString()); int id = GeneralFunctions.GetData <int>(IdDecrypt); if (id <= 0) { divInformation.ErrorText = studentDoesNotFound; divInformation.ErrorLinkText = "Ödeme Listesi için tıklayınız ..."; divInformation.ErrorLink = "PaymentPlan.aspx"; } else { int width = 15; int height = 15; StudentEntity entity = new StudentBusiness().Get_StudentWithPaymentList(id); lblStudentInto.Text = "<a href = \"AddStudent.aspx?Id=" + entity.EncryptId + "\">" + entity.FullName.ToUpper() + "</a> "; lblStudentInto.Text += "<a href= 'PaymentDetail.aspx?Id=" + entity.EncryptId + "'><img title='Ödeme Detayı' src ='img/icons/paymentPlan.png'/></a>"; hdnStudentName.Value = entity.FullName; txtEmail.Text = entity.Email; DataResultArgs <List <PaymentTypeEntity> > resultSet = new PaymentTypeBusiness().Get_PaymentType(new SearchEntity() { IsActive = true, IsDeleted = false }); if (resultSet.HasError) { divInformation.ErrorText = resultSet.ErrorDescription; } else { StringBuilder sb = new StringBuilder(); sb.AppendLine( @"<table class='table mb - 0'><thead><tr><th scope='col'><input type='checkbox' id='chc_All' name='chc_All' year='" + DateTime.Today.Year.ToString() + "' onclick =chcAllChange(); /></th> <th scope='col'>Ay</th>"); List <PaymentTypeEntity> paymentTypeList = resultSet.Result; foreach (PaymentTypeEntity payment in paymentTypeList) { sb.AppendLine("<th scope='col'>" + payment.Name + "</th>"); } var monthList = GetMonthList(); foreach (int month in monthList.Keys) { var uniqueName = "_" + DateTime.Today.Year.ToString() + "_" + month; var chcPaymentName = "chc" + uniqueName; string isCheck = ""; if (DateTime.Today.Month == month) { isCheck = "checked='checked'"; hdnSelectedMonth.Value = "" + month + ",'" + monthList[month] + "'"; } sb.AppendLine("<tr>"); sb.AppendLine("<td><input type='checkbox' id='" + chcPaymentName + "' name='" + chcPaymentName + "' onclick =chcChange(); " + isCheck + " /></td>"); sb.AppendLine("<td>" + monthList[month] + "</td>"); foreach (PaymentTypeEntity payment in paymentTypeList) { PaymentEntity paymentEntity = entity.PaymentList.FirstOrDefault(o => o.Month == month && o.Year == DateTime.Today.Year && o.PaymentType == payment.Id); if (paymentEntity != null) { if (paymentEntity.IsNotPayable) { sb.AppendLine("<td> - </td>"); } else if (paymentEntity.IsPayment.HasValue) { if (paymentEntity.IsPayment.Value) { sb.AppendLine( "<td><table cellpadding='4'><tr style='vertical-align: middle'><td>" + paymentEntity.AmountDesc + "</td><td><img width='" + width + "' height='" + height + "' src=\"img/icons/greenSmile2.png\"/></td></tr></table></td>"); } else { sb.AppendLine( "<td><table cellpadding='4'><tr style='vertical-align: middle' ><td>" + paymentEntity.AmountDesc + "</td><td><img width='" + width + "' height='" + height + "' src=\"img/icons/unPayment2.png\"/></td></tr></table></td>"); } } else { sb.AppendLine( "<td><table cellpadding='4'><tr style='vertical-align: middle'><td>" + paymentEntity.AmountDesc + "</td><td><img width='" + width + "' height='" + height + "' src=\"img/icons/unPayment2.png\"/></td></tr></table></td>"); } } else { sb.AppendLine("<td><table cellpadding='4'><tr style='vertical-align: middle'><td>" + payment.AmountDesc + "</td><td><img width='" + width + "' height='" + height + "' src=\"img/icons/unPayment2.png\"/></td></tr></table></td>"); } } sb.AppendLine("</tr>"); } sb.AppendLine(@"</tr></thead>"); sb.AppendLine("</table>"); divMain.InnerHtml = sb.ToString(); } } } }