Exemplo n.º 1
0
    //protected   void btnBookNow_Click           (object sender, EventArgs e)
    //{
    //    var UserID = Convert.ToInt32(ddlNames.SelectedValue);
    //    var BusNumber = Convert.ToInt32(ddlBusNumber.SelectedValue);
    //    var SeatNumber = Convert.ToInt32(ddlSeatNumber.SelectedValue);
    //    var PayanamID = Convert.ToInt32(Request.QueryString["pid"]);

    //    using (VallabaiDataContext db = new VallabaiDataContext())
    //    {
    //        var check = from c in db.tab_VA_BUS_BOOKINGs
    //                    where c.payanam_ID == PayanamID && c.user_ID == UserID
    //                    select c;
    //        if (check.Count() == 0)
    //        {

    //            tab_VA_BUS_BOOKING book = new tab_VA_BUS_BOOKING();
    //            book.payanam_ID = PayanamID;
    //            book.user_ID = UserID;
    //            book.bus_NUMBER = BusNumber;
    //            book.seat_NUMBER = SeatNumber;

    //            db.tab_VA_BUS_BOOKINGs.InsertOnSubmit(book);
    //            db.SubmitChanges();
    //            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('Seat Booked')});", true);
    //            BindBookedSeats();
    //        }
    //        else
    //        {
    //            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('Seat is already alloted to this Swamy')});", true);
    //        }
    //    }

    //}

    protected void gvCancel_Click(object sender, EventArgs e)
    {
        var    PayanamID       = Convert.ToInt32(Request.QueryString["pid"]);
        string CommandArgument = Convert.ToString(((Button)sender).CommandArgument);

        if (CommandArgument.Contains(","))
        {
            var Values     = CommandArgument.Split(',');
            var SeatNumber = Convert.ToInt32(Values[0]);
            var BusNumber  = Convert.ToInt32(Values[1]);

            using (VallabaiDataContext db = new VallabaiDataContext())
            {
                var seat = from s in db.tab_VA_BUS_BOOKINGs
                           where s.payanam_ID == PayanamID && s.seat_NUMBER == SeatNumber && s.bus_NUMBER == BusNumber
                           select s;
                if (seat.Count() > 0)
                {
                    foreach (var item in seat)
                    {
                        db.tab_VA_BUS_BOOKINGs.DeleteOnSubmit(item);
                        db.SubmitChanges();
                    }
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('Cancelled selected seat')});", true);
                    BindBookedSeats();
                    //LoadSeatNumbers();
                    ClearFields();
                }
            }
        }
    }
Exemplo n.º 2
0
    public static string SeatBooking(int PayanamID, int BusID, int UserID, int SeatNumber)
    {
        string Response = string.Empty;

        using (VallabaiDataContext db = new VallabaiDataContext())
        {
            try
            {
                var seat = from s in db.tab_VA_BUS_BOOKINGs
                           where s.payanam_ID == PayanamID && s.bus_NUMBER == BusID && s.seat_NUMBER == SeatNumber
                           select s;
                if (seat.Count() == 0)
                {
                    tab_VA_BUS_BOOKING booking = new tab_VA_BUS_BOOKING();
                    booking.payanam_ID  = PayanamID;
                    booking.bus_NUMBER  = BusID;
                    booking.user_ID     = UserID;
                    booking.seat_NUMBER = SeatNumber;

                    db.tab_VA_BUS_BOOKINGs.InsertOnSubmit(booking);
                    db.SubmitChanges();
                    Response = "Seat is Alloted";
                }
                else
                {
                    Response = "Selected Seat is not available";
                }
            }
            catch (Exception ex)
            {
                Response = "Some error occured : " + ex.Message;
            }
        }
        return(Response);
    }
Exemplo n.º 3
0
    protected void btnSaveBusDetails_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            var PayanamID          = Convert.ToInt32(Request.QueryString["pID"]);
            var BusType            = ddlVehicleType.SelectedValue;
            var RegistrationNumber = txtRegistrationNumber.Text;
            var BusNumber          = Convert.ToInt32(txtBusNumber.Text);
            var TotalSeats         = Convert.ToInt32(txtTotalSeats.Text);
            var DriverName         = txtDriverName.Text;
            var DriverMobileNumber = txtDriverMobileNumber.Text;

            using (VallabaiDataContext db = new VallabaiDataContext())
            {
                try
                {
                    tab_VA_PAYANAM_BUS_DETAIL detail = new tab_VA_PAYANAM_BUS_DETAIL();
                    detail.bus_PAYANAM_NUMBER      = PayanamID;
                    detail.vehicle_TYPE            = BusType;
                    detail.bus_REGISTRATION_NUMBER = RegistrationNumber;
                    detail.bus_NUMBER               = BusNumber;
                    detail.bus_TOTAL_SEATS          = TotalSeats;
                    detail.bus_DRIVER_NAME          = DriverName;
                    detail.bus_DRIVER_MOBILE_NUMBER = DriverMobileNumber;

                    db.tab_VA_PAYANAM_BUS_DETAILs.InsertOnSubmit(detail);
                    db.SubmitChanges();

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('User Details updated successfully')});", true);
                }
                catch (Exception ex)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('" + ex.Message.ToString() + "')});", true);
                }
            }
        }
        else
        {
            Response.Write("Sethu");
        }
    }
