protected void AjaxUploadAttech_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { FileInfo fi = new FileInfo(e.FileName); string ext = fi.Extension; string[] data = HttpUtility.UrlDecode(Request.Cookies["asp_act"].Value.ToString()).Split('|'); if (data[1] == "2") { string fileID = Fn.ExenID("INSERT INTO tblEmpDocs (EmpID,FileTitle, FileExt) VALUES (" + data[0] + ", '" + fi.Name + "', '" + ext + "');select SCOPE_IDENTITY()"); string filePath = Server.MapPath("~") + "/Uploads/EmpDocuments/" + fileID + ext; AjaxUploadAttech.SaveAs(filePath); } else { Fn.Exec(@"UPDATE tblEmployee SET PhotoExtension='" + ext + "' WHERE EmpID=" + data[0]); string filePath = Server.MapPath("~") + "/Uploads/EmployeePhoto/" + data[0] + ext; AjaxUploadAttech.SaveAs(filePath); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(data[0]) + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(data[0]) + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } } }
public static string SaveSalary(string SalaryID, string CompleteData) { string[] d = CompleteData.Split('½'); if (SalaryID == "0") { string id = Fn.ExenID(@"INSERT INTO tbl_PayrollEmployeeMonthlySalary (EmpID, SalaryDate, BasicPay, HouseRent, ConveyanceAllowance, IntegratedAllowSplPay, MedicalAllowCurrentBPay, AdhocAllowance7Point5, MiscEidAdvance, ComputerAllowance, AdhocAllowanceEmpty, EntertainmentAllowance, AdhocRelief10Percent, DeputationAllowance, QualificationAllowance, AAllow2013_10Percent, SplReliefAllowance30Percent, DrivingAllowance, AdhocAllowBPNov10_50percent, Arrears, SplAllowJuneBasic20Percent, GrossSalary, GPF, GPFInstallments, StaffLedger, IncomeTax, TradeTax, GroupInsurance, PersonnelInstalment, GRLSLoan, HajFund, BenevolentFund, CarAdvance, MotorCycle, HouseBuilding, SalarySlipCharges, PUTMicroFinance, UnionFund, Shop, EidAdvanceSPL, GovtResidence10Percent, TotalDeductions, NetSalary, Is_SemiAutoSalary) VALUES ('" + d[0] + "','" + d[1] + "','" + d[2] + "','" + d[3] + "','" + d[4] + "','" + d[5] + "','" + d[6] + "','" + d[7] + "','" + d[8] + "','" + d[9] + "','" + d[10] + "','" + d[11] + "','" + d[12] + "','" + d[13] + "','" + d[14] + "','" + d[15] + "','" + d[16] + "','" + d[17] + "','" + d[18] + "','" + d[19] + "','" + d[20] + "','" + d[21] + "','" + d[22] + "','" + d[23] + "','" + d[24] + "','" + d[25] + "','" + d[26] + "','" + d[27] + "','" + d[28] + "','" + d[29] + "','" + d[30] + "','" + d[31] + "','" + d[32] + "','" + d[33] + "','" + d[34] + "','" + d[35] + "','" + d[36] + "','" + d[37] + "','" + d[38] + "','" + d[39] + "','" + d[40] + "','" + d[41] + "','" + d[42] + "','0' ); Select Scope_Identity();"); Fn.Exec("usp_PayrollGPFBalanceUpdate '" + d[0] + "', '" + d[22] + "', '" + d[1] + "'"); return(id); } else { //=========>Fn.Exec("update tbl_PayrollGPFBalance set Balance = Balance + (Select (-1) * GPF from tbl_PayrollEmployeeMonthlySalary where MonthlySalaryID = '" + SalaryID + "') where EmpID = " + d[0]); //Fn.Exec(@"UPDATE tbl_PayrollEmployeeMonthlySalary SET EmpID = '" + d[0] + "', SalaryDate = '" + d[1] + "', BasicPay = '" + d[2] + "', HouseRent = '" + d[3] + "', ConveyanceAllowance = '" + d[4] + "', IntegratedAllowSplPay = '" + d[5] + "', MedicalAllowCurrentBPay = '" + d[6] + "', AdhocAllowance7Point5 = '" + d[7] + "', MiscEidAdvance = '" + d[8] + "', ComputerAllowance = '" + d[9] + "', AdhocAllowanceEmpty = '" + d[10] + "', EntertainmentAllowance = '" + d[11] + "', AdhocRelief10Percent = '" + d[12] + "', DeputationAllowance = '" + d[13] + "', QualificationAllowance = '" + d[14] + "', AAllow2013_10Percent = '" + d[15] + "', SplReliefAllowance30Percent = '" + d[16] + "', DrivingAllowance = '" + d[17] + "', AdhocAllowBPNov10_50percent = '" + d[18] + "', Arrears = '" + d[19] + "', SplAllowJuneBasic20Percent = '" + d[20] + "', GrossSalary = '" + d[21] + "', GPF = '" + d[22] + "', GPFInstallments = '" + d[23] + "', StaffLedger = '" + d[24] + "', IncomeTax = '" + d[25] + "', TradeTax = '" + d[26] + "', GroupInsurance = '" + d[27] + "', PersonnelInstalment = '" + d[28] + "', GRLSLoan = '" + d[29] + "', HajFund = '" + d[30] + "', BenevolentFund = '" + d[31] + "', CarAdvance = '" + d[32] + "', MotorCycle = '" + d[33] + "', HouseBuilding = '" + d[34] + "', SalarySlipCharges = '" + d[35] + "', PUTMicroFinance = '" + d[36] + "', UnionFund = '" + d[37] + "', Shop = '" + d[38] + "', EidAdvanceSPL = '" + d[39] + "', GovtResidence10Percent = '" + d[40] + "', TotalDeductions = '" + d[41] + "', NetSalary = '" + d[42] + "' where MonthlySalaryID = " + SalaryID); Fn.Exec(@"UPDATE tbl_PayrollEmployeeMonthlySalary SET EmpID ='" + d[0] + @"', BasicPay ='" + d[1] + @"', HouseRent ='" + d[2] + @"', ConveyanceAllowance ='" + d[3] + @"', MedicalAllowCurrentBPay ='" + d[4] + @"', MiscEidAdvance ='" + d[5] + @"', ComputerAllowance ='" + d[6] + @"', EntertainmentAllowance ='" + d[7] + @"', DeputationAllowance ='" + d[8] + @"', ProjectBaseAllowance ='" + d[9] + @"', Arrears ='" + d[10] + @"', GrossSalary ='" + d[11] + @"', GPF ='" + d[12] + @"', GPFInstallments ='" + d[13] + @"', IncomeTax ='" + d[14] + @"', GroupInsurance ='" + d[15] + @"', PersonnelInstalment ='" + d[16] + @"', CarAdvance ='" + d[17] + @"', MotorCycle ='" + d[18] + @"', HouseBuilding ='" + d[19] + @"', CashAdvanceLoan ='" + d[20] + @"', TotalDeductions ='" + d[21] + @"', NetSalary ='" + d[22] + @"', Is_SemiAutoSalary =0 where MonthlySalaryID = " + SalaryID); //=========>Fn.Exec("usp_PayrollGPFBalanceUpdate '" + d[0] + "', '" + d[22] + "', '" + d[1] + "'"); return(SalaryID); } }
public static string SaveEmpParticular(string Vals) { var frmdata = Vals; string[] d = frmdata.Split('½'); Fn.Exec(@"UPDATE tblEmployee SET BPay ='" + d[0] + @"' WHERE (EmpID = '" + d[23] + @"')"); return(Fn.Exec("INSERT INTO tbl_PayrollEmployeeParticulars (BasicPay, RateOfIncrement, MinimumPayScale, DirectorateId, BankId, BankAccountNo, ECRPageNo, CarMaintain, TransferStatus, MoveOver, PickAndDrop, LeaveHaldAverage, UseGovtHouse, Is_Muslim, DepotationAllowance, PersonalLoan, GPFPercentage, GRLS, GRLSInstallments, HouseBuildingAdvance, BasicPayNov2010, BasicPayNov2011, BasicPayJun2015, EmpID) VALUES ('" + d[0] + "','" + d[1] + "','" + d[2] + "','" + d[3] + "','" + d[4] + "','" + d[5] + "','" + d[6] + "','" + d[7] + "','" + d[8] + "','" + d[9] + "','" + d[10] + "','" + d[11] + "','" + d[12] + "','" + d[13] + "','" + d[14] + "','" + d[15] + "','" + d[16] + "','" + d[17] + "','" + d[18] + "','" + d[19] + "','" + d[20] + "','" + d[21] + "','" + d[22] + "','" + d[23] + "')")); }
public static string ActivateDeactivate(string ID, string Status) { if (Status == "true") { Fn.Exec("Update TblHResources SET U_Status = 0 WHERE User_ID = " + ID); return("Deactivated Successfully"); } else { Fn.Exec("Update TblHResources SET U_Status = 1 WHERE User_ID = " + ID); return("Activated Successfully"); } }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); string[] dataID = Fn.CleanSQL(HttpUtility.UrlDecode(context.Request.QueryString["id"])).Split('ǁ'); { try { context.Response.ContentType = "text/HTML"; switch (Convert.ToInt32(dataID[0])) { case 0: string formdata = HttpUtility.UrlDecode(context.Request.Form["vls"]); string formcost = HttpUtility.UrlDecode(context.Request.Form["rt1"]); string Case0ID = "0"; if (formdata.Contains('½')) { Case0ID = Fn.ExenID(@"INSERT INTO VehicleProblem (Problem, Date, WorkshopID, Vehicle_id, DriverEmpID, Description) VALUES ('" + formdata.Split('½')[0] + @"','" + formdata.Split('½')[1] + @"','" + formdata.Split('½')[2] + @"','" + formdata.Split('½')[3] + @"','" + formdata.Split('½')[4] + @"','" + formdata.Split('½')[5] + @"'); select SCOPE_IDENTITY()"); if (formcost.Contains('¼')) { foreach (string item in formcost.Split('¼')) { if (item.Contains('½')) { Fn.Exec(@"INSERT INTO VehicleProblemCost (VehicleProblemID, CostFor, Descrtiption, CostAmount) VALUES ('" + Case0ID + @"','" + item.Split('½')[0] + @"','" + item.Split('½')[1] + @"','" + item.Split('½')[2] + @"')"); } } } } context.Response.Write(Case0ID); break; case 1: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT VehicleProblem.VehicleProblemID, VehicleProblem.Problem, VehicleProblem.Date, Vehicle.Number Vehicle, Workshop.Workshop_Name Workshop, ISNULL(tblEmployee.FName,'')+' '+ ISNULL(tblEmployee.LName,'') AS Driver FROM VehicleProblem INNER JOIN Vehicle ON VehicleProblem.Vehicle_id = Vehicle.Vehicle_id INNER JOIN Workshop ON VehicleProblem.WorkshopID = Workshop.Workshop_Id INNER JOIN tblEmployee ON VehicleProblem.DriverEmpID = tblEmployee.EmpID", "tblReq")); break; default: context.Response.Write("<p>Contents not available</p>"); break; } } catch { context.Response.ContentType = "text/HTML"; context.Response.Write("<p>Contents not available</p>"); } } }
protected void btnSearch_Click(object sender, EventArgs e) { Fn.Exec(@"EXEC sp_GenerateSalary " + Convert.ToString(ddlMonth.SelectedValue) + ", " + Convert.ToString(ddlSalaryYear.SelectedValue) + ", " + Convert.ToString(ddlOfficeType.SelectedValue)); DataSet ds = new DataSet(); ds = Fn.FillDSet("EXEC usp_DirectorateWiseNetSalaryReportByType " + Convert.ToString(ddlMonth.SelectedValue) + ", " + Convert.ToString(ddlSalaryYear.SelectedValue) + ", " + Convert.ToString(ddlOfficeType.SelectedValue)); ShowReport(ds); }
public static String PostFeedback(string name, string email, string subject, string feedback) { string tomail = Fn.GetRecords("SELECT Email FROM TblHResources WHERE (User_ID = 1)")[0]; Fn.Exec("INSERT INTO TblFeedback(fUser, fEmail, fSubject, fComments)VALUES ('" + Fn.CleanSQL(name) + "', '" + Fn.CleanSQL(email) + "', '" + Fn.CleanSQL(subject) + "', '" + Fn.CleanSQL(feedback) + "')"); Fn.SendEmail(tomail, subject + " - " + name, feedback, email); return("Thanks for feedback"); }
public static string GPFOwnContributionSave(string Month, string EmpID, string ContributionAmount, string FromYear, string ToYear) { int CurrYear = DateTime.Now.Year; DateTime ContributionDate; if (Convert.ToInt32(Month) >= 7) { ContributionDate = new DateTime(Convert.ToInt32(FromYear), Convert.ToInt32(Month), 01); } else { ContributionDate = new DateTime(Convert.ToInt32(ToYear), Convert.ToInt32(Month), 01); } Fn.Exec("if exists (select * from tbl_GPFContributionDetail where EmpID = '" + EmpID + "' and ContributionDate = '" + ContributionDate + "') begin update tbl_GPFContributionDetail set Amount = '" + ContributionAmount + "' where EmpID = '" + EmpID + "' and ContributionDate = '" + ContributionDate + "'; end else begin INSERT INTO tbl_GPFContributionDetail (EmpID, ContributionDate, Amount) VALUES ('" + EmpID + "', '" + ContributionDate + "' , '" + ContributionAmount + "'); select SCOPE_IDENTITY(); end"); return(Fn.Exec("usp_GPFUpdateOpeningBalance '" + EmpID + "', '" + FromYear + "', '" + ToYear + "'")); }
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { string fname = DateTime.Now.ToString("yyyMMddHHmmss") + "." + e.FileName.Split('.')[1]; Fn.Exec("INSERT INTO TblVoucherDoc(VoucherID, DocName, DocPath, DocExt)VALUES (" + Request.Cookies["VID"].Value + ", '" + e.FileName.Split('.')[0] + "', '" + fname + "', '" + e.FileName.Split('.')[1] + "')"); string filePath = Server.MapPath("~") + "/Vouchers/" + fname; AjaxFileUpload1.SaveAs(filePath); }
public string SchoolDetailedAssessment(string input) { string ret = "1"; using (DBDataContext db = new DBDataContext()) { SchoolDetailedAssessmentWebService obj = new SchoolDetailedAssessmentWebService(); obj.input = input; db.SchoolDetailedAssessmentWebServices.InsertOnSubmit(obj); db.SubmitChanges(); } //string[] inp = new string[116]; string[] i = input.Split(new[] { "»»»" }, StringSplitOptions.None); foreach (string item in i) { string[] ii = item.Split(new[] { "¡¡" }, StringSplitOptions.None); string[] inp = ii[0].Split('½'); string[] inp1 = ii[2].Split('½'); string tblAssesmentDetailedID = Fn.ExenID(@"INSERT INTO tblAssesmentDetailed (TblUnionConcilID, tblSlumID, tblAssesmentRapidID, dtDate, dtStartTime, dtEndTime, Surveyor1, Surveyor1Contact, SchoolAddressLine1, NearestLandMark, PtclNumber, OtherContact, NameOfContact, CellPhone, email, GPS, SchoolOwnedBy, OwnersName, OwnersContactNo, PrincipalName, PrincipalBackground, RespondentsName, PositionRespondent, PositionRespondentOther, LowestClass, HighestClass, SchoolYearlyMonth, SchoolYealyEnd, ShiftOffered, dtStartTimeMorning, dtEndTimeMorning, dtStartTimeAfternoon, dtEndTimeAfternoon, QA10, QA11, IsTheSchoolRegistered, Sections, TypeOfSchool, TypeOfSchoolOther, LanguageCode, OtherLanguage, YearSchoolEstablished, YearSchoolRegistered, StudentArea1, StudentArea2, StudentArea3, UrduSpeeking, Other, Govt, Private, Slum1Near, Slum2Near, Slum3Near, EthnicUrdu, EthnicOther, PubOUP, PubOtherTxt, Attendance, AttendanceComputerized, TuitionFeeReceipt, TuitionFeeReceiptComputerized, TeachSalaries, TeacherSalariesComputerized, BankAccount, AccountOnSchoolName, EFSPartned, ApplyRegistration, SchoolBuilding, SchoolBuildingOther, SizePlot1, SizePlot2, Floors1, Floors2, TotalRooms1, TotalRooms2, UnUsedRooms1Morning, UnUsedRooms2Morning, UnUsedRooms1Afternoon, UnUsedRooms2Afternoon, HallAvailable, HowMany, HallUsedClassRoom, Library, bookshelf, electricity, electricityAvailable, LoadShedding, generator, water, WaterDrinkable, Pitcher, BoundaryWall, TeachersToilets, TeachersToiletsFunctional, MaleStudentToilets, MaleStudentToiletsFunctional, FemaleStudentToilets, FemaleStudentToiletsFunctional, Playground, ComputerLab, NuberOfComputer, isBeingUsed, Transportation, NumberOfVans, ClassroomClean, CommonAreasClean, EatingAreaClean, CleanUniforms, NailsHairCut, DustbinAccessible, GarbageDeposit, Enroll, EnrollOlder,EnterByEmpID,dtEnterDateTime,QE13,QE14,QE15,QF2,QF1a_Class1,QF1b_Class1,QF1c_Class1,QF1a_Class3,QF1b_Class3,QF1c_Class3) VALUES ('" + inp[3] + @"','" + inp[4] + @"','" + inp[5] + @"','" + inp[6] + @"','" + inp[8] + @"','" + inp[9] + @"','" + inp[10] + @"','" + inp[11] + @"','" + inp[12] + @"','" + inp[13] + @"','" + inp[14] + @"','" + inp[15] + @"','" + inp[16] + @"','" + inp[17] + @"','" + inp[18] + @"','" + inp[19] + @"','" + inp[20] + @"','" + inp[21] + @"','" + inp[22] + @"','" + inp[23] + @"','" + inp[24] + @"','" + inp[25] + @"','" + inp[26] + @"','" + inp[27] + @"','" + inp[28] + @"','" + inp[29] + @"','" + inp[30] + @"','" + inp[31] + @"','" + inp[32] + @"','" + inp[33] + @"','" + inp[34] + @"','" + inp[35] + @"','" + inp[36] + @"','" + inp[37] + @"','" + inp[38] + @"','" + inp[39] + @"','" + inp[40] + @"','" + inp[41] + @"','" + inp[42] + @"','" + inp[43] + @"','" + inp[44] + @"','" + inp[45] + @"','" + inp[46] + @"','" + inp[47] + @"','" + inp[48] + @"','" + inp[49] + @"','" + inp[50] + @"','" + inp[51] + @"','" + inp[52] + @"','" + inp[53] + @"','" + inp[54] + @"','" + inp[55] + @"','" + inp[56] + @"','" + inp[57] + @"','" + inp[58] + @"','" + inp[59] + @"','" + inp[60] + @"','" + inp[61] + @"','" + inp[62] + @"','" + inp[63] + @"','" + inp[64] + @"','" + inp[65] + @"','" + inp[66] + @"','" + inp[67] + @"','" + inp[68] + @"','" + inp[69] + @"','" + inp[70] + @"','" + inp[71] + @"','" + inp[72] + @"','" + inp[73] + @"','" + inp[74] + @"','" + inp[75] + @"','" + inp[76] + @"','" + inp[77] + @"','" + inp[78] + @"','" + inp[79] + @"','" + inp[80] + @"','" + inp[81] + @"','" + inp[82] + @"','" + inp[83] + @"','" + inp[84] + @"','" + inp[85] + @"','" + inp[86] + @"','" + inp[87] + @"','" + inp[88] + @"','" + inp[89] + @"','" + inp[90] + @"','" + inp[91] + @"','" + inp[92] + @"','" + inp[93] + @"','" + inp[94] + @"','" + inp[95] + @"','" + inp[96] + @"','" + inp[97] + @"','" + inp[98] + @"','" + inp[99] + @"','" + inp[100] + @"','" + inp[101] + @"','" + inp[102] + @"','" + inp[103] + @"','" + inp[104] + @"','" + inp[105] + @"','" + inp[106] + @"','" + inp[107] + @"','" + inp[108] + @"','" + inp[109] + @"','" + inp[110] + @"','" + inp[111] + @"','" + inp[112] + @"','" + inp[113] + @"','" + inp[114] + @"','" + inp[115] + @"','" + inp[116] + @"','" + inp[0] + @"',GETDATE() , '" + inp1[0] + "' , '" + inp1[1] + "' , '" + inp1[2] + "' , '" + inp1[3] + "' , '" + inp1[4] + "' , '" + inp1[5] + "' , '" + inp1[6] + "' , '" + inp1[7] + "' , '" + inp1[8] + "' , '" + inp1[9] + "') ; select SCOPE_IDENTITY() "); foreach (string tchr in ii[1].Split('¼')) { string[] t = tchr.Split('½'); if (t.Length == 13) { Fn.Exec(@"INSERT INTO tblAssesmentDetailedTeacherInfo (tblAssesmentDetailedID, E1_Name, E2_Type, E3_Age, E4_Gender, E5_Education, E6_YearAppointed, E7_Experience, E8_GradeTaught, E9_Is_Present, E10_If_No_Why, E11_Subject_Taught, E12_SalaryRange) VALUES ('" + tblAssesmentDetailedID + "','" + t[0] + "','" + t[1] + "','" + t[2] + "','" + t[3] + "','" + t[4] + "','" + t[5] + "','" + t[6] + "','" + t[7] + "','" + t[8] + "','" + t[9] + "','" + t[10] + "','" + t[12] + "')"); } } foreach (string tchr in ii[3].Split('¼')) { string[] t = tchr.Split('½'); if (t.Length > 0) { Fn.Exec(@"INSERT INTO tblAssesmentDetailedClassInfo (tblAssesmentDetailedID, Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col13, Col14, Col15, Col16, Col18, Col19, Col21, Col22, Col23, Col24, Col25, Col26, Col27) VALUES ('" + tblAssesmentDetailedID + "', '" + t[0] + "', '" + t[1] + "', '" + t[2] + "', '" + t[3] + "', '" + t[4] + "', '" + t[5] + "', '" + t[6] + "', '" + t[7] + "', '" + t[8] + "', '" + t[9] + "', '" + t[10] + "', '" + t[11] + "', '" + t[12] + "', '" + t[13] + "', '" + t[14] + "', '" + t[15] + "', '" + t[16] + "', '" + t[17] + "', '" + t[18] + "', '" + t[19] + "', '" + t[20] + "', '" + t[21] + "', '" + t[22] + "', '" + t[23] + "', '" + t[24] + "')"); } } } return(ret); }
public static string SaveAdvanceTitle(string AdvanceID, string Amount, string EmpID, string AdvanceDate) { string id = Fn.ExenID("INSERT INTO tbl_PayrollAdvanceDetail (AdvanceID, Amount, EmpID, AdvanceDate, Balance) VALUES ('" + AdvanceID + "','" + Amount + "','" + EmpID + "','" + AdvanceDate + "','" + Amount + "'); Select SCOPE_IDENTITY();"); if (AdvanceID == "1002") { Fn.Exec("usp_PayrollGPFBalanceUpdate '" + EmpID + "', '" + (-1) * Convert.ToDecimal(Amount) + "', '" + AdvanceDate + "'"); } return(id); }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); try { //var frmdata = context.Request.Form["vls"]; var frmdata = context.Request.Form["vls"]; string[] d = frmdata.Split('½'); string id = d[0].Replace("_", ""); id = id.Replace("#", ""); id = id.Replace("imgprvw", ""); if (context.Request.Files.Count > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/OrganizationDevelopment/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/OrganizationDevelopment/"); FileInfo fi = new FileInfo(FileName); //int fileID = id; Fn.Exec("UPDATE tblOD_Process SET Procc = 'Uploads/OrganizationDevelopment/" + id + "" + fi.Extension + "' where ID = " + id); PostedFile.SaveAs(Path + Convert.ToString(id) + fi.Extension); context.Response.ContentType = "text/plain"; context.Response.Write("Activity Uploaded Successfully!"); } } } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); try { var frmdata = context.Request.Form["vls"]; string[] d = frmdata.Split('½'); string Empid = d[1]; if (d[0] == "1") { if (context.Request.Files.Count > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/EmployeePhoto/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/EmployeePhoto/"); FileInfo fi = new FileInfo(FileName); Fn.Exec("UPDATE TblHResources SET PhotoExtension = '" + fi.Extension + "' where User_ID = " + Empid); PostedFile.SaveAs(Path + Convert.ToString(Empid) + fi.Extension); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(Empid) + fi.Extension, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(Empid) + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(Empid) + fi.Extension, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(Empid) + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } } } } if (d[0] == "2") { if (context.Request.Files.Count > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/EmployeeCV/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/EmployeeCV/"); FileInfo fi = new FileInfo(FileName); Fn.Exec("UPDATE TblHResources SET CVExtension = '" + fi.Extension + "' WHERE (User_ID = '" + Empid + "')"); PostedFile.SaveAs(Path + Convert.ToString(Empid) + fi.Extension); } } } if (d[0] == "3") { if (context.Request.Files.Count > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/EmployeeDocs/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/EmployeeDocs/"); FileInfo fi = new FileInfo(FileName); string NewID = Fn.ExenID("INSERT INTO tbl_EmployeeDocuments (FileName, FileExtension, EntryDate, EmpID) VALUES ('" + fi.Name + "', '" + fi.Extension + "' , GETDATE(), '" + Empid + "'); Select SCOPE_IDENTITY();"); PostedFile.SaveAs(Path + Convert.ToString(NewID) + fi.Extension); } } } } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public void ProcessRequest(HttpContext context) { try { var frmdata = context.Request.Form["vls"]; string[] d = frmdata.Split('½'); int benID = Convert.ToInt32(Convert.ToString(HttpContext.Current.Session["Emp_Id"])); HttpFileCollection SelectedFiles = context.Request.Files; if (SelectedFiles.Count > 0 && benID > 0) { for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/SchoolRapidPhoto/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/SchoolRapidPhoto/"); FileInfo fi = new FileInfo(FileName); //decimal fileID = Convert.ToDecimal(d[0]); string FileID = "0"; if (d[28] == "0") { FileID = Fn.ExenID(@"INSERT INTO tblAssesmentRapid (strFormNo, dtSurveyDate, strSchoolName, strContactNoSchool, strSchoolEmail, strOwnerName, strOwnerContactNumber, strOwnerEmail, strPrincipalName, strPrincipalContactNumber, strPrincipalEmail, strAddress1, strAddress2, strNearestLandMark, TblUnionConcilID, tblSlumID, strSchoolLatLang, strSurveyorName1, strSurveyorName2, dtStartDateTime, dtEndDateTime, Q1, Q2, Q3, Q4, Q5, Q6, bisPictureAllowed, PicturePath, nEnterByEmpID, dtEntryDateTime) VALUES('" + d[0] + "','" + d[1] + "','" + d[2] + "','" + d[3] + "','" + d[4] + "','" + d[5] + "','" + d[6] + "','" + d[7] + "','" + d[8] + "','" + d[9] + "','" + d[10] + "','" + d[11] + "','" + d[12] + "','" + d[13] + "','" + d[14] + "','" + d[15] + "','" + d[16] + "','" + d[17] + "','" + d[18] + "','" + d[19] + "','" + d[20] + "','" + d[21] + "','" + d[22] + "','" + d[23] + "','" + d[24] + "','" + d[25] + "','" + d[26] + "','" + d[27] + "','" + fi.Extension + "','" + Convert.ToString(benID) + "',GETDATE()); SELECT @@IDENTITY"); } else { FileID = d[28]; Fn.Exec(@"UPDATE tblAssesmentRapid SET strFormNo ='" + d[0] + @"', dtSurveyDate ='" + d[1] + @"', strSchoolName ='" + d[2] + @"', strContactNoSchool ='" + d[3] + @"', strSchoolEmail ='" + d[4] + @"', strOwnerName ='" + d[5] + @"', strOwnerContactNumber ='" + d[6] + @"', strOwnerEmail ='" + d[7] + @"', strPrincipalName ='" + d[8] + @"', strPrincipalContactNumber ='" + d[9] + @"', strPrincipalEmail ='" + d[10] + @"', strAddress1 ='" + d[11] + @"', strAddress2 ='" + d[12] + @"', strNearestLandMark ='" + d[13] + @"', TblUnionConcilID ='" + d[14] + @"', tblSlumID ='" + d[15] + @"', strSchoolLatLang ='" + d[16] + @"', strSurveyorName1 ='" + d[17] + @"', strSurveyorName2 ='" + d[18] + @"', dtStartDateTime ='" + d[19] + @"', dtEndDateTime ='" + d[20] + @"', Q1 ='" + d[21] + @"', Q2 ='" + d[22] + @"', Q3 ='" + d[23] + @"', Q4 ='" + d[24] + @"', Q5 ='" + d[25] + @"', Q6 ='" + d[26] + @"', bisPictureAllowed ='" + d[27] + @"', PicturePath ='" + fi.Extension + @"' WHERE (tblAssesmentRapidID = '" + FileID + @"')"); } PostedFile.SaveAs(Path + Convert.ToString(FileID) + fi.Extension); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(FileID) + fi.Extension, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/SchoolRapidPhoto/", "A" + Convert.ToString(FileID) + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(FileID) + fi.Extension, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/SchoolRapidPhoto/", "B" + Convert.ToString(FileID) + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } context.Response.ContentType = "text/plain"; context.Response.Write("Record Saved"); } } else if (benID > 0) { if (d[28] == "0") { Fn.Exec(@"INSERT INTO tblAssesmentRapid (strFormNo, dtSurveyDate, strSchoolName, strContactNoSchool, strSchoolEmail, strOwnerName, strOwnerContactNumber, strOwnerEmail, strPrincipalName, strPrincipalContactNumber, strPrincipalEmail, strAddress1, strAddress2, strNearestLandMark, TblUnionConcilID, tblSlumID, strSchoolLatLang, strSurveyorName1, strSurveyorName2, dtStartDateTime, dtEndDateTime, Q1, Q2, Q3, Q4, Q5, Q6, bisPictureAllowed, nEnterByEmpID, dtEntryDateTime) VALUES('" + d[0] + "',CONVERT(DATETIME,'" + d[1] + "',103) ,'" + d[2] + "','" + d[3] + "','" + d[4] + "','" + d[5] + "','" + d[6] + "','" + d[7] + "','" + d[8] + "','" + d[9] + "','" + d[10] + "','" + d[11] + "','" + d[12] + "','" + d[13] + "','" + d[14] + "','" + d[15] + "','" + d[16] + "','" + d[17] + "','" + d[18] + "','" + d[19] + "','" + d[20] + "','" + d[21] + "','" + d[22] + "','" + d[23] + "','" + d[24] + "','" + d[25] + "','" + d[26] + "','" + d[27] + "','" + Convert.ToString(benID) + "',GETDATE())"); } else { Fn.Exec(@"UPDATE tblAssesmentRapid SET strFormNo ='" + d[0] + @"', dtSurveyDate ='" + d[1] + @"', strSchoolName ='" + d[2] + @"', strContactNoSchool ='" + d[3] + @"', strSchoolEmail ='" + d[4] + @"', strOwnerName ='" + d[5] + @"', strOwnerContactNumber ='" + d[6] + @"', strOwnerEmail ='" + d[7] + @"', strPrincipalName ='" + d[8] + @"', strPrincipalContactNumber ='" + d[9] + @"', strPrincipalEmail ='" + d[10] + @"', strAddress1 ='" + d[11] + @"', strAddress2 ='" + d[12] + @"', strNearestLandMark ='" + d[13] + @"', TblUnionConcilID ='" + d[14] + @"', tblSlumID ='" + d[15] + @"', strSchoolLatLang ='" + d[16] + @"', strSurveyorName1 ='" + d[17] + @"', strSurveyorName2 ='" + d[18] + @"', dtStartDateTime ='" + d[19] + @"', dtEndDateTime ='" + d[20] + @"', Q1 ='" + d[21] + @"', Q2 ='" + d[22] + @"', Q3 ='" + d[23] + @"', Q4 ='" + d[24] + @"', Q5 ='" + d[25] + @"', Q6 ='" + d[26] + @"', bisPictureAllowed ='" + d[27] + @"' WHERE (tblAssesmentRapidID = '" + d[28] + @"')"); } context.Response.ContentType = "text/plain"; context.Response.Write("Record Saved"); } //context.Response.ContentType = "text/plain"; //context.Response.Write("Files Uploaded Successfully!!"); } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); string[] dataID = Fn.CleanSQL(HttpUtility.UrlDecode(context.Request.QueryString["id"])).Split('ǁ'); string[] fdata = new string[500]; if (context.Request.Form["ourformData"] != null) { //string testing = context.Request.Form["ourformData"]; fdata = HttpUtility.UrlDecode(context.Request.Form["ourformData"]).Split('½'); } { try { context.Response.ContentType = "text/HTML"; switch (Convert.ToInt32(dataID[0])) { case 0: context.Response.Write(Fn.Data2Json("Select * from [dbo].[tblInventoryDefault] where tblInventoryDefaultID=1")); break; case 1: context.Response.Write(Fn.Exec(@"UPDATE tblInventoryDefault SET MaxLevels =" + dataID[1] + @" WHERE (tblInventoryDefaultID = 1)")); break; case 2: // context.Response.Write(Fn.Data2Json(@"SELECT tblPlaceID, Code, Name, Branch= ( // //Select count(*) from tblPlace as B where B.ParentId= M.tblPlaceID //) //FROM tblPlace AS M //WHERE ParentId IS NULL order by Code")); context.Response.Write(Fn.Data2Json(@"Select M.CompanyID AS tblPlaceID, M.Code , M.CompanyName AS Name, 0 bIsHead, Branch= ( Select count(*) from tbl_Company AS B Where B.ParentId=M.CompanyID ) from tbl_Company as M WHERE M.ParentId IS NULL order by M.CompanyID, M.Code")); break; case 3: // context.Response.Write(Fn.Data2Json(@" SELECT tblPlaceID, Code, Name, Branch= ( // //Select count(*) from tblPlace as B where B.ParentId= M.tblPlaceID //) //FROM tblPlace AS M //WHERE ParentId =" + dataID[1] + " order by Code")); context.Response.Write(Fn.Data2Json(@" SELECT M.CompanyID AS tblPlaceID, Code, M.CompanyName Name, 0 bIsHead, Branch= ( Select count(*) from tbl_Company as B where B.ParentId= M.CompanyID ) FROM tbl_Company AS M WHERE ParentId =" + dataID[1] + " order by Code")); break; case 4: // context.Response.Write(Fn.Exec(@"UPDATE tblPlace //SET Name = '" + dataID[1] + @"' //WHERE (tblPlaceID = " + dataID[2] + ")")); context.Response.Write(Fn.Exec(@"UPDATE tbl_Company SET CompanyName = '" + dataID[1] + @"' WHERE (CompanyID = " + dataID[2] + ")")); break; case 5: decimal?tblid = 0; int? tblcode = 0; using (DBDataContext db = new DBDataContext()) { db.sp_tblPlace_Insert(dataID[1], dataID[2], ref tblid, ref tblcode); } string sssssss = Convert.ToString(tblid) + "½" + Convert.ToString(tblcode); context.Response.Write(sssssss); break; default: context.Response.Write("<p>Contents not available</p>"); break; } } catch { context.Response.ContentType = "text/HTML"; context.Response.Write("<p>Contents not available</p>"); } } }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); try { var areaid = context.Request.Form["areas"]; var DSUS = context.Request.Form["DSUS"]; int Newcode = 0; using (DBDataContext db = new DBDataContext()) { try { Newcode = db.tbl_Companies.Where(vv => vv.ParentId == Convert.ToDecimal(areaid)).Max(ss => ss.Code ?? 0); Newcode += 1; } catch (Exception) { Newcode += 1; } } var frmdata = context.Request.Form["vls"]; string[] d = frmdata.Split('½'); int CompanyID = 0; if (d[12] == "0") { CompanyID = Convert.ToInt32(Fn.ExenID("INSERT INTO tbl_Company (CompanyName, CompanyAbbrivation, CompanyPhoneNo, CompanyEmail, CompanyEstablishmentYear, CompanyWebsite, CompanyProvince, CompanyDistrictID, CompanyAddress, dtProjectFromDate, dtProjectToDate, GPS, code, ParentId, Type,lvl) VALUES ('" + d[0] + "', '" + d[1] + "', '" + d[2] + "', '" + d[3] + "', '" + d[4] + "', '" + d[5] + "', '" + d[6] + "', '" + d[7] + "', '" + d[8] + "', CONVERT(DATETIME,'" + d[9] + @"',103),CONVERT(DATETIME,'" + d[10] + @"',103), '" + d[11] + "','" + Convert.ToString(Newcode) + "','" + areaid + "','Project','4'); select SCOPE_IDENTITY();")); //using (DBDataContext db = new DBDataContext()) //{ // List<TblHResourcesLocation> oblist = new List<TblHResourcesLocation>(); // var emps = db.Logins.Where(v => v.User_Group_Id == 2).Select(s => s.Emp_Id).ToList<int>(); // foreach (var emp in emps) // { // oblist.Add(new TblHResourcesLocation() { LocID = Convert.ToInt32(CompanyID), User_ID = emp }); // } // db.TblHResourcesLocations.InsertAllOnSubmit(oblist); // db.SubmitChanges(); //} var qry = ""; foreach (var item in DSUS.Split('½')) { if (item != "") { qry += "INSERT INTO tbl_CompanyProjectDSUs (tbl_CompanyDSUID, tbl_CompanyProjectID ) VALUES ('" + item + @"','" + CompanyID + @"'); "; } } Fn.Exec(qry); } else { CompanyID = Convert.ToInt32(d[12]); Fn.Exec(@"UPDATE tbl_Company set CompanyName= '" + d[0] + @"', CompanyAbbrivation= '" + d[1] + @"', CompanyPhoneNo= '" + d[2] + @"', CompanyEmail= '" + d[3] + @"', CompanyEstablishmentYear= '" + d[4] + @"', CompanyWebsite= '" + d[5] + @"', CompanyProvince= '" + d[6] + @"', CompanyDistrictID= '" + d[7] + @"', CompanyAddress= '" + d[8] + @"', dtProjectFromDate= CONVERT(DATETIME,'" + d[9] + @"',103), dtProjectToDate= CONVERT(DATETIME,'" + d[10] + @"',103), GPS= '" + d[11] + @"', ParentId= '" + areaid + @"', Type= 'Project', lvl= '4' WHERE CompanyID='" + d[12] + "'"); Fn.Exec("DELETE tbl_CompanyProjectDSUs WHERE tbl_CompanyProjectID='" + d[12] + @"'"); var qry = ""; foreach (var item in DSUS.Split('½')) { if (item != "") { qry += "INSERT INTO tbl_CompanyProjectDSUs (tbl_CompanyDSUID, tbl_CompanyProjectID ) VALUES ('" + item + @"','" + d[12] + @"'); "; } } Fn.Exec(qry); } if (context.Request.Files.Count > 0 && CompanyID > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/CompanyProfile/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/CompanyProfile/"); FileInfo fi = new FileInfo(FileName); //int fileID = 0; Fn.Exec("update tbl_Company set CompanyLogo = '" + fi.Extension + "' where CompanyID = " + Convert.ToString(CompanyID)); //PostedFile.SaveAs(Path + Convert.ToString(CompanyID) + fi.Extension); PostedFile.SaveAs(Path + Convert.ToString(CompanyID) + fi.Extension); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(CompanyID) + fi.Extension, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/CompanyProfile/", "A" + Convert.ToString(CompanyID) + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(CompanyID) + fi.Extension, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/CompanyProfile/", "B" + Convert.ToString(CompanyID) + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } } } if (CompanyID > 0) { context.Response.ContentType = "text/plain"; context.Response.Write("Project Registered Successfully!"); } } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); string[] dataID = Fn.CleanSQL(HttpUtility.UrlDecode(context.Request.QueryString["id"])).Split('ǁ'); string[] fdata = new string[500]; if (context.Request.Form["ourformData"] != null) { //string testing = context.Request.Form["ourformData"]; fdata = Fn.CleanSQL(HttpUtility.UrlDecode(context.Request.Form["ourformData"])).Split('½'); } { try { context.Response.ContentType = "text/HTML"; switch (Convert.ToInt32(dataID[0])) { case 0: var x0 = context.Request.Form["frmData"]; var Id01 = HttpUtility.UrlDecode(Convert.ToString(x0)); if (Id01.Split('ǁ')[12] == "0") { context.Response.Write(Fn.ExenID(@"INSERT INTO tblJobRequirement (Post, GradeBPS, PostJobStatus, DutyStation, TotalPositions, Gender, MinAge, MaxAge, Purpose, QualificationRequired, ExperienceRequired, JobDuties, dtDateTime, EnterByEmpID, Status) VALUES ('" + Id01.Split('ǁ')[0] + @"','" + Id01.Split('ǁ')[1] + @"','" + Id01.Split('ǁ')[2] + @"','" + Id01.Split('ǁ')[3] + @"','" + Id01.Split('ǁ')[4] + @"','" + Id01.Split('ǁ')[5] + @"','" + Id01.Split('ǁ')[6] + @"','" + Id01.Split('ǁ')[7] + @"','" + WebUtility.HtmlEncode(Id01.Split('ǁ')[8]) + @"','" + WebUtility.HtmlEncode(Id01.Split('ǁ')[9]) + @"','" + WebUtility.HtmlEncode(Id01.Split('ǁ')[10]) + @"','" + WebUtility.HtmlEncode(Id01.Split('ǁ')[11]) + @"',GETDATE(),'" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + @"','Sent'); select SCOPE_IDENTITY()")); } else { context.Response.Write(Fn.ExenID(@"UPDATE tblJobRequirement SET Post ='" + Id01.Split('ǁ')[0] + @"', GradeBPS ='" + Id01.Split('ǁ')[1] + @"', PostJobStatus ='" + Id01.Split('ǁ')[2] + @"', DutyStation ='" + Id01.Split('ǁ')[3] + @"', TotalPositions ='" + Id01.Split('ǁ')[4] + @"', Gender ='" + Id01.Split('ǁ')[5] + @"', MinAge ='" + Id01.Split('ǁ')[6] + @"', MaxAge ='" + Id01.Split('ǁ')[7] + @"', Purpose ='" + WebUtility.HtmlEncode(Id01.Split('ǁ')[8]) + @"', QualificationRequired ='" + WebUtility.HtmlEncode(Id01.Split('ǁ')[9]) + @"', ExperienceRequired ='" + WebUtility.HtmlEncode(Id01.Split('ǁ')[10]) + @"', JobDuties ='" + WebUtility.HtmlEncode(Id01.Split('ǁ')[11]) + @"', Status ='Sent' ,Remarks ='' WHERE (tblJobRequirementID = '" + Id01.Split('ǁ')[12] + @"'); select SCOPE_IDENTITY()")); } break; case 1: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT tblJobRequirementID, Post, PostJobStatus [Post JobS tatus], DutyStation [Duty Station], TotalPositions [Total Positions], Gender, MinAge [Min Age], MaxAge [Max Age], Status, Remarks FROM tblJobRequirement order by dtDateTime", "tblReq")); break; case 2: context.Response.Write(Fn.Data2Json(@"SELECT Post, GradeBPS, PostJobStatus, DutyStation, TotalPositions, Gender, MinAge, MaxAge, Purpose, QualificationRequired, ExperienceRequired, JobDuties, tblJobRequirementID FROM tblJobRequirement WHERE tblJobRequirementID=" + dataID[1])); break; case 3: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT tblJobRequirementID, Post, GradeBPS [Grade/BPS], PostJobStatus [Post JobS tatus], DutyStation [Duty Station], TotalPositions [Total Positions], Gender, MinAge [Min Age], MaxAge [Max Age], Status FROM tblJobRequirement where status = 'Sent' order by dtDateTime", "tblReq")); break; case 4: var x4 = context.Request.Form["frmData"]; var Id41 = HttpUtility.UrlDecode(Convert.ToString(x4)); if (Id41.Split('ǁ')[12] == "0") { context.Response.Write(Fn.ExenID(@"INSERT INTO tblJobRequirement (Post, GradeBPS, PostJobStatus, DutyStation, TotalPositions, Gender, MinAge, MaxAge, Purpose, QualificationRequired, ExperienceRequired, JobDuties, dtDateTime, EnterByEmpID, Status) VALUES ('" + Id41.Split('ǁ')[0] + @"','" + Id41.Split('ǁ')[1] + @"','" + Id41.Split('ǁ')[2] + @"','" + Id41.Split('ǁ')[3] + @"','" + Id41.Split('ǁ')[4] + @"','" + Id41.Split('ǁ')[5] + @"','" + Id41.Split('ǁ')[6] + @"','" + Id41.Split('ǁ')[7] + @"','" + WebUtility.HtmlEncode(Id41.Split('ǁ')[8]) + @"','" + WebUtility.HtmlEncode(Id41.Split('ǁ')[9]) + @"','" + WebUtility.HtmlEncode(Id41.Split('ǁ')[10]) + @"','" + WebUtility.HtmlEncode(Id41.Split('ǁ')[11]) + @"',GETDATE(),'" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + @"','Sent'); select SCOPE_IDENTITY()")); } else { context.Response.Write(Fn.ExenID(@"UPDATE tblJobRequirement SET Post ='" + Id41.Split('ǁ')[0] + @"', GradeBPS ='" + Id41.Split('ǁ')[1] + @"', PostJobStatus ='" + Id41.Split('ǁ')[2] + @"', DutyStation ='" + Id41.Split('ǁ')[3] + @"', TotalPositions ='" + Id41.Split('ǁ')[4] + @"', Gender ='" + Id41.Split('ǁ')[5] + @"', MinAge ='" + Id41.Split('ǁ')[6] + @"', MaxAge ='" + Id41.Split('ǁ')[7] + @"', Purpose ='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[8]) + @"', QualificationRequired ='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[9]) + @"', ExperienceRequired ='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[10]) + @"', JobDuties ='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[11]) + @"' , Remarks ='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[14]) + @"' , LastDateToApply=CONVERT(DATETIME,'" + WebUtility.HtmlEncode(Id41.Split('ǁ')[15]) + @"',103), Status='" + WebUtility.HtmlEncode(Id41.Split('ǁ')[16]) + @"' WHERE (tblJobRequirementID = '" + Id41.Split('ǁ')[12] + @"'); select SCOPE_IDENTITY()")); } break; case 5: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"Select tblJobRequirementID, 'FRDP-B4-'+RIGHT('00000' + CAST(tblJobRequirementID AS VARCHAR(50)),5) +'/'+CAST(DATEPART(YYYY, dtDateTime) AS VARCHAR(50))+'-R' AS [Case No], Post, GradeBPS [Grade/BPS], PostJobStatus [Job Status], DutyStation [Duty Station], TotalPositions [Total Positions] , convert(varchar(50), CONVERT(DATETIME,ISNULL(LastDateToApply,'01/01/1990'),103), 106) as [Last Date] from tblJobRequirement where LastDateToApply > GetDATE() order by dtDateTime desc", "tblJl")); break; //Select tblJobRequirementID, 'PPHI-B4-'+RIGHT('00000' + CAST(tblJobRequirementID AS VARCHAR(50)),5) +'/'+CAST(DATEPART(YYYY, dtDateTime) AS VARCHAR(50))+'-R' AS [Case No] from tblJobRequirement case 6: context.Response.Write(Fn.Data2Json(@"SELECT tblJobRequirementID, 'FRDP-B4-' + RIGHT('00000' + CAST(tblJobRequirementID AS VARCHAR(50)), 5) + '/' + CAST(DATEPART(YYYY, dtDateTime) AS VARCHAR(50)) + '-R' +' [ '+ Post +' ]' as Post FROM tblJobRequirement ORDER BY dtDateTime DESCs")); break; case 7: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT tblCandidate_tblJobRequirement.tblCandidate_tblJobRequirementID, tblCandidate.Name, tblCandidate.FatherName [Father Name], Convert(varchar(50),tblCandidate.dtDOB,103) as [DOB], tblCandidate.CNIC, tblCandidate.City, tblCandidate.District, tblCandidate.Phone, tblCandidate.Mobile, CONVERT(varchar(50), tblCandidate_tblJobRequirement.dtDateTime, 103) AS [Date Applied], Case When tblCandidate_tblJobRequirement.bIsShortListed=1 Then '<button title=''Select Candidate...'' class=''btnEdit btn btn-success'' customtooltip=''Select Candidate''>s</button>' else '<button title=''Select Candidate...'' class=''btnEdit btn btn-info'' customtooltip=''Select Candidate''>s</button>' END as [ ] FROM tblCandidate_tblJobRequirement INNER JOIN tblCandidate ON tblCandidate_tblJobRequirement.tblCandidateID = tblCandidate.tblCandidateID WHERE tblCandidate_tblJobRequirement.tblJobRequirementID =" + dataID[1], "tblJl")); break; case 8: context.Response.Write(Fn.Exec("UPDATE tblCandidate_tblJobRequirement SET bIsShortListed=" + dataID[2] + " WHERE tblCandidate_tblJobRequirementID='" + dataID[1] + "'")); break; case 9: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT tblCandidate_tblJobRequirement.tblCandidate_tblJobRequirementID, tblCandidate.Name, tblCandidate.FatherName AS [Father Name], CONVERT(varchar(50), tblCandidate.dtDOB, 103) AS DOB, tblCandidate.CNIC, tblCandidate.City, tblCandidate.District, tblCandidate.Phone, tblCandidate.Mobile, CONVERT(varchar(50), tblCandidate_tblJobRequirement.dtDateTime, 103) AS [Date Applied], '<input class=''btnEdit Integer'' type=''text'' value='''+CAST(ISNULL(tblCandidate_tblJobRequirement.InterviewMarks,'0') AS VARCHAR(50))+''' style=''width: 60px;''>' AS [Interview Marks] FROM tblCandidate_tblJobRequirement INNER JOIN tblCandidate ON tblCandidate_tblJobRequirement.tblCandidateID = tblCandidate.tblCandidateID WHERE tblCandidate_tblJobRequirement.bIsShortListed = 1 and tblCandidate_tblJobRequirement.tblJobRequirementID =" + dataID[1], "tblJl")); break; case 10: context.Response.Write(Fn.Exec("UPDATE tblCandidate_tblJobRequirement SET InterviewMarks='" + dataID[2] + "' WHERE tblCandidate_tblJobRequirementID='" + dataID[1] + "'")); break; case 11: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT tblCandidate_tblJobRequirement.tblCandidate_tblJobRequirementID, tblCandidate.Name, tblCandidate.FatherName AS [Father Name], CONVERT(varchar(50), tblCandidate.dtDOB, 103) AS DOB, tblCandidate.CNIC, tblCandidate.City, tblCandidate.District, tblCandidate.Phone, tblCandidate.Mobile, CONVERT(varchar(50), tblCandidate_tblJobRequirement.dtDateTime, 103) AS [Date Applied], ISNULL(tblCandidate_tblJobRequirement.InterviewMarks,0) AS [Interview Marks] FROM tblCandidate_tblJobRequirement INNER JOIN tblCandidate ON tblCandidate_tblJobRequirement.tblCandidateID = tblCandidate.tblCandidateID WHERE tblCandidate_tblJobRequirement.bIsShortListed = 1 and tblCandidate_tblJobRequirement.tblJobRequirementID =" + dataID[1] + " ORDER BY ISNULL(tblCandidate_tblJobRequirement.InterviewMarks,0) ", "tblJl")); break; case 12: context.Response.Write(Fn.HTMLTableWithID_TR_Tag(@"SELECT Login.LoginID,'' [Sr#], Login.UserName, tblDtl.Name, tblDtl.[Emp No], tblDtl.[Service Type], tblDtl.Father, tblDtl.CNIC, tblDtl.BPS, tblDtl.Designation, User_Groups.User_Group_Name [Group Name] FROM Login INNER JOIN (SELECT User_ID, Full_Name AS Name, '' AS [Emp No], '' AS [Service Type], FatherName AS Father, CNIC, '' AS BPS, Designation, 'TblHResources' AS TableName FROM TblHResources UNION SELECT tblEmployee.EmpID, ISNULL(tblEmployee.FName, '') + ' ' + ISNULL(tblEmployee.LName, '') AS Name, 'FRDP-EMP-' + RIGHT('00000' + CAST(ISNULL(tblEmployee.EmpNo, 0) AS VARCHAR(50)), 5) AS EMPNO, tblEmployee.PostTyp, ISNULL(tblEmployee.Father, '') AS Father, tblEmployee.CNIC, CASE WHEN tblEmployee.BPS = 0 THEN 'N/A' ELSE 'BPS' + CAST(tblEmployee.BPS AS VARCHAR(50)) END AS BPS, tblDesig.NAME AS Designation, 'tblEmployee' AS TableName FROM tbl_Company INNER JOIN tblDept INNER JOIN Shift INNER JOIN tblEmployee INNER JOIN TblDistrict ON tblEmployee.Domicile = TblDistrict.DistrictID ON Shift.Shift_ID = tblEmployee.tblEmpShiftID INNER JOIN tblDesig ON tblEmployee.tblDesigID = tblDesig.ID ON tblDept.ID = tblEmployee.tblDept ON tbl_Company.CompanyID = tblEmployee.tblCompanyID) AS tblDtl ON Login.Emp_Id = tblDtl.User_ID AND Login.TableName = tblDtl.TableName INNER JOIN User_Groups ON Login.User_Group_Id = User_Groups.User_Group_Id order by Login.UserName", "tblJl")); break; default: context.Response.Write("<p>Contents not available</p>"); break; } } catch { context.Response.ContentType = "text/HTML"; context.Response.Write("<p>Contents not available</p>"); } } }
public static string SaveBasicData(string vals, string loc) { string[] d = vals.Split('½'); string[] l = loc.Split('½'); if (d[17] == "0") { DataSet ds = Fn.FillDSet(@"SELECT 'FRDP-EMP-' +RIGHT('0000' + CAST(MAX(EmpNo) + 1 AS VARCHAR(50)) ,3) AS EmpNo , CAST(MAX(EmpNo) + 1 AS VARCHAR(50)) EC FROM ( SELECT CAST(EmpNo AS INT) EmpNo FROM [dbo].[TblHResources] WHERE EmpNo IS NOT NULL ) AS X"); DataTable dttt = ds.Tables[0]; string eno = Convert.ToString(dttt.Rows[0][0]); string en = Convert.ToString(dttt.Rows[0][1]); string UserID = Fn.ExenID("INSERT INTO TblHResources (EmpNo, CNIC, Full_Name, FatherName, DOB, Is_Male, CompanyID, DeptID, DesignationID, UserGroupID, ContactNos, U_Status, Qualification, Email, AppointmentDate, ResignationDate, Address, EnteryDate) VALUES ('" + en + "','" + d[1] + "','" + d[2] + "','" + d[3] + "','" + d[4] + "','" + d[5] + "','" + d[6] + "','" + d[7] + "','" + d[8] + "','" + d[9] + "','" + d[10] + "','" + d[11] + "','" + d[12] + "','" + d[13] + "','" + d[14] + "','" + d[15] + "','" + d[16] + "', Getdate()); Select Scope_Identity();"); Fn.Exec("DELETE FROM TblHResourcesLocations WHERE UserID=" + UserID); foreach (var item in l) { Fn.Exec(@"INSERT INTO TblHResourcesLocations (User_ID, LocID) VALUES (" + UserID + "," + item + ")"); } Fn.Exec(@"UPDATE TblHResources SET U_Pass ='******' where User_ID=" + UserID); Fn.Exec(@"INSERT INTO Login (UserName, Password, Created_Date, User_Group_Id, Emp_Id, Login_Status, IP_Check) VALUES ('" + eno + "' ,'" + Encryptor.Encrypt(eno) + "', GETDATE(),'" + d[9] + "','" + UserID + "', 1, 0)"); return(UserID); } else { Fn.Exec("UPDATE TblHResources SET CNIC = '" + d[1] + "', Full_Name = '" + d[2] + "', FatherName = '" + d[3] + "', DOB = '" + d[4] + "', Is_Male = '" + d[5] + "', CompanyID = '" + d[6] + "', DeptID = '" + d[7] + "', DesignationID = '" + d[8] + "', UserGroupID = '" + d[9] + "', ContactNos = '" + d[10] + "', U_Status = '" + d[11] + "', Qualification = '" + d[12] + "', Email = '" + d[13] + "', AppointmentDate = '" + d[14] + "', ResignationDate = '" + d[15] + "', Address = '" + d[16] + "' where User_ID = '" + d[17] + "'; Select Scope_Identity();"); Fn.Exec(@"UPDATE Login SET User_Group_Id='" + d[9] + "' WHERE Emp_Id =" + d[17]); Fn.Exec("DELETE FROM TblHResourcesLocations WHERE User_ID=" + d[17]); List <TblHResourcesLocation> el = new List <TblHResourcesLocation>(); foreach (var item in l) { // Fn.Exec(@"INSERT INTO TblHResourcesLocations (User_ID, LocID) VALUES (" + d[17] + "," + item + ")"); if (item != "") { el.Add(new TblHResourcesLocation() { LocID = Convert.ToInt32(item), User_ID = Convert.ToInt32(d[17]) }); } } if (l.Length > 0) { using (DBDataContext db = new DBDataContext()) { db.TblHResourcesLocations.InsertAllOnSubmit(el); db.SubmitChanges(); } } return(d[17]); } }
public static string MakeRequisition(string h, string i, string con, string thisid) { string ret = ""; JavaScriptSerializer jss = new JavaScriptSerializer(); var head = jss.Deserialize <Dictionary <string, dynamic> >(h); if (thisid == "0") { dynamic ai = JObject.Parse(i); decimal?tblInvReqMainID = 0; string tblInvReqNo = ""; using (DBDataContext db = new DBDataContext()) { db.sp_tblInvReqPurchaseMain_Insert(Convert.ToInt32(Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value))), Convert.ToInt32(con), Convert.ToDecimal(head["Head"]["StoreID"]), Convert.ToString(head["Head"]["StoreName"]), Convert.ToString(head["Head"]["Subject"]), Convert.ToString(head["Head"]["Description"]), ref tblInvReqMainID, ref tblInvReqNo); List <tblInvReqSub> l = new List <tblInvReqSub>(); foreach (var item in ai.Items) { var f = item; tblInvReqSub o = new tblInvReqSub(); o.ItemName = item.ItemName; o.Quality = item.Quality; o.Quantity = item.Quantity; o.tblInvReqMainID = tblInvReqMainID; o.temID = item.ItemID; o.Unit = item.Unit; l.Add(o); } db.tblInvReqSubs.InsertAllOnSubmit(l); db.SubmitChanges(); } ret = Convert.ToString(tblInvReqMainID) + "½" + tblInvReqNo; } else { MyClass Fn = new MyClass(); Fn.Exec("delete [dbo].[tblInvReqSub] where tblInvReqMainID=" + thisid.Split('½')[0]); Fn.Exec(@"UPDATE tblInvReqMain SET Status ='" + con + @"', ToStoreID ='" + Convert.ToString(head["Head"]["StoreID"]) + @"', StoreName ='" + Convert.ToString(head["Head"]["StoreName"]) + @"', Subject ='" + Convert.ToString(head["Head"]["Subject"]) + @"', Description ='" + Convert.ToString(head["Head"]["Description"]) + @"' WHERE (tblInvReqMainID = " + thisid.Split('½')[0] + @" )"); using (DBDataContext db = new DBDataContext()) { dynamic ai = JObject.Parse(i); List <tblInvReqSub> l = new List <tblInvReqSub>(); foreach (var item in ai.Items) { var f = item; tblInvReqSub o = new tblInvReqSub(); o.ItemName = item.ItemName; o.Quality = item.Quality; o.Quantity = item.Quantity; o.tblInvReqMainID = Convert.ToDecimal(thisid.Split('½')[0]); o.temID = item.ItemID; o.Unit = item.Unit; l.Add(o); } db.tblInvReqSubs.InsertAllOnSubmit(l); db.SubmitChanges(); } ret = thisid; } return(ret); }
public static string SaveData(string EmpId, string PensionMonth, string PensionYear, string Bank, string MonthlyPension, string MedicalAllowance, string Arrears, string Deductions, string NetPaid, string Remarks) { return(Fn.Exec("usp_PensionMonthlyTransfer '" + EmpId + "' ,'" + PensionMonth + "','" + PensionYear + "','" + Bank + "','" + MonthlyPension + "','" + MedicalAllowance + "','" + Arrears + "','" + Deductions + "','" + NetPaid + "','" + Remarks + "' ")); }
public void ProcessRequest(HttpContext context) { try { var frmdata = context.Request.Form["vls"]; var Province = context.Request.Form["Province"]; string[] d = frmdata.Split('½'); int benID = 0; using (DBDataContext db = new DBDataContext()) { if (db.TblHResources.Where(v => v.ContactNos == d[2]).Count() == 0) { TblHResource obj = new TblHResource(); obj.Full_Name = d[1]; obj.ContactNos = d[2]; obj.UserGroupID = Convert.ToInt32(d[4]); obj.Email = d[5]; obj.U_Pass = Encryptor.Encrypt(d[6].Replace("'", "")); obj.EnteryDate = DateTime.Now; obj.U_Status = true; obj.U_ThemeID = 1; obj.Designation = d[3]; db.TblHResources.InsertOnSubmit(obj); db.SubmitChanges(); benID = obj.User_ID; //new Thread(() => //{ QR objQR = new QR(); objQR.QrGenerate(Convert.ToString(benID), "TblHResources", Convert.ToString(benID)); //string result = LongRunningMethod("World"); //Dispatcher.BeginInvoke((Action)(); //}).Start(); string[] l = Province.Split('½'); Fn.ExenID(@"INSERT INTO Login (UserName, Password, Created_Date, User_Group_Id, Emp_Id, Login_Status, IP_Check) VALUES ('" + d[2] + "' ,'" + Encryptor.Encrypt(d[6]) + "', GETDATE(),'" + d[4] + "','" + benID + "', 1, 0)"); foreach (var item in l) { Fn.Exec(@"INSERT INTO TblHResourcesLocations (User_ID, LocID) VALUES (" + benID + "," + item + ")"); } } else { context.Response.ContentType = "text/plain"; context.Response.Write("Record Already Exists"); } } if (context.Request.Files.Count > 0 && benID > 0) { HttpFileCollection SelectedFiles = context.Request.Files; for (int i = 0; i < SelectedFiles.Count; i++) { HttpPostedFile PostedFile = SelectedFiles[i]; string FileName = context.Server.MapPath("~/Uploads/EmployeePhoto/" + PostedFile.FileName); string Path = context.Server.MapPath("~/Uploads/EmployeePhoto/"); FileInfo fi = new FileInfo(FileName); int fileID = benID; using (DBDataContext db = new DBDataContext()) { var o = db.TblHResources.Where(v => v.User_ID == fileID).FirstOrDefault(); if (o != null) { o.PhotoExtension = fi.Extension; o.DisplayName = fi.Extension; db.SubmitChanges(); } } PostedFile.SaveAs(Path + Convert.ToString(fileID) + fi.Extension); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(fileID) + fi.Extension, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(fileID) + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(Path + Convert.ToString(fileID) + fi.Extension, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(context.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(fileID) + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } //using (DBDataContext db = new DBDataContext()) //{ // db.sp_RegisterEmpWithLogin(d[0], d[1], "", "", "", d[2], d[5], "", d[3], 1, 1, DateTime.Now, Encryptor.Encrypt(d[6].Replace("'", "")), Convert.ToInt32(d[4]), Convert.ToString(benID)+"."+ fi.Extension); //} context.Response.ContentType = "text/plain"; context.Response.Write("Record Saved"); } } else if (benID > 0) { //using (DBDataContext db = new DBDataContext()) //{ // db.sp_RegisterEmpWithLogin(d[0], d[1], "", "", "", d[2], d[5], "", d[3], 1, 1, DateTime.Now, Encryptor.Encrypt(d[6].Replace("'", "")), Convert.ToInt32(d[4]), null); //} context.Response.ContentType = "text/plain"; context.Response.Write("Record Saved"); } //context.Response.ContentType = "text/plain"; //context.Response.Write("Files Uploaded Successfully!!"); } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public static String AddLoc(String Loc, string Latude, string Path, string TypeID, string ParentID, string Population) { // string myret = Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(TypeID).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")"); // return myret; ///8888888888888888888888888888888888888888888888888TypeID switch (TypeID) { case "1": // return "tblCountry"; using (DBDataContext db = new DBDataContext()) { if (db.TblCountries.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim()).Count() > 0) { return("-1"); } else { TblCountry tbl = new TblCountry(); tbl.LocName = Loc; tbl.Latitude = Latude; tbl.Path = Path; tbl.Lat = Latude; tbl.Longitude = Latude; db.TblCountries.InsertOnSubmit(tbl); db.SubmitChanges(); return("1"); } } case "2": //return "TblProvince"; using (DBDataContext db = new DBDataContext()) { if (db.TblProvinces.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.CountryID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "3": //return "TblRegion"; using (DBDataContext db = new DBDataContext()) { if (db.TblRegions.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.ProvinceID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "4": // return "TblDistrict"; using (DBDataContext db = new DBDataContext()) { if (db.TblDistricts.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim()).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "5": // return "TblTehsil"; using (DBDataContext db = new DBDataContext()) { if (db.TblTehsils.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.DistrictID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "6": // return "TblFeildUnit"; using (DBDataContext db = new DBDataContext()) { if (db.TblFeildUnits.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.TehsilID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "7": // return "TblUnionConcil"; using (DBDataContext db = new DBDataContext()) { if (db.TblUnionConcils.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.FeildUnitID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + ParentID + ")")); case "8": // return "TblVillageCity"; using (DBDataContext db = new DBDataContext()) { if (db.TblVillageCities.Where(v => v.LocName.ToUpper().Trim() == Loc.ToUpper().Trim() && v.UnionConcilID == Convert.ToInt32(ParentID)).Count() > 0) { return("-1"); } } return(Fn.Exec("insert into " + getTblName(TypeID) + " (LocName,Lat,Path,Population," + getTblName(Convert.ToString(Convert.ToInt32(TypeID) - 1)).ToUpper().Replace("TBL", "") + "ID) values('" + Loc + "','" + Latude + "','" + Path + "'," + Population + "," + ParentID + ")")); default: return(""); } //var loca = db.s.Where(v => v.LocName.ToUpper() == Loc.ToUpper() && v.TypeID == Convert.ToInt32(TypeID)).FirstOrDefault(); //if (loca != null) //{ // return "-1"; //} //else //{ // return Fn.Exec("insert into (LocName,Lat,Path,TypeID,ParentID) values('" + Loc + "','" + Latude + "','" + Path + "','" + TypeID + "'," + ParentID + ")"); //} //} //return ""; }
public void ProcessRequest(HttpContext context) { MyClass Fn = new MyClass(); string[] dataID = Fn.CleanSQL(HttpUtility.UrlDecode(context.Request.QueryString["id"])).Split('ǁ'); { try { context.Response.ContentType = "text/HTML"; switch (Convert.ToInt32(dataID[0])) { case 0: using (DBDataContext db = new DBDataContext()) { if (db.tblElecticityMeters.Where(vv => vv.MeterNo.ToUpper() == dataID[4].ToUpper()).Count() > 0) { context.Response.Write("Meter No Already Registered"); break; } } if (dataID[2] == "WAPDA In") { context.Response.Write(Fn.Exec(@"INSERT INTO dbo.tblElecticityMeter (tbl_Company_LocationID, MeterType, MeterPlacedAt, MeterNo, MeterReading, OwnerName, OwnerType, Emp_Id, dtDateTime, MultipleFactor) VALUES ('" + dataID[1] + "','" + dataID[2] + "','" + dataID[3] + "','" + dataID[4] + "','" + dataID[5] + "','" + dataID[6] + "','" + dataID[7] + "','" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + "',GETDATE() , '" + dataID[8] + "')")); } else if (dataID[2] == "Main Meter") { context.Response.Write(Fn.Exec(@"INSERT INTO dbo.tblElecticityMeter (tbl_Company_LocationID, MeterType, WapdaMeterID, MeterPlacedAt, MeterNo, MeterReading, OwnerName, OwnerType, Emp_Id, dtDateTime, MultipleFactor) VALUES ('" + dataID[1] + "','" + dataID[2] + "','" + dataID[3] + "','" + dataID[4] + "','" + dataID[5] + "','" + dataID[6] + "','" + dataID[7] + "','" + dataID[8] + "','" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + "',GETDATE() , '" + dataID[9] + "')")); } else if (dataID[2] == "Sub Meter") { context.Response.Write(Fn.Exec(@"INSERT INTO dbo.tblElecticityMeter (tbl_Company_LocationID, MeterType, WapdaMeterID, MainMeterID, MeterPlacedAt, MeterNo, MeterReading, OwnerName, OwnerType, Emp_Id, dtDateTime, MultipleFactor) VALUES ('" + dataID[1] + "','" + dataID[2] + "','" + dataID[3] + "','" + dataID[4] + "','" + dataID[5] + "','" + dataID[6] + "','" + dataID[7] + "','" + dataID[8] + "','" + dataID[9] + "','" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + "',GETDATE() , '" + dataID[10] + "')")); } break; case 1: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeter.MeterNo, tblElecticityMeter.tblElecticityMeterID, tblElecticityMeter.MeterType, tblElecticityMeter.OwnerName, tblElecticityMeter.tbl_Company_LocationID, tblElecticityMeter.MeterReading, tblElecticityMeter.Emp_Id, tblElecticityMeter.dtDateTime, tbl_Company.CompanyName FROM tblElecticityMeter INNER JOIN tbl_Company ON tblElecticityMeter.tbl_Company_LocationID = tbl_Company.CompanyID")); break; case 2: context.Response.Write(Fn.Exec(@"DELETE FROM tblElecticityMeter WHERE tblElecticityMeterID = " + dataID[1])); break; case 3: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeter.MeterNo, tblElecticityMeter.tblElecticityMeterID, tblElecticityMeter.MeterType, tblElecticityMeter.OwnerName, tblElecticityMeter.tbl_Company_LocationID, tblElecticityMeter.MeterReading, tblElecticityMeter.Emp_Id, tblElecticityMeter.dtDateTime, tbl_Company.CompanyName FROM tblElecticityMeter INNER JOIN tbl_Company ON tblElecticityMeter.tbl_Company_LocationID = tbl_Company.CompanyID where tblElecticityMeter.tblElecticityMeterID =" + dataID[1])); break; case 4: context.Response.Write(Fn.Exec(@"UPDATE tblElecticityMeter SET MeterNo ='" + dataID[1] + "', MeterType ='" + dataID[2] + "', OwnerName ='" + dataID[3] + "', tbl_Company_LocationID ='" + dataID[4] + "', MeterReading ='" + dataID[5] + "' WHERE tblElecticityMeterID=" + dataID[6])); break; case 5: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeterID, MeterNo FROM tblElecticityMeter WHERE (tbl_Company_LocationID =" + dataID[1] + ") ORDER BY MeterNo")); break; case 6: string[] d6 = dataID[3].Split('-'); DateTime dt6 = new DateTime(Convert.ToInt32(d6[2]), Convert.ToInt32(d6[1]), Convert.ToInt32(d6[0])); context.Response.Write(Fn.Exec(@"INSERT INTO tblElecticityMeterReading (tblElecticityMeterID, dtDate, reading, OffPeakReading, OnPeakReading) VALUES ('" + dataID[2] + "','" + dt6 + "','" + dataID[4] + "', '" + dataID[5] + "', '" + dataID[6] + "')")); break; case 7: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeterReading.tblElecticityMeterReadingID, CONVERT(VARCHAR(50),tblElecticityMeterReading.dtDate,103) AS dtDate, tblElecticityMeterReading.reading, tblElecticityMeterReading.tblElecticityMeterID, tblElecticityMeter.MeterNo FROM tblElecticityMeterReading INNER JOIN tblElecticityMeter ON tblElecticityMeterReading.tblElecticityMeterID = tblElecticityMeter.tblElecticityMeterID ORDER BY tblElecticityMeterReading.dtDate , tblElecticityMeter.MeterNo ")); break; case 8: context.Response.Write(Fn.Exec(@"DELETE FROM tblElecticityMeterReading WHERE tblElecticityMeterReadingID = " + dataID[1])); break; ////////////////////////////////////////// case 9: context.Response.Write(Fn.Data2Json(@"SELECT tblGeneratorMaintinanceID, CONVERT(VARCHAR(50), dtDateTime, 103) AS dtDateTime, MeterReading, HoursValue,Parts, Description, tblGeneratorID FROM tblGeneratorMaintinance WHERE tblGeneratorID=" + dataID[1] + "ORDER BY dtDateTime")); break; case 10: string[] d10 = dataID[1].Split('-'); DateTime dt10 = new DateTime(Convert.ToInt32(d10[2]), Convert.ToInt32(d10[1]), Convert.ToInt32(d10[0])); context.Response.Write(Fn.Exec(@"INSERT INTO tblGeneratorOnOff (dtDate, DipVlue, MeterReading, OnTime, OffTime, Description, tblGeneratorID) VALUES ('" + dt10 + "','" + dataID[5] + "','" + dataID[4] + "','" + d10[2] + '-' + d10[1] + '-' + d10[0] + ' ' + dataID[2] + "','" + d10[2] + '-' + d10[1] + '-' + d10[0] + ' ' + dataID[3] + "','" + dataID[6] + "', " + dataID[7] + ")")); break; case 11: context.Response.Write(Fn.Data2Json(@"SELECT tblGeneratorID AS ID, ISNULL(Modal,'') +' '+ ISNULL(Brand,'') AS Modal FROM tblGenerator WHERE LocationID =" + dataID[1])); break; case 12: context.Response.Write(Fn.Data2Json(@"SELECT tblGenerator.tblGeneratorID, tblGenerator.LocationID, tblGenerator.EnterbyEmp, tblGenerator.dtEnteredDate, tblGenerator.Modal, tblGenerator.Brand, tblGenerator.Capacity, tblGenerator.FuleTankSize, tblGenerator.FuleFilterModal, tblGenerator.OilFilterModal, tblGenerator.WaterFilterModal, tblGenerator.AirFilterModal, tblGenerator.OilQuantity, tblGenerator.coolentQuantity, tblGenerator.ServiceDurationHours, tblGenerator.MinFuleLevelLiter, tblGenerator.CurrentMeterReading, tblGenerator.GeneratorLifeHours, tbl_Company.CompanyName AS LocationName FROM tblGenerator INNER JOIN tbl_Company ON tblGenerator.LocationID = tbl_Company.CompanyID where tblGenerator.tblGeneratorID=" + dataID[1])); break; case 13: context.Response.Write(Fn.Data2Json(@"Select tblElecticityMeterID , MeterNo from tblElecticityMeter where tbl_Company_LocationID='" + dataID[1] + "' AND MeterType='WAPDA In'")); break; case 14: context.Response.Write(Fn.Data2Json(@"Select tblElecticityMeterID , MeterNo from tblElecticityMeter where tbl_Company_LocationID='" + dataID[1] + "' AND WapdaMeterID='" + dataID[2] + "' AND MeterType='Main Meter'")); break; case 15: context.Response.Write(Fn.Data2Json(@"Select Distinct MeterPlacedAt from tblElecticityMeter Where MeterPlacedAt is not NULL AND tbl_Company_LocationID=" + dataID[1])); break; case 16: context.Response.Write(Fn.Data2Json(@"Select Distinct OwnerName from tblElecticityMeter Where OwnerName is not NULL AND tbl_Company_LocationID=" + dataID[1])); break; case 17: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeterReading.tblElecticityMeterReadingID, CONVERT(VARCHAR(50), tblElecticityMeterReading.dtDate, 103) AS dtDate, tblElecticityMeterReading.reading, tblElecticityMeterReading.tblElecticityMeterID, tblElecticityMeter.MeterNo, ISNULL(tblElecticityMeterReading.OffPeakReading, '0') AS OffPeakReading, ISNULL(tblElecticityMeterReading.OnPeakReading, '0') AS OnPeakReading FROM tblElecticityMeterReading INNER JOIN tblElecticityMeter ON tblElecticityMeterReading.tblElecticityMeterID = tblElecticityMeter.tblElecticityMeterID WHERE (tblElecticityMeterReading.tblElecticityMeterID = " + dataID[1] + @") and (DATEPART(MM,tblElecticityMeterReading.dtDate) = " + dataID[2].Split('-')[1] + @") AND (DATEPART(YYYY,tblElecticityMeterReading.dtDate) = " + dataID[2].Split('-')[2] + @") ORDER BY tblElecticityMeterReading.dtDate , tblElecticityMeter.MeterNo")); break; case 18: context.Response.Write(Fn.Data2Json(@"SELECT tblElecticityMeter.MeterNo, tblElecticityMeter.tblElecticityMeterID, tblElecticityMeter.MeterType, tblElecticityMeter.OwnerName, tblElecticityMeter.tbl_Company_LocationID, tblElecticityMeter.MeterReading, tblElecticityMeter.Emp_Id, tblElecticityMeter.dtDateTime, tbl_Company.CompanyName FROM tblElecticityMeter INNER JOIN tbl_Company ON tblElecticityMeter.tbl_Company_LocationID = tbl_Company.CompanyID WHERE tblElecticityMeter.tbl_Company_LocationID = " + dataID[1])); break; // case 13: //context.Response.Write(Fn.Data2Json(@"")); //break; // case 13: //context.Response.Write(Fn.Data2Json(@"")); //break; default: context.Response.Write("<p>Contents not available</p>"); break; } } catch { context.Response.ContentType = "text/HTML"; context.Response.Write("<p>Contents not available</p>"); } } }
protected void btnLogin_Click(object sender, EventArgs e) { if (ValidateControls()) { try { string ssssssssssss = Encryptor.Encrypt(txtPass.Text); DataTable DT = Fn.FillDSet("sp_Login '" + txtUser.Text + "','" + Encryptor.Encrypt(txtPass.Text) + "'").Tables[0]; if (txtPass.Text == Encryptor.Decrypt(DT.Rows[0]["Password"].ToString())) { //string EN = ""; //int? EID = 0, UGID = 0; //bool? IsAllowed = false; //using (DBDataContext db = new DBDataContext()) //{ // db.User_Login(txtUser.Text, ssssssssssss, ref EN, ref EID, ref UGID, "", ref IsAllowed); //} //if (Convert.ToBoolean(IsAllowed) && Convert.ToInt32(EID) > 0) //{ Session.Add("EmpName", Convert.ToString(DT.Rows[0]["EmpName"])); Response.Cookies["EmpName"].Value = Convert.ToString(DT.Rows[0]["EmpName"]); Response.Cookies["EmpName"].Expires = DateTime.Now.AddDays(1); Session.Add("bIsEmployee", Convert.ToString(DT.Rows[0]["bIsEmployee"])); Response.Cookies["bIsEmployee"].Value = Convert.ToString(DT.Rows[0]["bIsEmployee"]); Response.Cookies["bIsEmployee"].Expires = DateTime.Now.AddDays(1); Session.Add("Emp_Id", Convert.ToString(DT.Rows[0]["Emp_Id"])); Response.Cookies["Emp_Id"].Value = Convert.ToString(DT.Rows[0]["Emp_Id"]); Response.Cookies["Emp_Id"].Expires = DateTime.Now.AddDays(1); //READ Cookie in c# //Convert.ToString(HttpContext.Current.Session["Emp_Id"]); Session.Add("User_Group_ID", Convert.ToString(DT.Rows[0]["User_Group_ID"])); Response.Cookies["User_Group_ID"].Value = Convert.ToString(DT.Rows[0]["User_Group_ID"]); Response.Cookies["User_Group_ID"].Expires = DateTime.Now.AddDays(1); Session.Add("UserID", Convert.ToString(DT.Rows[0]["UserID"])); Response.Cookies["UserID"].Value = Convert.ToString(DT.Rows[0]["UserID"]); Response.Cookies["UserID"].Expires = DateTime.Now.AddDays(1); Session.Add("username", Convert.ToString(DT.Rows[0]["UserName"])); Response.Cookies["username"].Value = Convert.ToString(DT.Rows[0]["UserName"]); Response.Cookies["username"].Expires = DateTime.Now.AddDays(1); Session.Add("onlyname", Convert.ToString(DT.Rows[0]["onlyname"])); Response.Cookies["onlyname"].Value = Convert.ToString(DT.Rows[0]["onlyname"]); Response.Cookies["onlyname"].Expires = DateTime.Now.AddDays(1); Session.Add("GroupID", Convert.ToString(DT.Rows[0]["GroupID"])); Response.Cookies["GroupID"].Value = Convert.ToString(DT.Rows[0]["GroupID"]); Response.Cookies["GroupID"].Expires = DateTime.Now.AddDays(1); //Session.Add("PRD", DT.Rows[0][5]); Session.Add("ContactNo", Convert.ToString(DT.Rows[0]["ContactNo"])); Response.Cookies["ContactNo"].Value = Convert.ToString(DT.Rows[0]["ContactNo"]); Response.Cookies["ContactNo"].Expires = DateTime.Now.AddDays(1); Session.Add("email", Convert.ToString(DT.Rows[0]["Email"])); Response.Cookies["email"].Value = Convert.ToString(DT.Rows[0]["Email"]); Response.Cookies["email"].Expires = DateTime.Now.AddDays(1); Session.Add("designation", Convert.ToString(DT.Rows[0]["designation"])); Response.Cookies["designation"].Value = Convert.ToString(DT.Rows[0]["designation"]); Response.Cookies["designation"].Expires = DateTime.Now.AddDays(1); Session.Add("picExt", Convert.ToString(DT.Rows[0]["picExt"])); Response.Cookies["picExt"].Value = Convert.ToString(DT.Rows[0]["picExt"]); Response.Cookies["picExt"].Expires = DateTime.Now.AddDays(1); Session.Add("CompanyID", Convert.ToString(DT.Rows[0]["CompanyID"])); Response.Cookies["CompanyID"].Value = Convert.ToString(DT.Rows[0]["CompanyID"]); Response.Cookies["CompanyID"].Expires = DateTime.Now.AddDays(1); //Response.Cookies["theme"].Value = DT.Rows[0][3].ToString(); //Response.Cookies["theme"].Expires = DateTime.Now.AddDays(1); //Response.Cookies["PRD"].Value = HttpUtility.UrlEncode(DT.Rows[0][5].ToString()); //Response.Cookies["PRD"].Expires = DateTime.Now.AddDays(1); Response.Cookies["FirstRun"].Value = "1"; Response.Cookies["FirstRun"].Expires = DateTime.Now.AddDays(1); string S = Fn.ExenID("select TOP(1) Format(AMonth, 'MM')+Format(AMonth, 'yyy') AMonth from tblMonthCloseing"); Session.Add("Amonth", S); Session.Add("OfficeId", 16); Response.Cookies["OfficeId"].Value = "16"; Response.Cookies["OfficeId"].Expires = DateTime.Now.AddDays(1); // string[] info = Fn.GetRecords("SELECT AccYear, AccYear2, CodeSt, AMonth, AcYrID FROM tblSetup WHERE (CompID = 16)"); Session.Add("ActYr", Fn.FirstDayOfMonthFromDateTime(Convert.ToDateTime(info[0]))); Response.Cookies["ActYr"].Value = Convert.ToString(Fn.FirstDayOfMonthFromDateTime(Convert.ToDateTime(info[0]))); Response.Cookies["ActYr"].Expires = DateTime.Now.AddDays(1); Session.Add("ActYr2", Fn.LastDayOfMonthFromDateTime(Convert.ToDateTime(info[1]))); Response.Cookies["ActYr2"].Value = Convert.ToString(Fn.LastDayOfMonthFromDateTime(Convert.ToDateTime(info[1]))); Response.Cookies["ActYr2"].Expires = DateTime.Now.AddDays(1); Session.Add("ActMth", Convert.ToDateTime(info[3]).ToString("MMMM yyyy")); Response.Cookies["ActMth"].Value = Convert.ToString(Convert.ToDateTime(info[3]).ToString("MMMM yyyy")); Response.Cookies["ActMth"].Expires = DateTime.Now.AddDays(1); Session.Add("CodeSt", info[2]); Response.Cookies["CodeSt"].Value = Convert.ToString(info[2]); Response.Cookies["CodeSt"].Expires = DateTime.Now.AddDays(1); Session.Add("br", "16"); Response.Cookies["br"].Value = "16"; Response.Cookies["br"].Expires = DateTime.Now.AddDays(1); Session.Add("fy", Convert.ToString(info[4])); Response.Cookies["fy"].Value = Convert.ToString(info[4]); Response.Cookies["fy"].Expires = DateTime.Now.AddDays(1); //$.cookie('fy', $('#ddYear').val()); //$.cookie('ey', $('#ddey').val()); string S1 = Fn.ExenID("select TOP(1) Format(AMonth, 'MM')+Format(AMonth, 'yyy') AMonth from tblMonthCloseing"); //Session.Add("ActMth", S1); Session.Add("OfficeId", 16); Fn.Exec("INSERT INTO tblUserLog(UserID) VALUES (" + Convert.ToString(DT.Rows[0]["UserID"]) + ")"); Response.Cookies["xx"].Value = S; Response.Cookies["xx"].Expires = DateTime.Now.AddDays(1); Response.Cookies["yy"].Value = "16"; Response.Cookies["yy"].Expires = DateTime.Now.AddDays(1); Response.Redirect(DT.Rows[0]["MP"].ToString()); //} } else { lblMsg.Text = "The username or password you entered is incorrect."; lblMsg.Visible = true; } } catch (Exception ex) { lblMsg.Text = "The username or password you entered is incorrect..."; lblMsg.Visible = true; } } }