コード例 #1
0
        // add student
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            string _DataFields = "FirstName,LastName,Contact,Email,RegistrationNumber,Status";
            string _Values     = "'" + txtfname.Text.Trim().Replace("'", "''") + "','" + txtlname.Text.Trim().Replace("'", "''") + "','" + txtcon.Text.Trim().Replace("'", "''") + "','" + txtemail.Text.Trim().Replace("'", "''") + "','" + txtRegNo.Text.Trim().Replace("'", "''") + "','" + cmbStatus.SelectedValue + "'";
            string Result      = ajdbClass.InsertIntoDatabase("Student", _DataFields, _Values);
            string qry         = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " +
                                 " FROM  Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId ";

            ajdbClass.popGrid(gvStudents, qry); txtRubricSetDetails.Text = ""; txtRubricSetLevel.Text = "";
            MessageBox.Show(Result);
            txtfname.Text = ""; txtlname.Text = ""; txtRegNo.Text = ""; txtemail.Text = ""; txtcon.Text = "";
        }
コード例 #2
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            AJ_DataClass ajdbClass = new AJ_DataClass();
            string       _catgory  = cboCatgory.SelectedValue;
            string       _name     = txtname.Text;
            string       _price    = txtPrice.Text;
            string       _quantity = txtQty.Text;


            if (fuImageFile.HasFile)
            {
                string picture = fuImageFile.FileName.ToString();
                fuImageFile.PostedFile.SaveAs(Server.MapPath("upload/") + picture);



                string _DataFields = "ICategoryID ,ItName  ,ItPrice ,ItPicture,ItQuantity";
                string _Values     = "'" + _catgory + "','" + _name + "','"
                                     + _price + "','" + picture + "','"
                                     + _quantity + "'";

                string Result = ajdbClass.InsertIntoDatabase("Items", _DataFields, _Values);
                Label1.Visible = true;
                Label1.Text    = "Items inserted successfully";
                txtname.Text   = "";
            }
            else
            {
                Label1.Visible = true;
                Label1.Text    = "Plz upload the image!!!!";
            }
        }
コード例 #3
0
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            if (Session["CurrentUser_ID"] != null)
            {
                _id = Session["CurrentUser_ID"].ToString();
                AJ_DataClass ajdbClass = new AJ_DataClass();

                string _name     = txtname.Text;
                string _price    = txtPrice.Text;
                string _quantity = txtQty.Text;

                string _DataFields = "PrAdminId,PrName,PrPrice ,PrQty";
                string _Values     = "'" + _id + "','" + _name + "','" + _price + "','" + _quantity + "'";



                string Result = ajdbClass.InsertIntoDatabase("Purchase", _DataFields, _Values);
                lblmsg.Text = Result;
                if (Result == "Record(s) Added Successfully")
                {
                    txtname.Text  = "";
                    txtPrice.Text = "";
                    txtQty.Text   = "";
                }
            }
        }
コード例 #4
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            AJ_DataClass ajdbClass = new AJ_DataClass();

            string _name    = txtName.Text;
            string _email   = txtEmail.Text;
            string _contact = txtcontact.Text;
            string _addr    = txtaddr.Text;
            string _utype   = cboUtype.SelectedItem.ToString();
            string _pwd     = txtPwd.Text;

            // Check if user already have an account. *email
            int trec = ajdbClass.TRec("select * from [User] where UEmail='" + txtEmail.Text.Trim() + "'");

            if (trec != 0)
            {
                lblmsg.Text = " Email already exists !"; txtEmail.Focus(); return;
            }
            else
            {
                lblmsg.Text = "";
            }

            if (txtPwd.Text.Trim() != txtPwd2.Text.Trim())
            {
                lblmsg.Text = "Password MissMatched !"; txtPwd2.Focus(); return;
            }
            else
            {
                lblmsg.Text = "";
            }
            string _DataFields = "UName,UAddress,UCellNo,UEmail, Utype,UPwd";
            string _Values     = "'" + _name + "','"
                                 + _addr + "','" + _contact + "','"

                                 + _email + "','" + _utype + "','" + _pwd + "'";



            string Result = ajdbClass.InsertIntoDatabase("[User]", _DataFields, _Values);

            lblmsg.Text = Result;
            if (Result == "Record(s) Added Successfully")
            {
                txtName.Text    = "";
                txtEmail.Text   = "";
                txtcontact.Text = "";
                txtaddr.Text    = "";
                txtPwd.Text     = "";
            }
        }
コード例 #5
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        AJ_DataClass ajdbClass = new AJ_DataClass();

        // check if request is already has been sent to donor by this user
        string qryCheck = "select * from tblRequestForBlood where tAcceptor_id ='" + _UserID + "' and tDonor_id='" + hfdnrid.Value + "' and tRejected ='false'";
        int    trec     = ajdbClass.TRec(qryCheck);

        if (trec != 0)
        {
            lblmsg.Text = "You already have sent a request for this donor."; return;
        }
        else
        {
            lblmsg.Text = "";
        }

        string _DataFields = "tAcceptor_id,tDonor_id,tBloodGroup_id,tRequestDate ";
        string _Values     = "'" + _UserID + "','" + hfdnrid.Value + "','" + cbodBGroup.SelectedValue + "','" + DateTime.Now.ToShortDateString() + "'";
        string Result      = ajdbClass.InsertIntoDatabase("tblRequestForBlood", _DataFields, _Values);

        lblmsg.Text = Result + " Your request has been sent ";
    }
コード例 #6
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        AJ_DataClass ajdbClass = new AJ_DataClass();
        string       _name     = txtName.Text;
        string       _bgid     = cboBGroup.SelectedValue;
        string       _email    = txtEmail.Text;
        string       _ctid     = cboCities.SelectedValue;
        string       _gender   = cboGender.SelectedValue;
        string       _contact  = txtcontact.Text;
        string       _addr     = txtaddr.Text;
        string       _pwd      = txtPwd.Text;

        string _isAcceptor = "false";
        string _isDonor    = "false";

        if (chkAcceptor.Checked == true)
        {
            _isAcceptor = "True";
        }
        if (chkDonor.Checked == true)
        {
            _isDonor = "True";
        }



        string _DataFields = "rname,rbl_id,risAcceptor," +
                             "risdonor,remail,rct_id,rgender,rcontact," +
                             "raddress,rpassword,rDate";
        string _Values = "'" + _name + "','" + _bgid + "','" + _isAcceptor + "','"
                         + _isDonor + "','" + _ctid + "','" + _gender + "','" + _contact + "','"
                         + _addr + "','" + _pwd + "','" + DateTime.Now.ToShortDateString() + "'";
        string Result = ajdbClass.InsertIntoDatabase("tblRegister", _DataFields, _Values);

        lblmsg.Text = Result;
    }
コード例 #7
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        AJ_DataClass ajdbClass = new AJ_DataClass();

        string _name    = txtName.Text;
        string _bgid    = cboBGroup.SelectedValue;
        string _email   = txtEmail.Text;
        string _ctid    = cboCities.SelectedValue;
        string _gender  = cboGender.SelectedValue;
        string _contact = txtcontact.Text;
        string _addr    = txtaddr.Text;
        string _pwd     = txtPwd.Text;

        string _isAcceptor = "false";
        string _isDonor    = "false";

        if (chkAcceptor.Checked == true)
        {
            _isAcceptor = "True";
        }
        if (chkDonor.Checked == true)
        {
            _isDonor = "True";
        }

        // Check if user alread have an account. *email
        int trec = ajdbClass.TRec("select * from tblRegister where Remail='" + txtEmail.Text.Trim() + "'");

        if (trec != 0)
        {
            lblmsg.Text = "User's Email already exists !"; txtEmail.Focus(); return;
        }
        else
        {
            lblmsg.Text = "";
        }

        if (txtPwd.Text.Trim() != txtPwd2.Text.Trim())
        {
            lblmsg.Text = "Password MissMatched !"; txtPwd2.Focus(); return;
        }
        else
        {
            lblmsg.Text = "";
        }


        string _DataFields = "rname,rbl_id,risAcceptor," +
                             "risdonor,remail,rct_id,rgender,rcontact," +
                             "raddress,rpassword,rDate";
        string _Values = "'" + _name + "','" + _bgid + "','" + _isAcceptor + "','"

                         + _isDonor + "','" + _email + "','" + _ctid + "','" + _gender + "','" + _contact + "','"

                         + _addr + "','" + _pwd + "','" + DateTime.Now.ToShortDateString() + "'";



        string Result = ajdbClass.InsertIntoDatabase("tblRegister", _DataFields, _Values);

        lblmsg.Text = Result;
        if (Result == "Record(s) Added Succfully")
        {
            txtName.Text        = "";
            txtEmail.Text       = "";
            txtcontact.Text     = "";
            txtaddr.Text        = "";
            txtPwd.Text         = "";
            chkAcceptor.Checked = false;
            chkDonor.Checked    = false;
        }
    }
