private void SaveCommonDummyNumber(List <string> lstDummys, string examMonth, string examYear, byte serialORrandom, Dictionary <string, int> dicColStudCnt) { try { string delQ = "delete from dummynumbernew where exam_month='" + examMonth + "' and exam_year='" + examYear + "' and dummy_type='" + serialORrandom + "' and isnull(subject,'')='' and DCollegeCode in (" + collegeCode + ") "; dirAccess.deleteData(delQ); int loopCnt = 0; foreach (KeyValuePair <string, int> colStud in dicColStudCnt) { int studCnt = colStud.Value; string colCode = colStud.Key; for (int dummyI = loopCnt, iniiCnt = 0; loopCnt < lstDummys.Count; loopCnt++, iniiCnt++) { string insQ = "insert into dummynumbernew (exam_month, exam_year, dummy_no, dummy_type,DCollegeCode) values('" + examMonth + "', '" + examYear + "', '" + lstDummys[loopCnt] + "', '" + serialORrandom + "','" + colCode + "')"; dirAccess.insertData(insQ); if (iniiCnt == studCnt) { break; } } } //ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "alert('Generated Successfully')", true); lblAlertMsg.Text = "Generated Successfully"; divPopAlert.Visible = true; } catch { //ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "alert('Please Try Later')", true); lblAlertMsg.Text = "Please Try Later"; divPopAlert.Visible = true; } }
public void savestafffortest() { try { // spreadDet1.SaveChanges(); bool isSave = false; // int activeRow = spreadDet1.ActiveSheetView.ActiveRow; // int activeColumn = spreadDet1.ActiveSheetView.ActiveColumn; string selecttest = string.Empty; string internalseatingSaveqry = string.Empty; string internalseatingupdateqry = string.Empty; staff_code = (string)Session["Staff_Code"]; DataTable dsstaffcode = new DataTable(); DataTable dtdeletestaff = new DataTable(); internalseatingupdateqry = "update internalSeatingArragement set staff_code='' where staff_code='" + staff_code + "'"; dtdeletestaff.Clear(); int a = dirAcc.updateData(internalseatingupdateqry); //DeleteQry = "delete from qPaperSetterStaff where subjectNo='" + SubjectNo + "' and examYear='" + examyear + "' and examMonth='" + exammonth + "'"; //int a = dirAcc.deleteData(DeleteQry); foreach (GridViewRow row in GridView1.Rows) { int selected = 0; int selected1 = 0; CheckBox chkfn = (CheckBox)row.FindControl("cb_fn"); if (chkfn.Checked == true) { selected = 1; } CheckBox chan = (CheckBox)row.FindControl("cb_an"); if (chan.Checked == true) { selected1 = 1; } if (selected == 1 || selected1 == 1) { Label tstno = (Label)row.FindControl("lbltestno"); string criteriano = tstno.Text; if (String.IsNullOrEmpty(selecttest)) { selecttest = criteriano; } else { selecttest += ";" + criteriano; } } } string[] split = selecttest.Split(';'); if (split.Length > 0) { string testno = split[0]; for (int i = 0; i < split.Length; i++) { testno = split[i]; if (!string.IsNullOrEmpty(staff_code) && !string.IsNullOrEmpty(testno)) { internalseatingSaveqry = "if exists(select distinct isa.hallNo,isa.criteriaNo,isa.examDate,isa.examSession,isa.examCode from internalSeatingArragement isa where isa.criteriaNo in('" + testno + "')) update internalSeatingArragement set staff_code='" + staff_code + "' where criteriaNo in('" + testno + "')"; //internalseatingSaveqry = "if exists(select distinct isa.hallNo,isa.criteriaNo,isa.examDate,isa.examSession,isa.examCode from internalSeatingArragement isa where isa.criteriaNo in('" + testno + "')) insert into internalSeatingArragement (staff_code)values('" + staff_code + "')"; dsstaffcode.Clear(); int res = dirAcc.insertData(internalseatingSaveqry); if (res != 0) { isSave = true; } } } } if (isSave) { alertpopwindow.Visible = true; lblalerterr.Text = "Saved SuccessFully"; } } catch { } }
protected void btnSaveSettings_OnClick(object sender, EventArgs e) { try { string subNo = Convert.ToString(ddlsubject.SelectedValue); if (!string.IsNullOrEmpty(subNo)) { int del = dir.deleteData("delete COThresholdSettings where Subject_NO='" + subNo + "'"); int count = 0; foreach (GridViewRow grid in GridView1.Rows) { string coId = Convert.ToString((grid.FindControl("CoId") as Label).Text); string ddlKo = Convert.ToString((grid.FindControl("ddlknw") as DropDownList).SelectedValue); string ddlpo1 = Convert.ToString((grid.FindControl("ddlpo1") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo1)) { ddlpo1 = "null"; } string ddlpo2 = Convert.ToString((grid.FindControl("ddlpo2") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo2)) { ddlpo2 = "null"; } string ddlpo3 = Convert.ToString((grid.FindControl("ddlpo3") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo3)) { ddlpo3 = "null"; } string ddlpo4 = Convert.ToString((grid.FindControl("ddlpo4") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo4)) { ddlpo4 = "null"; } string ddlpo5 = Convert.ToString((grid.FindControl("ddlpo5") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo5)) { ddlpo5 = "null"; } string ddlpo6 = Convert.ToString((grid.FindControl("ddlpo6") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo6)) { ddlpo6 = "null"; } string ddlpo7 = Convert.ToString((grid.FindControl("ddlpo7") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo7)) { ddlpo7 = "null"; } string ddlpo8 = Convert.ToString((grid.FindControl("ddlpo8") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo8)) { ddlpo8 = "null"; } string ddlpo9 = Convert.ToString((grid.FindControl("ddlpo9") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo9)) { ddlpo9 = "null"; } string ddlpo10 = Convert.ToString((grid.FindControl("ddlpo10") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo10)) { ddlpo10 = "null"; } string ddlpo11 = Convert.ToString((grid.FindControl("ddlpo11") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo11)) { ddlpo11 = "null"; } string ddlpo12 = Convert.ToString((grid.FindControl("ddlpo12") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo12)) { ddlpo12 = "null"; } string ddlpo13 = Convert.ToString((grid.FindControl("ddlpo13") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo13)) { ddlpo13 = "null"; } string ddlpo14 = Convert.ToString((grid.FindControl("ddlpo14") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo14)) { ddlpo14 = "null"; } string ddlpo15 = Convert.ToString((grid.FindControl("ddlpo15") as DropDownList).SelectedValue); if (string.IsNullOrEmpty(ddlpo15)) { ddlpo15 = "null"; } string txtDes = Convert.ToString((grid.FindControl("txtDesc") as TextBox).Text); string txtTarget = Convert.ToString((grid.FindControl("txtTarget") as TextBox).Text); string textThres = Convert.ToString((grid.FindControl("txtThreshold") as TextBox).Text); if (!string.IsNullOrEmpty(coId) && !string.IsNullOrEmpty(ddlKo) && !string.IsNullOrEmpty(txtDes) && !string.IsNullOrEmpty(txtTarget) && !string.IsNullOrEmpty(textThres)) { double Target = 0; double Thres = 0; double.TryParse(txtTarget, out Target); double.TryParse(textThres, out Thres); if (Thres < Target) { string insert = "insert into COThresholdSettings (Subject_NO,CourseID,Knowledgeid,Description,Target,Threshold,po1,po2,po3,po4,po5,po6,po7,po8,po9,po10,po11,po12,po13,po14,po15) values ('" + subNo + "','" + coId + "','" + ddlKo + "','" + txtDes + "','" + Target + "','" + Thres + "'," + ddlpo1 + "," + ddlpo2 + "," + ddlpo3 + "," + ddlpo4 + "," + ddlpo5 + "," + ddlpo6 + "," + ddlpo7 + "," + ddlpo8 + "," + ddlpo9 + "," + ddlpo10 + "," + ddlpo11 + "," + ddlpo12 + "," + ddlpo13 + "," + ddlpo14 + "," + ddlpo15 + ")"; int val = dir.insertData(insert); count = val + count; } } } if (count > 0) { divpopalter.Visible = true; lblaltermsgs.Visible = true; lblaltermsgs.Text = "Saved Successfuly!"; } else { divpopalter.Visible = true; lblaltermsgs.Visible = true; lblaltermsgs.Text = "Not Saved!"; } } else { divpopalter.Visible = true; lblaltermsgs.Visible = true; lblaltermsgs.Text = "Subject Not found!"; } } catch { } }
protected void CertificateSave() { try { string degreecode = string.Empty; string batchyear = string.Empty; string courseid = string.Empty; string educationlevel = string.Empty; string semester = string.Empty; string FinyearFk = string.Empty; string feecatagory = string.Empty; string collegecode = string.Empty; string CertificateId = string.Empty; string edulevel = string.Empty; string value = string.Empty; bool insert_check = false; int feeallotins = 0; Requestcode(); if (ddlcollege.Items.Count > 0 && ddl_feecatagory.Items.Count > 0) { collegecode = Convert.ToString(ddlcollege.SelectedItem.Value); semester = Convert.ToString(ddl_feecatagory.SelectedItem.Text).Split(' ')[0]; if (Convert.ToString(ViewState["linkName"]).ToUpper() == "TERM") { semester = "1";//Convert.ToString(ddl_feecatagory.SelectedItem.Text).Split(' ')[1] + " "; } batchyear = rs.GetSelectedItemsValueAsString(cbl_batch); degreecode = rs.GetSelectedItemsValueAsString(cbl_branch); FinyearFk = Convert.ToString(ddl_finyear.SelectedItem.Value); feecatagory = Convert.ToString(ddl_feecatagory.SelectedItem.Value); CertificateId = rs.GetSelectedItemsValueAsString(cbl_certificate); courseid = rs.GetSelectedItemsValueAsString(cbl_degree); edulevel = rs.GetSelectedItemsValueAsString(cbl_edu); if (!string.IsNullOrEmpty(batchyear.Trim()) && !string.IsNullOrEmpty(degreecode.Trim()) && !string.IsNullOrEmpty(semester.Trim()) && !string.IsNullOrEmpty(collegecode.Trim()) && !string.IsNullOrEmpty(feecatagory) && !string.IsNullOrEmpty(FinyearFk)) { ds.Clear(); string certQ = " select App_No,r.degree_code,Batch_Year,c.Edu_Level,c.Course_Id from Registration r, degree d,Department dt,Course C where d.Degree_Code =r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id =d.Course_Id and r.CC='0' and DelFlag='0' and Exam_Flag<>'DEBAR' and r.degree_code in('" + degreecode + "') and Batch_Year in('" + batchyear + "') and r.current_semester='" + semester + "' and r.college_code='" + collegecode + "'"; certQ += " select certificate_amount,m.certificate_id,c.CertificateName,m.batchyear,m.edulevel,m.courseid, m.degreecode,m.financialyear, m.collegecode,m.Feecategory,d.headerfk,d.ledgerfk,h.HeaderName,l.LedgerName from Certificate_settingDet d,Certificate_settingmaster m,CertificateNameDetail c,FM_HeaderMaster h,FM_LedgerMaster l where h.CollegeCode=l.CollegeCode and m.Collegecode=l.CollegeCode and h.HeaderPK=l.HeaderFK and l.HeaderFK=d.HeaderFK and l.LedgerPK=d.LedgerFK and c.Certificate_ID=m.Certificate_ID and m.certificatepk=d.certificatefk and m.certificate_id in('" + CertificateId + "') and m.batchyear in('" + batchyear + "') and m.edulevel in('" + edulevel + "') and m.courseid in('" + courseid + "') and m.degreecode in('" + degreecode + "') and m.financialyear='" + FinyearFk + "' and m.collegecode='" + collegecode + "' and m.Feecategory='" + feecatagory + "'"; ds = da.selectDataSet(certQ); if (ds.Tables[0].Rows.Count > 0 && ds.Tables != null && ds.Tables[1].Rows.Count > 0) { FpSpread1.SaveChanges(); for (int i = 1; i < FpSpread1.Sheets[0].RowCount; i++) { value = Convert.ToString(FpSpread1.Sheets[0].Cells[i, 1].Value); if (value == "1") { string AppNo = Convert.ToString(FpSpread1.Sheets[0].GetTag(i, 1)); DataView StudentDet = new DataView(); ds.Tables[0].DefaultView.RowFilter = " App_No='" + AppNo + "'"; StudentDet = ds.Tables[0].DefaultView; foreach (DataRowView dr in StudentDet) { degreecode = Convert.ToString(dr["degree_code"]); batchyear = Convert.ToString(dr["Batch_Year"]); edulevel = Convert.ToString(dr["Edu_Level"]); courseid = Convert.ToString(dr["Course_Id"]); } DataView StudentCertFeeDet = new DataView(); string insupdQ = string.Empty; for (int C = 0; C < cbl_certificate.Items.Count; C++) { if (cbl_certificate.Items[C].Selected) { CertificateId = Convert.ToString(cbl_certificate.Items[C].Value); ds.Tables[1].DefaultView.RowFilter = " certificate_id='" + CertificateId + "' and batchyear='" + batchyear + "' and edulevel='" + edulevel + "' and courseid='" + courseid + "' and degreecode in('" + degreecode + "') and financialyear='" + FinyearFk + "' and collegecode='" + collegecode + "' and Feecategory='" + feecatagory + "'"; StudentCertFeeDet = ds.Tables[1].DefaultView; #region Request Insert Process string requestcode = Convert.ToString(ViewState["requestcode"]).Trim(); if (!string.IsNullOrEmpty(requestcode)) { insupdQ = " if not exists( select ReqAppNo from RQ_Requisition where RequestType='11' and ReqAppNo='" + AppNo + "' and MemType='1' and RequestDate='" + DateTime.Now.ToString("MM/dd/yyyy") + "' and CertReqType='2')insert into RQ_Requisition (RequestType,RequestCode,RequestDate,MemType,ReqApproveStage,ReqAppStatus,ReqAppNo,college_code, CertReqType, ReqStaffAppNo)values('11','" + requestcode + "','" + DateTime.Now.ToString("MM/dd/yyyy") + "','1','1','1','" + AppNo + "','" + collegecode + "','2','" + LoginStaffApplid + "')"; insupdQ += " update registration set tcapply='1' where app_no='" + AppNo + "'"; int insertQ = da.insertData(insupdQ); string RequisitionFK = d2.GetFunction("select RequisitionPK from RQ_Requisition where RequestType='11' and ReqAppNo='" + AppNo + "' and MemType='1' and CertReqType='2'"); insupdQ = "if not exists(select RequisitionFK from RQ_RequisitionDet where RequisitionFK='" + RequisitionFK + "' and ReqCertificateID='" + CertificateId + "') insert into RQ_RequisitionDet(RequisitionFK,ReqCertificateID)values('" + RequisitionFK + "','" + CertificateId + "')"; da.insertData(insupdQ); } else { alertpopwindow.Visible = true; lblalerterr.Visible = true; lblalerterr.Text = "Please Set Code Settings"; return; } #endregion #region Feeallot Insert Process foreach (DataRowView dr in StudentCertFeeDet) { string certificateId = Convert.ToString(dr["certificate_id"]); string HeaderFK = Convert.ToString(dr["headerfk"]); string ledgerFK = Convert.ToString(dr["ledgerfk"]); string Amount = Convert.ToString(dr["certificate_amount"]); if (!string.IsNullOrEmpty(Amount.Trim()) && Amount.Trim() != "0" && !string.IsNullOrEmpty(certificateId.Trim())) { insupdQ = "if exists (select * from FT_FeeAllot where LedgerFK in('" + ledgerFK + "') and HeaderFK in('" + HeaderFK + "') and FeeCategory in('" + feecatagory + "') and App_No in('" + AppNo + "')) update FT_FeeAllot set AllotDate='" + DateTime.Now.ToString("MM/dd/yyyy") + "',MemType='1',FeeAmount='" + Amount + "',PaidAmount='0' ,DeductAmout='0',DeductReason='0',FromGovtAmt='0',TotalAmount='" + Amount + "',RefundAmount='0',IsFeeDeposit='0',FeeAmountMonthly='',PayMode='0',PayStartDate='',PaidStatus='0',DueDate='" + DateTime.Now.ToString("MM/dd/yyyy") + "',DueAmount='0',FineAmount='0',BalAmount='" + Amount + "' where LedgerFK in('" + ledgerFK + "') and HeaderFK in('" + HeaderFK + "') and FeeCategory in('" + feecatagory + "') and App_No in('" + AppNo + "') else INSERT INTO FT_FeeAllot(AllotDate,MemType,App_No,LedgerFK,HeaderFK,FeeAmount, DeductAmout,DeductReason,FromGovtAmt,TotalAmount,RefundAmount,IsFeeDeposit,FeeAmountMonthly,PayMode,FeeCategory,PayStartDate,PaidStatus,DueDate,DueAmount,FineAmount,BalAmount,FinYearFK) VALUES('" + DateTime.Now.ToString("MM/dd/yyyy") + "',1," + AppNo + ",'" + ledgerFK + "','" + HeaderFK + "','" + Amount + "','0','0','0','" + Amount + "','0','0','','0','" + feecatagory + "','','0','','0','0','" + Amount + "','" + FinyearFk + "')"; feeallotins = da.insertData(insupdQ); } if (feeallotins != 0) { insert_check = true; } } #endregion } } Requestcode(); } } if (insert_check) { alertpopwindow.Visible = true; lblalerterr.Visible = true; lblalerterr.Text = "Saved Successfully"; } } else { btn_request.Visible = false; lbl_error.Visible = true; lbl_error.Text = "No Records Founds"; } } else { btn_request.Visible = false; lbl_error.Visible = true; lbl_error.Text = "Please Select All Fields"; } } else { btn_request.Visible = false; lbl_error.Visible = true; lbl_error.Text = "Please Select All Fields"; } } catch (Exception ex) { lbl_error.Visible = true; lbl_error.Text = ex.ToString(); } }
protected void btn_save_Click(Object sender, EventArgs e) { //spreadDet1.SaveChanges(); try { bool isSave = false; DataTable dtstaffsave = new DataTable(); string testname = string.Empty; string hallnumber = string.Empty; testname = Convert.ToString(cbl_date.SelectedValue); hallnumber = Convert.ToString(cbl_hall.SelectedValue); string selectStaffCode = string.Empty; string selectStaffApplId = string.Empty; string Saveqry = string.Empty; string DeleteQry = string.Empty; if (!string.IsNullOrEmpty(testname) && !string.IsNullOrEmpty(hallnumber)) { foreach (GridViewRow gr in GridView1.Rows) // for (int row = 0; row < spreadDet1.Sheets[0].RowCount; row++) { Label subno = (Label)gr.FindControl("lblsubno"); string SubjectNo = subno.Text.Trim(); Label alterstafcod = (Label)gr.FindControl("lblalterstafcode"); string AlterstaffCode = alterstafcod.Text.Trim(); Label criteria = (Label)gr.FindControl("lblcriteriano"); string CriteriaNum = criteria.Text.Trim(); Label stafcod = (Label)gr.FindControl("lblstaffcode"); string staffCode = stafcod.Text.Trim(); Label exmdt = (Label)gr.FindControl("lblexmdate"); string examdatetime = exmdt.Text.Trim(); string[] split = AlterstaffCode.Split(';'); if (split.Length > 0) { string stafcode = split[0]; for (int i = 0; i < split.Length; i++) { stafcode = split[i]; if (!string.IsNullOrEmpty(stafcode)) { Saveqry = "if exists(select * from internalSeatingArragement where subjectNo='" + SubjectNo + "' and staff_code='" + staffCode + "' and criteriaNo='" + CriteriaNum + "') update internalSeatingArragement set staff_code='" + stafcode + "' where subjectNo='" + SubjectNo + "' and staff_code='" + staffCode + "' and criteriaNo='" + CriteriaNum + "' "; dtstaffsave.Clear(); int res = dirAcc.insertData(Saveqry); if (res != 0) { isSave = true; } } } } } //btnGo_Click(sender, e); } if (isSave) { alertpopwindow.Visible = true; lblalerterr.Text = "Saved Successfully"; } } catch (Exception ex) { d2.sendErrorMail(ex, collegecode, "InvigilationAlterStaff"); } }