public static void CreatePreviousStatus(clsStdCurrentStatus st) { String connectionString = DataManager.OraConnString(); SqlConnection sqlCon = new SqlConnection(connectionString); string selectQuery = @"INSERT INTO [tbl_student_previous_history] ([spi_student_id] ,[spi_previous_roll] ,[spi_class] ,[spi_year] ,[spi_section] ,[spi_version] ,[spi_pomot_date] ,[spi_pomot_by],Tc_flag) VALUES ('" + st.StudentId + "','" + st.Roll + "','" + st.ClassId + "','" + st.ClassYear + "','" + st.Sect + "','" + st.version + "',GETDATE(),'Admin','1')"; DataManager.ExecuteNonQuery(connectionString, selectQuery); string selectQuery1 = @"INSERT INTO [TC_Info] ([Student_Id]) VALUES ('" + st.StudentId + "')"; DataManager.ExecuteNonQuery(connectionString, selectQuery1); string query = " delete from std_current_status where student_id='" + st.StudentId + "' "; DataManager.ExecuteNonQuery(connectionString, query); sqlCon.Close(); }
public static void UpdateCurrentStatus(clsStdCurrentStatus st) { String connectionString = DataManager.OraConnString(); SqlConnection sqlCon = new SqlConnection(connectionString); string selectQuery = @"UPDATE [std_current_status] SET [class_id] ='" + st.ClassId + "',[class_year] ='" + st.ClassYear + "',[sect] ='" + st.Sect + "',[DeptId] ='" + st.DeptId + "',[version] ='" + st.version + "',shift='" + st.Shift + "',[group_name] = '" + st.Group + "',[class_start]= convert(datetime,nullif('" + st.ClassStart + "',''),103),[std_roll] ='" + st.Roll + "',[std_admission_date]=convert(datetime,nullif('" + st.AdmissionDt + "',''),103),PayAmount='" + st.TotalAmount + "',PaidAmount='" + st.PayAmount + "',DueAmount='" + st.DueAmount + "',SheduleStart=convert(date,'" + st.ScheduleTime + "',103),ShehuleEnd=convert(date,'" + st.ScheduleTimeEnd + "',103),ClassTime='" + st.ClassTime + "' WHERE [student_id] ='" + st.StudentId + "'"; DataManager.ExecuteNonQuery(connectionString, selectQuery); sqlCon.Close(); }
public static void DeleteCurrentStatus(clsStdCurrentStatus std) { String connectionString = DataManager.OraConnString(); SqlConnection sqlCon = new SqlConnection(connectionString); string query = " Update std_current_status set DeleteBy='" + std.LogineBy + "',DeleteDate=GETDATE() where student_id='" + std.StudentId + "'"; DataManager.ExecuteNonQuery(connectionString, query); sqlCon.Close(); }
public static void CreateCurrentStatusUpdate(clsStdCurrentStatus st) { String connectionString = DataManager.OraConnString(); SqlConnection sqlCon = new SqlConnection(connectionString); string query = " Update std_current_status set PaidAmount='" + st.PaidAmount + "',Discount='" + st.TotalDiscount + "',DueAmount='" + st.CurrentDue + "',UpdateBy='" + st.LogineBy + "',Pay_Date=convert(date,'" + st.DateUpdate + "',103),UpdateDate=GETDATE() where student_id='" + st.StudentId + "'"; DataManager.ExecuteNonQuery(connectionString, query); sqlCon.Close(); }
protected void btnSave_Click(object sender, EventArgs e) { try{ if (txtChequeDate.Text == "") { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('Please input date...!!');", true); return; } else { clsStdCurrentStatus st = new clsStdCurrentStatus(); st.StudentId = RealID.Text; st.PaidAmount = lblTotalPaid.Text; st.TotalDiscount = TotalDiscount.Text; st.CurrentDue = txtCurrDue.Text; st.DateUpdate = txtChequeDate.Text; if (per.AllowAdd == "Y") { clsStdCurrentStatusManager.CreateCurrentStatusUpdate(st); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('Record(s) is/are created suceessfullly...!!');", true); //Clear(); } } } catch (FormatException fex) { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('" + fex.Message + "');", true); } catch (Exception ex) { if (ex.Message.Contains("Database")) { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('Database Maintain Error. Contact to the Software Provider..!!');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('There is some problem to do the task. Try again properly.!!');", true); } } }
public static clsStdCurrentStatus GetAllStdCurrentStatusForSpecificStd(string studentId) { string connectionString = DataManager.OraConnString(); SqlConnection sqlCon = new SqlConnection(connectionString); try { sqlCon.Open(); string selectQuery = @"SELECT [tracId] ,[AddmisionYear] ,[CourseId] ,[CourseFee] ,[ScheduleId] ,[BatchNo] ,a.[std_admission_date] ,[PreviousCourseID] ,[TrainerName] ,[Discount] ,[Waiver] ,[PayAmount] ,[PaidAmount] ,[DueAmount] FROM [std_current_status] a inner join student_info si on si.ID=a.student_id WHERE si.[student_id]='" + studentId + "'"; SqlCommand cmd = new SqlCommand(selectQuery, sqlCon); SqlDataReader reader = cmd.ExecuteReader(); clsStdCurrentStatus aclsStdCurrentStatusObj = new clsStdCurrentStatus(); if (reader.HasRows) { while (reader.Read()) { aclsStdCurrentStatusObj.tracId = reader[0].ToString(); aclsStdCurrentStatusObj.AddmissionYear = reader[1].ToString(); aclsStdCurrentStatusObj.CourseID = reader[2].ToString(); aclsStdCurrentStatusObj.CourseFee = reader[3].ToString(); aclsStdCurrentStatusObj.ScheduleId = reader[4].ToString(); aclsStdCurrentStatusObj.BatchNo = reader[5].ToString(); aclsStdCurrentStatusObj.AddmissionDate = reader[6].ToString(); aclsStdCurrentStatusObj.PreviousCourseID = reader[7].ToString(); aclsStdCurrentStatusObj.FacultyID = reader[8].ToString(); aclsStdCurrentStatusObj.Discount = reader[9].ToString(); aclsStdCurrentStatusObj.Waiver = reader[10].ToString(); aclsStdCurrentStatusObj.TotalAmount = reader[11].ToString(); aclsStdCurrentStatusObj.PayAmount = reader[12].ToString(); aclsStdCurrentStatusObj.DueAmount = reader[13].ToString(); } } return(aclsStdCurrentStatusObj); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (sqlCon.State == ConnectionState.Open) { sqlCon.Close(); } } }
public static void CreateCurrentStatus(clsStdCurrentStatus cnt) { //String connectionString = DataManager.OraConnString(); //SqlConnection sqlCon = new SqlConnection(connectionString); //string query = "insert into std_current_status(student_id,class_id,class_year,shift,DeptId,sect,version,group_name,class_start,std_roll,std_admission_date) values ('" + cnt.StudentId + "','" + cnt.ClassId + "','" + cnt.ClassYear + "','" + cnt.Shift + "','" + cnt.DeptId + "','" + cnt.Sect + "','" + cnt.version + "','" + cnt.Group + "', convert(datetime,nullif('" + cnt.ClassStart + "',''),103),'" + cnt.Roll + "', convert(datetime,nullif('" + cnt.AdmissionDt + "',''),103))"; //DataManager.ExecuteNonQuery(connectionString, query); //sqlCon.Close(); SqlConnection connection = new SqlConnection(DataManager.OraConnString()); SqlTransaction transection; try { connection.Open(); transection = connection.BeginTransaction(); SqlCommand command = new SqlCommand(); command.Connection = connection; command.Transaction = transection; SqlCommand command1 = new SqlCommand(); command1.Connection = connection; command1.Transaction = transection; command.CommandText = @"SELECT TOP(1)[ID] FROM [student_info] ORDER BY ID DESC"; int ID = Convert.ToInt32(command.ExecuteScalar()); string ClassTime = cnt.ClassTime + ":" + cnt.APMTime; command1.CommandText = @"INSERT INTO [std_current_status] ([student_id],[tracId],[AddmisionYear],[CourseId],[CourseFee],[ScheduleId],[BatchNo],[std_admission_date],[PreviousCourseID],[EntryBy],[EntryDate],[TrainerName],[Discount],[Waiver],[PayAmount],[PaidAmount],[DueAmount],Pay_Date,SheduleStart,ShehuleEnd,ClassTime,CertificateDate) values ('" + ID + "','" + cnt.TracID + "','" + cnt.AddmissionYear + "','" + cnt.CourseID + "','" + cnt.CourseFee + "','" + cnt.ScheduleId + "','" + cnt.BatchNo + "',convert(date,'" + cnt.AddmissionDate + "',103),'" + cnt.PreviousCourseID + "','" + cnt.LogineBy + "',GETDATE(),'" + cnt.FacultyID + "','" + cnt.Discount + "','" + cnt.Waiver + "','" + cnt.TotalAmount + "','" + cnt.PayAmount + "','" + cnt.DueAmount + "',GETDATE(),convert(date,'" + cnt.ScheduleTime + "',103),convert(date,'" + cnt.ScheduleTimeEnd + "',103),'" + ClassTime + "',convert(date,'" + cnt.CertificateDate + "',103) )"; command1.ExecuteNonQuery(); command.CommandText = @"INSERT INTO [Day_Information] ([StudentID] ,[StarDay] ,[Sunday] ,[MonDay] ,[TusesDay] ,[WednessDay] ,[ThusDay] ,[Friday]) VALUES ('" + ID + "','" + cnt.SatDay + "','" + cnt.SunDay + "','" + cnt.MonDay + "','" + cnt.TuesDay + "','" + cnt.WednessDay + "','" + cnt.ThusDay + "','" + cnt.FriDay + "')"; command.ExecuteNonQuery(); transection.Commit(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } } }