コード例 #1
0
    protected void GetPopulate(string GID_)
    {
        var obj_ = new simsdb();
        var row_ = new GuestStudentRow();

        try
        {
            row_ = obj_.GuestStudentCollection.GetRow("GuestID='" + GID_ + "'");
            string str_ = row_.GuestID.ToString();
            this.txtFormNo.Text      = str_;
            cmbSession.SelectedValue = row_.SessionID;
            txtStudentNme.Text       = row_.StudentName.ToString();
            txtFathername.Text       = row_.FatherName.ToString();
            txtMobileNo.Text         = row_.MobileNo.ToString();
        }

        catch (Exception ex)
        {
            string msgs = ex.Message.ToString();
        }
        finally
        {
            obj_.Dispose();
        }
    }
コード例 #2
0
    private Int32 GetID()
    {
        var row_ = new GuestStudentRow();
        var obj_ = new simsdb();

        row_ = obj_.GuestStudentCollection.GetRow("GuestID IN (SELECT TOP 1 GuestID FROM GuestStudent ORDER BY GuestID DESC)");
        string retStr = row_.GuestID.ToString();
        var    result = retStr.Substring(retStr.LastIndexOf('-') + 1);

        int incr = Convert.ToInt32(result) + 1;

        return(incr);
    }
コード例 #3
0
    //public static int CalculateAge(DateTime birthDate)
    //{
    //    DateTime now = DateTime.Today;
    //    int years = now.Year - birthDate.Year;

    //    if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day))
    //        --years;
    //    return years;
    //}
    protected void UpdateGuest(string _GuestID, string fval)
    {
        using (var obj = new simsdb())
        {
            var rowUp_ = new GuestStudentRow();
            var row_   = new GuestStudentRow();
            row_ = obj.GuestStudentCollection.GetRow("GuestID='" + _GuestID + "'");
            string   SessionID_    = row_.SessionID;
            string   ProgramSought = row_.ProgramSought;
            Int32    Class         = row_.Class;
            string   StudentName   = row_.StudentName;
            string   FatherName    = row_.FatherName;
            string   MobileNo      = row_.MobileNo;
            string   LastSchool    = row_.LastSchool;
            string   Gender        = row_.Gender;
            string   Address       = row_.Address;
            DateTime DateCreated   = row_.DateCreated;
            string   CreatedBy     = row_.CreatedBy;
            int      Flag          = Convert.ToInt32(fval);
            //wrap in another row object
            rowUp_.GuestID       = _GuestID;
            rowUp_.SessionID     = SessionID_;
            rowUp_.ProgramSought = ProgramSought;
            rowUp_.Class         = Class;
            rowUp_.StudentName   = StudentName;
            rowUp_.FatherName    = FatherName;
            rowUp_.MobileNo      = MobileNo;
            rowUp_.LastSchool    = LastSchool;
            rowUp_.Gender        = Gender;
            rowUp_.Address       = Address;
            rowUp_.DateCreated   = DateCreated;
            rowUp_.CreatedBy     = CreatedBy;
            rowUp_.Flag          = Flag;
            obj.GuestStudentCollection.Update(rowUp_);
            obj.Dispose();
        }
    }
コード例 #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblMessage.Text = "";
        var obj_ = new simsdb();
        var row_ = new GuestStudentRow();


        try
        {
            string GuestID_ = this.txtFormNo.Text;
            row_.GuestID       = GuestID_.ToString();
            row_.SessionID     = this.cmbSession.SelectedItem.Text.ToString();
            row_.ProgramSought = this.cmbProgram.SelectedItem.Text.ToString();
            row_.Class         = Convert.ToInt32(cmbClass.SelectedValue);
            row_.StudentName   = this.txtStudentNme.Text.ToString();
            row_.FatherName    = this.txtFathername.Text.ToString();
            row_.MobileNo      = this.txtMobileNo.Text;
            row_.LastSchool    = this.cmbSchoolLast.SelectedItem.Text.ToString();
            row_.Gender        = this.cmbGender.SelectedItem.Text.ToString();
            row_.Address       = this.txtaddress.Text;
            row_.DateCreated   = System.DateTime.Now;
            row_.CreatedBy     = "ZAHEER";
            row_.Flag          = Convert.ToInt32(this.cmbFlag.SelectedValue);
            obj_.GuestStudentCollection.Insert(row_);
            lblMessage.Text = "Record Inserted!";
            showGrid();
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message.ToString();
        }
        finally
        {
            obj_.Dispose();
        }
    }