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); }
public static DataResultArgs <DataSet> ExecuteProcDataSet(SqlConnection connection, SqlCommand cmd, string storeProcedureName) { DataResultArgs <DataSet> dtrslt = new DataResultArgs <DataSet>(); try { DataSet ds = new DataSet(); cmd.Connection = connection; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = storeProcedureName; SqlDataAdapter sadp = new SqlDataAdapter(cmd); sadp.Fill(ds); dtrslt.Result = ds; } catch (System.Data.Common.DbException dbException) { dtrslt.Result = null; dtrslt.ErrorCode = 0; dtrslt.HasError = true; dtrslt.ErrorDescription = dbException.Message.ToString(); } return(dtrslt); }
public DataResultArgs <string> Set_Payment(PaymentEntity entity) { try { DataProcess.ControlAdminAuthorization(true); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DatabaseProcess", entity.DatabaseProcess); cmd.Parameters.AddWithValue("@id", entity.Id); cmd.Parameters.AddWithValue("@studentId", entity.StudentId); cmd.Parameters.AddWithValue("@year", entity.Year); cmd.Parameters.AddWithValue("@month", entity.Month); cmd.Parameters.AddWithValue("@amount", entity.Amount); cmd.Parameters.AddWithValue("@isPayment", entity.IsPayment); cmd.Parameters.AddWithValue("@paymentDate", entity.PaymentDate); cmd.Parameters.AddWithValue("@paymentType", entity.PaymentType); cmd.Parameters.AddWithValue("@isActive", entity.IsActive); cmd.Parameters.AddWithValue("@isNotPayable", entity.IsNotPayable); cmd.Parameters.AddWithValue("@isChangeAmountPaymentNotOK", entity.IsChangeAmountPaymentNotOK); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <string> resultSet = DataProcess.ExecuteProcString(con, cmd, "set_Payment"); con.Close(); return(resultSet); } } catch (Exception e) { DataResultArgs <string> result = new DataResultArgs <string>(); result.HasError = true; result.ErrorDescription = e.Message; return(result); } }
private void setDefaultValues() { DataResultArgs <List <StudentEntity> > resultSet = new DataResultArgs <List <StudentEntity> >(); resultSet = new StudentBusiness().Get_Student(new SearchEntity() { IsDeleted = false }); if (!resultSet.HasError) { List <StudentEntity> entityList = resultSet.Result; IEnumerable <StudentEntity> currentList = entityList.Where(o => o.IsStudent == true && o.IsActive == true); setLabel(currentList, lblActiveStudent, "Aktif"); currentList = entityList.Where(o => o.IsStudent == true && o.IsActive == false); setLabel(currentList, lblPassiveStudent, "Pasif"); currentList = entityList.Where(o => o.IsStudent == false); setLabel(currentList, lblInterview, "Görüşme"); setLabel(entityList, lblAllStudent, "Toplam"); } }
public DataResultArgs <StudentEntity> Get_Student(int studentId) { DataProcess.ControlAdminAuthorization(); DataResultArgs <StudentEntity> resultSet = new DataResultArgs <StudentEntity>(); DataResultArgs <List <StudentEntity> > studentList = Get_Student(new SearchEntity() { Id = studentId }); if (studentList.HasError) { resultSet.HasError = studentList.HasError; resultSet.ErrorDescription = studentList.ErrorDescription; resultSet.MyException = studentList.MyException; } else { resultSet.Result = studentList.Result.FirstOrDefault(); } return(resultSet); }
private void setDefaultValues() { DataResultArgs <List <StudentEntity> > resultSet = new DataResultArgs <List <StudentEntity> >(); resultSet = new StudentBusiness().Get_Student(new SearchEntity() { IsDeleted = false }); if (!resultSet.HasError) { List <StudentEntity> entityList = resultSet.Result; List <StudentEntity> currentList = entityList.Where(o => o.IsStudent == true).ToList(); setLabel(currentList, lblStudent); currentList = entityList.Where(o => o.IsStudent == true && o.AddedOn > DateTime.Now.AddMonths(-1)).ToList(); setLabel(currentList, lblMonthStudent); currentList = entityList.Where(o => o.IsStudent == false).ToList(); setLabel(currentList, lblInterview); currentList = entityList.Where(o => o.IsStudent == false && o.AddedOn > DateTime.Now.AddMonths(-1)).ToList(); setLabel(currentList, lblMonthInterview); currentList = entityList.Where(o => o.Birthday != null && o.Birthday.Value > DateTime.MinValue && new DateTime(DateTime.Today.Year, o.Birthday.Value.Month, o.Birthday.Value.Day) == DateTime.Today).ToList(); setBirthdayInfo(currentList.OrderBy(o => o.BirthDayCurrentYear).ToList(), lblBirthdayToday); currentList = entityList.Where(o => o.Birthday != null && o.Birthday.Value > DateTime.MinValue && new DateTime(DateTime.Today.Year, o.Birthday.Value.Month, o.Birthday.Value.Day) < DateTime.Today.AddMonths(1) && new DateTime(DateTime.Today.Year, o.Birthday.Value.Month, o.Birthday.Value.Day) > DateTime.Today).ToList(); setBirthdayInfo(currentList.OrderBy(o => o.BirthDayCurrentYear).ToList(), lblBirthdayThisMonth); } }
private void processToDatabase(DatabaseProcess databaseProcess) { StudentEntity entity = new StudentEntity(); entity.DatabaseProcess = databaseProcess; entity.Id = GeneralFunctions.GetData <Int32>(hdnId.Value); entity.CitizenshipNumber = txtTckn.Text; entity.Name = txtName.Text; entity.Surname = txtSurname.Text; entity.MiddleName = txtMiddleName.Text; entity.FatherName = txtFatherName.Text; entity.MotherName = txtMotherName.Text; if (!string.IsNullOrEmpty(txtBirthday.Text)) { entity.Birthday = GeneralFunctions.GetData <DateTime>(txtBirthday.Text); } entity.FatherPhoneNumber = txtFatherPhoneNumber.Text; entity.MotherPhoneNumber = txtMotherPhoneNumber.Text; entity.IsActive = chcIsActive.Checked; entity.IsStudent = drpStudentState.SelectedValue == "0"; entity.Notes = txtNotes.Text; entity.DateOfMeeting = GeneralFunctions.GetData <DateTime>(txtDateOfMeeting.Text); entity.SpokenPrice = GeneralFunctions.GetData <decimal>(txtSpokenPrice.Text); entity.Email = txtEmail.Text; if (entity.DatabaseProcess == DatabaseProcess.Add) { entity.IsAddAfterPaymentUnPayment = true; } if (hdnStudentState.Value == "1" && entity.IsStudent) { entity.IsAddAfterPaymentUnPayment = true; } DataResultArgs <StudentEntity> resultSet = business.Set_Student(entity); if (resultSet.HasError) { divInformation.ErrorText = resultSet.ErrorDescription; return; } else { if (databaseProcess == DatabaseProcess.Deleted) { divInformation.SuccessfulText = RecordMessage.Delete; pnlBody.Enabled = false; } else { divInformation.SuccessfulText = (databaseProcess == DatabaseProcess.Add) ? RecordMessage.Add : RecordMessage.Update; btnSubmit.Text = ButtonText.Submit; pnlBody.Enabled = false; if (entity.IsStudent) { divInformation.SetAnotherText("<a href = \"PaymentDetail.aspx?Id=" + resultSet.Result.EncryptId + "\">" + paymentDetail + "</a>"); } else { btnPaymentDetail.Visible = false; } } } }
public DataResultArgs <StudentEntity> Set_Student(StudentEntity entity) { try { DataProcess.ControlAdminAuthorization(true); if (entity.Id > 0 && entity.DatabaseProcess == DatabaseProcess.Add) { entity.DatabaseProcess = DatabaseProcess.Update; } DataResultArgs <StudentEntity> resultSet = new DataResultArgs <StudentEntity>(); resultSet.Result = entity; SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DatabaseProcess", entity.DatabaseProcess); cmd.Parameters.AddWithValue("@id", entity.Id); cmd.Parameters.AddWithValue("@citizenshipNumber", entity.CitizenshipNumber); cmd.Parameters.AddWithValue("@name", entity.Name); cmd.Parameters.AddWithValue("@surname", entity.Surname); cmd.Parameters.AddWithValue("@middleName", entity.MiddleName); cmd.Parameters.AddWithValue("@fatherName", entity.FatherName); cmd.Parameters.AddWithValue("@motherName", entity.MotherName); cmd.Parameters.AddWithValue("@birthday", entity.Birthday); cmd.Parameters.AddWithValue("@fatherPhoneNumber", entity.FatherPhoneNumber); cmd.Parameters.AddWithValue("@motherPhoneNumber", entity.MotherPhoneNumber); cmd.Parameters.AddWithValue("@isActive", entity.IsActive); cmd.Parameters.AddWithValue("@isStudent", entity.IsStudent); cmd.Parameters.AddWithValue("@notes", entity.Notes); cmd.Parameters.AddWithValue("@dateOfMeeting", entity.DateOfMeeting); cmd.Parameters.AddWithValue("@spokenPrice", entity.SpokenPrice); cmd.Parameters.AddWithValue("@email", entity.Email); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <string> currentResultSet = DataProcess.ExecuteProcString(con, cmd, "set_Student"); con.Close(); resultSet.HasError = currentResultSet.HasError; resultSet.ErrorDescription = currentResultSet.ErrorDescription; resultSet.MyException = currentResultSet.MyException; if (entity.DatabaseProcess == DatabaseProcess.Add && !currentResultSet.HasError) { resultSet.Result.Id = GeneralFunctions.GetData <Int32>(currentResultSet.Result); entity.Id = GeneralFunctions.GetData <Int32>(currentResultSet.Result); } } if (entity.IsAddAfterPaymentUnPayment) { List <PaymentTypeEntity> paymentTypeList = new PaymentTypeBusiness().Get_PaymentType(); foreach (PaymentTypeEntity paymentTypeEntity in paymentTypeList) { for (int i = 1; i < DateTime.Today.Month; i++) { PaymentEntity paymentEntity = new PaymentEntity(); paymentEntity.Id = 0; paymentEntity.DatabaseProcess = DatabaseProcess.Add; paymentEntity.Year = (short)DateTime.Today.Year; paymentEntity.StudentId = entity.Id; paymentEntity.IsNotPayable = true; paymentEntity.IsActive = true; paymentEntity.IsDeleted = false; paymentEntity.Month = (short)i; paymentEntity.IsPayment = false; paymentEntity.Amount = ((PaymentTypeEnum)paymentTypeEntity.Id == PaymentTypeEnum.Okul && entity.SpokenPrice.HasValue && entity.SpokenPrice.Value > 0) ? entity.SpokenPrice.Value : paymentTypeEntity.Amount; paymentEntity.PaymentType = paymentTypeEntity.Id; paymentEntity.AddedOn = DateTime.Now; new PaymentBusiness().Set_Payment(paymentEntity); } } } AllStudentWithCache = null; Get_AllStudentWithCache(); return(resultSet); } catch (Exception e) { DataResultArgs <StudentEntity> result = new DataResultArgs <StudentEntity>(); result.HasError = true; result.ErrorDescription = e.Message; return(result); } }