コード例 #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //AJ_DataClass ajdbClass = new AJ_DataClass();
            //bool chef = false;
            //bool delivr = false;
            //string delivrtime = DateTime.Now.ToShortDateString() ;
            //bool payRec = false;
            //string _DataFields = "OdUserId,OdDate,OdGtotal ,OdFwdFoodCheff,OdDelivered ,OdDeliveredTime  ,OdPaymentRecieved";
            //string _Values = "'" + _UserID + "','" + DateTime.Now.ToShortDateString() + "','" + lblgtotal.Text + "','" +
            //    chef + "','" + delivr+ "','" + delivrtime + "','" + payRec  +       "'";
            //string Result = ajdbClass.InsertIntoDatabase("[Order]", _DataFields, _Values);

            ////"OddOdid" = "OdId";
            ////string _itid = "Items.ItId";
            ////string _price = "itprice";
            ////string _quantity = "itqty";
            ////string _total = "ittotal";

            ////string _DataField1 = "[OddOdid] ,[Odditid] ,[OddPrice] ,[OddQuantity],[OddTotal]";
            ////string _Values1 = "'" + _odid + "','" + _itid + "','" + _price + "','" +
            //// _quantity + "','" + _total  + "'";
            ////string Result1 = ajdbClass.InsertIntoDatabase("[OrderDetails]", _DataField1, _Values1);

            //lblmsg.Text = Result + " Your order has been sent ";

            AJ_DataClass ajdbClass = new AJ_DataClass();
            DataTable    dtMyTable_Adr;

            if (Session["sesOrderTable"] != null)
            {
                dtMyTable_Adr = (DataTable)Session["sesOrderTable"];
            }
            else
            {
                return;
            }


            foreach (DataRow dr in dtMyTable_Adr.Rows)
            {
                if (dr["itqty"].ToString().Trim() != "0")
                {
                    string _DataFields = "OAdminId,OdUserId,OdDate ,OdGtotal,OdFwdFoodCheff ,OdDelivered  ,OdDeliveredTime,OdPaymentRecieved ";
                    string _Values     = "'1','1','" + DateTime.Now.ToShortDateString() + "','" + lblgtotal.Text + "','0','0','" + DateTime.Now.ToShortDateString() + "','0' ";
                    string Result      = ajdbClass.InsertIntoDatabase("[Order]", _DataFields, _Values);
                    lblmsg.Text = Result + " Order has been sent ";
                }
                break;
            }

            string  _lastid = "0";
            DataSet ds      = new DataSet();

            ds = ajdbClass.GetRecords("tbl", "select odid from [Order] ");
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                _lastid = dr["odid"].ToString().Trim();
            }


            foreach (DataRow dr in dtMyTable_Adr.Rows)
            {
                if (dr["itqty"].ToString().Trim() != "0")
                {
                    string st          = dr["itid"].ToString().Trim();
                    string _DataFields = "OddOdid,Odditid,OddPrice ,OddQuantity,OddTotal ";
                    string _Values     = "'" + _lastid + "','" + dr["itid"].ToString().Trim() + "','" + dr["itprice"].ToString().Trim() + "','" + dr["itqty"].ToString().Trim() + "','" + lblgtotal.Text.Trim() + "' ";

                    string Result = ajdbClass.InsertIntoDatabase("OrderDetails", _DataFields, _Values);
                    lblmsg.Text = Result + " Order has been sent ";
                }
            }

            Session["sesOrderTable"] = null;
            Session["sestitmes"]     = null;
            Session["sesgtotal"]     = null;
            //   Response.Redirect("FoodMenuMyOrder.aspx");
        }