Exemplo n.º 4
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        var             fileName         = flData.FileName;
        var             fileContentType  = flData.PostedFile.ContentType;
        var             pathUploaded     = Uploader.FileUploader(flData.PostedFile);
        var             connectionString = Uploader.GetExcelConnectionString(fileContentType, pathUploaded);
        OleDbConnection OleCon           = new OleDbConnection(connectionString);
        DataTable       tbl = new DataTable("MyTable");

        OleCon.Open();
        var              tableName = OleCon.GetSchema("Tables").Rows[0]["TABLE_NAME"];
        OleDbCommand     OleCmd    = new OleDbCommand(string.Format("Select * from [{0}]", tableName), OleCon);
        OleDbDataAdapter adp       = new OleDbDataAdapter(OleCmd);

        adp.Fill(tbl);

        using (VallabaiDataContext db = new VallabaiDataContext())
        {
            foreach (DataRow row in tbl.Rows)
            {
                var OldRegID    = Convert.ToString(row.ItemArray[0]);
                var Code        = OldRegID;
                var Name        = Convert.ToString(row.ItemArray[1]);
                var FatherName  = Convert.ToString(row.ItemArray[2]);
                var Address     = Convert.ToString(row.ItemArray[3]);
                var Age         = Convert.ToString(row.ItemArray[4]);
                var MalaiDetail = Convert.ToString(row.ItemArray[5]);
                var MalaiCount  = 0;
                if (MalaiDetail != "")
                {
                    MalaiCount = 0;
                }
                else if (MalaiDetail == "KANNI")
                {
                    MalaiCount = 1;
                }
                else
                {
                    MalaiCount = Convert.ToInt32(MalaiDetail);
                }

                var MobileNumber = Convert.ToString(row.ItemArray[6]);
                var Membership   = Convert.ToString(row.ItemArray[10]);
                var IsMember     = false;
                if (Membership != "")
                {
                    IsMember = true;
                }

                tab_VA_SWAMY_REGISTRATION reg = new tab_VA_SWAMY_REGISTRATION();
                try
                {
                    reg.swamy_CODE               = Code;
                    reg.swamy_OLD_REG_NUMBER     = OldRegID;
                    reg.swamy_NAME               = Name;
                    reg.swamy_FATHER_SPOUSE_NAME = FatherName;
                    reg.swamy_GENDER             = "Male";
                    reg.swamy_IS_MEMBER          = IsMember;
                    reg.swamy_PLACE              = Address;
                    reg.swamy_ADDRESS            = Address;
                    reg.swamy_MOBILE_NUMBER      = MobileNumber;
                    reg.swamy_DISTRICT           = "Ramanathapuram";
                    reg.swamy_MALAI_VISIT        = MalaiCount;
                    reg.swamy_MEMBERSHIP_TYPE    = Membership;

                    db.tab_VA_SWAMY_REGISTRATIONs.InsertOnSubmit(reg);
                    db.SubmitChanges();
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
            Response.Write("Upload Completed");
        }
    }
Exemplo n.º 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            var SwamyName       = txtName.Text;
            var SwamyFatherName = txtFatherName.Text;
            var SwamyGender     = string.Empty;
            if (rdlSwamy.Checked)
            {
                SwamyGender = rdlSwamy.Value;
            }
            else
            {
                SwamyGender = rdlMaaligaipuram.Value;
            }
            var SwamyDOB = string.Empty;
            if (Utilities.isValidDate(txtDOB.Text))
            {
                SwamyDOB = txtDOB.Text;
            }

            var SwamyMobileNumber    = txtMobileNumber.Text;
            var SwamyAlternateMobile = txtAlternateMobile.Text;
            var SwamyPlace           = txtPlace.Text;
            var SwamyAddress         = txtAddress.Text;
            var SwamyDistrict        = ddlDistrict.SelectedValue;
            var SwamyBloodGroup      = ddlBloodGroup.SelectedValue;
            var SwamyMalaiVisit      = 0;
            if (Utilities.isNumber(txtMalai.Text))
            {
                SwamyMalaiVisit = Convert.ToInt32(txtMalai.Text);
            }
            var SwamyKanniPoojaiDate = string.Empty;
            if (Utilities.isValidDate(txtKanniPoojaiDate.Text))
            {
                SwamyKanniPoojaiDate = txtKanniPoojaiDate.Text;
            }
            var SwamyMemebershipExpiry = string.Empty;
            if (Utilities.isValidDate(txtMembershipExpiry.Text))
            {
                SwamyMemebershipExpiry = txtMembershipExpiry.Text;
            }

            var SwamyMembership = string.Empty;
            if (rdlNonMeber.Checked)
            {
                SwamyMembership = rdlNonMeber.Value;
            }
            else if (rdlLifetime.Checked)
            {
                SwamyMembership = rdlLifetime.Value;
            }
            else
            {
                SwamyMembership = rdlShortTermMember.Value;
            }

            //Get Swamy Code


            if (btnSave.Text == "Save")
            {
                var SwamyCode = Utilities.GetSwamyCode();

                using (VallabaiDataContext db = new VallabaiDataContext())
                {
                    tab_VA_SWAMY_REGISTRATION regis = new tab_VA_SWAMY_REGISTRATION();
                    regis.swamy_CODE = SwamyCode;
                    regis.swamy_NAME = SwamyName;
                    regis.swamy_FATHER_SPOUSE_NAME = SwamyFatherName;
                    regis.swamy_GENDER             = SwamyGender;
                    if (!string.IsNullOrEmpty(SwamyDOB))
                    {
                        regis.swamy_DOB = Convert.ToDateTime(SwamyDOB);
                    }
                    regis.swamy_PLACE            = SwamyPlace;
                    regis.swamy_ADDRESS          = SwamyAddress;
                    regis.swamy_MOBILE_NUMBER    = SwamyMobileNumber;
                    regis.swamy_ALTERNATE_MOBILE = SwamyAlternateMobile;
                    regis.swamy_DISTRICT         = SwamyDistrict;
                    regis.swamy_BLOOD_GROUP      = SwamyBloodGroup;
                    regis.swamy_MALAI_VISIT      = SwamyMalaiVisit;
                    if (!string.IsNullOrEmpty(SwamyKanniPoojaiDate))
                    {
                        regis.swamy_KANNI_POOJAI_DATE = Convert.ToDateTime(SwamyKanniPoojaiDate);
                    }
                    //regis.swamy_IS_MEMBER =
                    regis.swamy_MEMBERSHIP_TYPE = SwamyMembership;
                    if (!string.IsNullOrEmpty(SwamyMemebershipExpiry))
                    {
                        regis.swamy_MEMBERSHIP_EXPIRY_DATE = Convert.ToDateTime(SwamyMemebershipExpiry);
                    }

                    db.tab_VA_SWAMY_REGISTRATIONs.InsertOnSubmit(regis);
                    db.SubmitChanges();

                    var SwamyID = Utilities.GetLatestRegisterID();
                    //Save The Photo against the Swamy
                    if (flPhoto.PostedFiles != null)
                    {
                        if (flPhoto.PostedFile.ContentLength > 0)
                        {
                            flPhoto.PostedFile.SaveAs(Server.MapPath("~/management/Resources/temp/" + SwamyID + ".jpg"));
                        }
                    }
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('User Details updated successfully')});", true);
                    ClearFields();
                }
            }
            else
            {
                if (Request.QueryString["sid"] != null)
                {
                    var SwamyID = Convert.ToInt32(Ciphering.Decrypt(Convert.ToString(Request.QueryString["sid"])));

                    using (VallabaiDataContext db = new VallabaiDataContext())
                    {
                        var swamy = from s in db.tab_VA_SWAMY_REGISTRATIONs
                                    where s.swamy_ID == SwamyID
                                    select s;
                        if (swamy.Count() > 0)
                        {
                            foreach (var regis in swamy)
                            {
                                regis.swamy_NAME = SwamyName;
                                regis.swamy_FATHER_SPOUSE_NAME = SwamyFatherName;
                                if (!string.IsNullOrEmpty(SwamyDOB))
                                {
                                    regis.swamy_DOB = Convert.ToDateTime(SwamyDOB);
                                }
                                regis.swamy_MOBILE_NUMBER    = SwamyMobileNumber;
                                regis.swamy_ALTERNATE_MOBILE = SwamyAlternateMobile;
                                regis.swamy_PLACE            = SwamyPlace;
                                regis.swamy_ADDRESS          = SwamyAddress;
                                regis.swamy_DISTRICT         = SwamyDistrict;
                                regis.swamy_BLOOD_GROUP      = SwamyBloodGroup;
                                regis.swamy_MALAI_VISIT      = SwamyMalaiVisit;
                                regis.swamy_MEMBERSHIP_TYPE  = SwamyMembership;
                                if (!string.IsNullOrEmpty(SwamyMemebershipExpiry))
                                {
                                    regis.swamy_MEMBERSHIP_EXPIRY_DATE = Convert.ToDateTime(SwamyMemebershipExpiry);
                                }
                                if (flPhoto.PostedFiles != null)
                                {
                                    if (flPhoto.PostedFile.ContentLength > 0)
                                    {
                                        flPhoto.PostedFile.SaveAs(Server.MapPath("~/management/Resources/temp/" + SwamyID + ".jpg"));
                                    }
                                }

                                db.SubmitChanges();

                                Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "$(function() { funShowMessage('User Details updated successfully')});", true);
                                ClearFields();
                            }
                        }
                    }
                }
            }
        }
    }