public static void loadItems(string proc, ComboBox cb, string dMember, string vMember, string param = null, int val = 0)
 {
     try
     {
         SqlCommand cmd = new SqlCommand(proc, MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         if (param == null && val == 0)
         {
         }
         else
         {
             cmd.Parameters.AddWithValue(param, val);
         }
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable      dt = new DataTable();
         da.Fill(dt);
         cb.DisplayMember = dMember;
         cb.ValueMember   = vMember;
         cb.DataSource    = dt;
     }
     catch (Exception ex)
     {
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
        private void itemCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (itemCB.SelectedIndex != -1)
            {
                try
                {
                    itemCB.BackColor = Color.White;
                    SqlCommand cmd = new SqlCommand("st_getPriceWRTItem", MainClass.con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@mid", Convert.ToInt32(itemCB.SelectedValue.ToString()));
                    MainClass.con.Open();
                    priceTxt.Text = Math.Round(Convert.ToDouble(cmd.ExecuteScalar().ToString()), 0).ToString();

                    MainClass.con.Close();
                    Image i = retrival.getItemImage(Convert.ToInt32(itemCB.SelectedValue.ToString()));
                    pictureBox1.Image    = i;
                    pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                    DataRowView drv = itemCB.SelectedItem as DataRowView;
                    retrival.loadCategoryWRTitem(drv["Menu Item"].ToString());
                }
                catch (Exception ex)
                {
                    MainClass.showMessage(ex.Message, "Error", "Error");
                }
            }
        }
        public void showTables(DataGridView gv, DataGridViewColumn tablenumGV, DataGridViewColumn floornameGV, DataGridViewColumn floorIDGV, DataGridViewColumn tableIDGV, DataGridViewColumn chairsGV)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getTables", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                //dataadaplter class is responsible to excute the query
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                floorIDGV.DataPropertyName   = dt.Columns["Floor ID"].ToString();
                tableIDGV.DataPropertyName   = dt.Columns["Table ID"].ToString();
                chairsGV.DataPropertyName    = dt.Columns["Chairs"].ToString();
                tablenumGV.DataPropertyName  = dt.Columns["Table Number"].ToString();
                floornameGV.DataPropertyName = dt.Columns["Floor"].ToString();



                gv.DataSource = dt;
                MainClass.sno(gv, "srnoGV");
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public void showMenu(DataGridView gv, DataGridViewColumn menuIDGV, DataGridViewColumn menuNameGV, DataGridViewColumn priceGV, DataGridViewColumn status, DataGridViewColumn catIDGV, DataGridViewColumn catNameGV)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getMenu", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                //dataadaplter class is responsible to excute the query
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                menuIDGV.DataPropertyName   = dt.Columns["Menu ID"].ToString();
                menuNameGV.DataPropertyName = dt.Columns["Menu Item"].ToString();
                priceGV.DataPropertyName    = dt.Columns["Price"].ToString();
                status.DataPropertyName     = dt.Columns["Status"].ToString();
                catIDGV.DataPropertyName    = dt.Columns["Category ID"].ToString();
                catNameGV.DataPropertyName  = dt.Columns["Category"].ToString();

                gv.DataSource = dt;

                MainClass.sno(gv, "srnoGV");
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public void showCustomers(DataGridView gv, DataGridViewColumn custIDGV, DataGridViewColumn nameGV, DataGridViewColumn phoneGV, DataGridViewColumn addressGV)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getCustomer", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                //dataadaplter class is responsible to excute the query
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                custIDGV.DataPropertyName  = dt.Columns["ID"].ToString();
                nameGV.DataPropertyName    = dt.Columns["Customers"].ToString();
                phoneGV.DataPropertyName   = dt.Columns["Phone"].ToString();
                addressGV.DataPropertyName = dt.Columns["Address"].ToString();



                gv.DataSource = dt;
                MainClass.sno(gv, "srnoGV");
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public void updateTables(int tableID, int tablenum, Int16 chairs, Int16 floorid)
        {
            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_updateTables", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@tableNumber", tablenum);
                cmd.Parameters.AddWithValue("@chairs", chairs);
                cmd.Parameters.AddWithValue("@floorID", floorid);
                cmd.Parameters.AddWithValue("@tableID", tableID);

                MainClass.con.Open();
                int res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
                if (res > 0)
                {
                    MainClass.showMessage(tablenum + "updated to the system successfully", "Success", "Success");
                }
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public void insertOrder(DateTime date, Int64 custID, Int16 orderType, Int16 floorID, int tableID, float amouPaid, float amouRet, float totAmou, float groosTot, Int16 status, Int16 taxType, float taxAmoun)
        {
            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_insertOrder", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@date", date);
                cmd.Parameters.AddWithValue("@custID", custID);
                cmd.Parameters.AddWithValue("@orderType", orderType);
                cmd.Parameters.AddWithValue("@floorID", floorID);
                cmd.Parameters.AddWithValue("@tableID", tableID);
                cmd.Parameters.AddWithValue("@amountPaid", amouPaid);
                cmd.Parameters.AddWithValue("@amountReturn", amouRet);
                cmd.Parameters.AddWithValue("@totAmount", totAmou);
                cmd.Parameters.AddWithValue("@grossTot", groosTot);
                cmd.Parameters.AddWithValue("@status", status);
                cmd.Parameters.AddWithValue("@taxType", taxType);
                cmd.Parameters.AddWithValue("@taxAmount", taxAmoun);

                MainClass.con.Open();
                int res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
                if (res > 0)
                {
                    MainClass.showMessage("Order Placed to the system successfully", "Success", "Success");
                }
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public static void loadBillReport(ReportDocument rd, CrystalReportViewer crv, Int16 status, Int64 orderid)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getOrderReport", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;


                cmd.Parameters.AddWithValue("@orderID", orderid);
                cmd.Parameters.AddWithValue("@status", status);

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                rd.Load(Application.StartupPath + "\\Reports\\billReport.rpt");
                rd.SetDataSource(dt);
                crv.ReportSource = rd;
                crv.RefreshReport();
            }
            catch (Exception ex)
            {
                if (rd != null)
                {
                    rd.Close();
                }
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public static bool getOrderBill(int tableID, DataGridView gv, DataGridViewColumn orderID, DataGridViewColumn itemGV, DataGridViewColumn quanGV, DataGridViewColumn amounGV, DataGridViewColumn grosstotGV)
        {
            bool check = false;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getOrderDetailWRTTable", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@tableID", tableID);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                orderID.DataPropertyName    = dt.Columns["ID"].ToString();
                itemGV.DataPropertyName     = dt.Columns["Item"].ToString();
                quanGV.DataPropertyName     = dt.Columns["Quantity"].ToString();
                amounGV.DataPropertyName    = dt.Columns["Price"].ToString();
                grosstotGV.DataPropertyName = dt.Columns["Total Amount"].ToString();


                gv.DataSource = dt;
                if (gv.Rows.Count > 0)
                {
                    check = true;
                }
                else
                {
                    check = false;
                }
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(check);
        }
예제 #10
0
 public static void geOrderIDWRTDate(DateTime date, ComboBox cb = null, ListBox lb = null)
 {
     try
     {
         // cb.Items.Clear();
         SqlCommand cmd = new SqlCommand("st_getOrderWRTDate", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@date", date);
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable      dt = new DataTable();
         da.Fill(dt);
         cb.DisplayMember = "ID";
         cb.ValueMember   = "ID";
         if (cb == null)
         {
             lb.DataSource = dt;
         }
         else if (lb == null)
         {
             cb.DataSource = dt;
         }
         cb.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
        private void getOrderDetails(Int64 orderID)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("st_getOrderDetailWRTOrderID", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@orderID", orderID);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);

                ItemIDGV.DataPropertyName       = dt.Columns["Item ID"].ToString();
                ItemGV.DataPropertyName         = dt.Columns["Item"].ToString();
                quanGV.DataPropertyName         = dt.Columns["Quantity"].ToString();
                perItemPriceGV.DataPropertyName = dt.Columns["PUP"].ToString();
                priceGV.DataPropertyName        = dt.Columns["Price"].ToString();
                totGV.DataPropertyName          = dt.Columns["Total Amount"].ToString();
                orderIDGV.DataPropertyName      = dt.Columns["ID"].ToString();
                dataGridView1.DataSource        = dt;
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
        public void deleteData(string procedure, string param, int value = 0, Int64 value2 = 0)
        {
            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand(procedure, MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                if (value != 0)
                {
                    cmd.Parameters.AddWithValue(param, value);
                }
                else if (value2 != 0)
                {
                    cmd.Parameters.AddWithValue(param, value2);
                }


                MainClass.con.Open();
                int res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
                if (res > 0)
                {
                    MainClass.showMessage("data deleted successfully", "Success", "Success");
                }
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
예제 #13
0
        public void updateFloors(Int16 FloorID, string name, Int16 number)
        {
            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_updateFloors", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@floor", name);
                cmd.Parameters.AddWithValue("@floornumber", number);
                cmd.Parameters.AddWithValue("@floorID", FloorID);

                MainClass.con.Open();
                int res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
                if (res > 0)
                {
                    MainClass.showMessage(name + "updated to the system successfully", "Success", "Success");
                }
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
예제 #14
0
 public void updateCustomers(Int64 cid, string name, string phone, string address)
 {
     //it is use to catch logical error
     try
     {
         SqlCommand cmd = new SqlCommand("st_updateCustomer", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@cID", cid);
         cmd.Parameters.AddWithValue("@name", name);
         cmd.Parameters.AddWithValue("@phone", phone);
         cmd.Parameters.AddWithValue("@address", address);
         MainClass.con.Open();
         int res = cmd.ExecuteNonQuery();
         MainClass.con.Close();
         if (res > 0)
         {
             MainClass.showMessage(name + "added to the system successfully", "Success", "Success");
         }
     }
     //exception handlini
     catch (Exception ex)
     {
         MainClass.con.Close();
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
예제 #15
0
        public static int updateOrder(Int64 orderID, float amouPaid, float amouRet, Int16 status, Int16 taxType, float taxAmoun)
        {
            int res = 0;

            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_updateOrder", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@orderID", orderID);
                cmd.Parameters.AddWithValue("@amountPaid", amouPaid);
                cmd.Parameters.AddWithValue("@amountReturn", amouRet);
                cmd.Parameters.AddWithValue("@status", status);
                cmd.Parameters.AddWithValue("@taxType", taxType);
                cmd.Parameters.AddWithValue("@taxAmount", taxAmoun);

                MainClass.con.Open();
                res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(res);
        }
예제 #16
0
        public static void updateTax(Int16 taxID, float taxValue, string TaxType)
        {
            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_updateTax", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@taxID", taxID);
                cmd.Parameters.AddWithValue("@value", taxValue);
                cmd.Parameters.AddWithValue("@type", TaxType);

                MainClass.con.Open();
                int res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
                if (res > 0)
                {
                    MainClass.showMessage(" TAX updated to the system successfully", "Success", "Success");
                }
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
        }
예제 #17
0
 public void updateUsers(int userID, string name, string uname, string phone, string address, string pass, Int16 roleID)
 {
     //it is use to catch logical error
     try
     {
         SqlCommand cmd = new SqlCommand("st_updateUsers", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@name", name);
         cmd.Parameters.AddWithValue("@username", uname);
         cmd.Parameters.AddWithValue("@phone", phone);
         cmd.Parameters.AddWithValue("@address", address);
         cmd.Parameters.AddWithValue("@password", pass);
         cmd.Parameters.AddWithValue("@roleID", roleID);
         cmd.Parameters.AddWithValue("@userID", userID);
         MainClass.con.Open();
         int res = cmd.ExecuteNonQuery();
         MainClass.con.Close();
         if (res > 0)
         {
             MainClass.showMessage(name + "updated to the system successfully", "Success", "Success");
         }
     }
     //exception handlini
     catch (Exception ex)
     {
         MainClass.con.Close();
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
예제 #18
0
        public static Int64 getCustomerWRTphone(string phone)
        {
            Int64 custID = 0;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getCustomerWRTphone", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@phone", phone);
                MainClass.con.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        custID   = Convert.ToInt64(dr["CustomerID"].ToString());
                        Customer = dr["Name"].ToString();
                        Address  = dr["Address"].ToString();
                    }
                }
                else
                {
                    custID   = 0;
                    Customer = "";
                    Address  = "";
                }
                MainClass.con.Close();
            }
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(custID);
        }
예제 #19
0
        public static int updateOrderAmount(Int64 orderID, double Amt)
        {
            int res = 0;

            //it is use to catch logical error
            try
            {
                SqlCommand cmd = new SqlCommand("st_updateOrderAmount", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@orderID", orderID);
                cmd.Parameters.AddWithValue("@amount", Amt);


                MainClass.con.Open();
                res = cmd.ExecuteNonQuery();
                MainClass.con.Close();
            }
            //exception handlini
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(res);
        }
예제 #20
0
 public void updateMenu(int menuID, string menuItem, float price, int catID, Int64 status, Image im)
 {
     //it is use to catch logical error
     try
     {
         MemoryStream ms = new MemoryStream();
         im.Save(ms, ImageFormat.Jpeg);
         byte[]     arr = ms.ToArray();
         SqlCommand cmd = new SqlCommand("st_updateMenu", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@name", menuItem);
         cmd.Parameters.AddWithValue("@price", price);
         cmd.Parameters.AddWithValue("@catID", catID);
         cmd.Parameters.AddWithValue("@status", status);
         cmd.Parameters.AddWithValue("@mid", menuID);
         cmd.Parameters.AddWithValue("@image", arr);
         MainClass.con.Open();
         int res = cmd.ExecuteNonQuery();
         MainClass.con.Close();
         if (res > 0)
         {
             MainClass.showMessage(menuItem + "updated to the system successfully", "Success", "Success");
         }
     }
     //exception handlini
     catch (Exception ex)
     {
         MainClass.con.Close();
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
예제 #21
0
        public static bool checkTableStatus(int tableID, Int64 floorID)
        {
            bool stats = false;

            try
            {
                SqlCommand cmd = new SqlCommand("st_checkTableBusyFree", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@tableID", tableID);
                cmd.Parameters.AddWithValue("@floorID", floorID);
                MainClass.con.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    stats = true;
                }
                else
                {
                    stats = false;
                }
                MainClass.con.Close();
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(stats);
        }
예제 #22
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (rolesTxt.Text =="") { rolesErrorlabel.Visible = true; } else { rolesErrorlabel.Visible = false; }
            if(rolesErrorlabel.Visible)
            {
                MainClass.showMessage("feilds * are mandotory","Error","Error");
            }
            else
            {
                if(edit ==0)//for save operation
                {
                    i.insertRoles(rolesTxt.Text);
                    MainClass.disable_reset(leftpanel);
                    r.showRoles(dataGridView1, rolesIDGV, rolesGV);

                }
                else if(edit==1)//for update operation
                {
                    u.updateRoles(rolesTxt.Text,roleID);
                    MainClass.disable_reset(leftpanel);
                    r.showRoles(dataGridView1, rolesIDGV, rolesGV);

                }
            }
        }
예제 #23
0
        public static void insertOrderDetails(Int64 orderID, DataGridView gv)
        {
            int count = 0;

            foreach (DataGridViewRow row in gv.Rows)
            {
                count += insertions.insertOrderDetails(orderID, Convert.ToInt32(row.Cells["ItemIDGV"].Value.ToString()), Convert.ToInt16(row.Cells["quanGV"].Value.ToString()));
            }
            if (count > 0)
            {
                MainClass.showMessage("order updated Placed", "Success", "Success");
            }
            else
            {
                MainClass.showMessage("order not Placed", "Error", "Error");
            }
        }
예제 #24
0
 private void phoneTxt_Leave(object sender, EventArgs e)
 {
     if (phoneTxt.Text != "")
     {
         phoneTxt.BackColor = Color.White;
         custID             = retrival.getCustomerWRTphone(phoneTxt.Text);
         if (custID == 0)
         {
             Customers cw = new Customers();
             MainClass.showWindow(cw, this, MDI.ActiveForm);
         }
         else
         {
             MainClass.showMessage(retrival.Customer + "\n" + retrival.Address + "\n", "Success", "Success");
         }
     }
 }
예제 #25
0
 public static void getPendingOrder(DataGridView gv, DataGridViewColumn orderIDGV, DataGridViewColumn status)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("st_getOrderForChef", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable      dt = new DataTable();
         da.Fill(dt);
         orderIDGV.DataPropertyName = dt.Columns["Order ID"].ToString();
         status.DataPropertyName    = dt.Columns["Status"].ToString();
         gv.DataSource = dt;
     }
     catch (Exception ex)
     {
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
예제 #26
0
        public static bool getUserDetails(string user, string pass)
        {
            bool status = false;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getUsersDetails", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@user", user);
                cmd.Parameters.AddWithValue("@pass", pass);
                MainClass.con.Open();
                //sql dataAdapter is a two way stream data mugwa bi sakte hai or data dalwa bi sakte hai
                //sql dataReader se sirf data magwate hai
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        if (user == dr["UserName"].ToString() && pass == dr["Password"].ToString())
                        {
                            USER   = dr["User"].ToString();
                            ROLE   = dr["Role"].ToString();
                            status = true;
                        }
                        else
                        {
                            MainClass.showMessage("invalid username or password", "Error", "Error");
                            status = false;
                        }
                    }
                }
                else
                {
                    MainClass.showMessage("invalid username or password", "Error", "Error");
                    status = false;
                }
                MainClass.con.Close();
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(status);
        }
예제 #27
0
        public static Int64 loadLastOrderID()
        {
            Int64 orderID = 0;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getLastOrderID", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                MainClass.con.Open();
                orderID = Convert.ToInt64(cmd.ExecuteScalar().ToString());

                MainClass.con.Close();
            }
            catch (Exception ex)
            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(orderID);
        }
예제 #28
0
 public static void getPendingOrderDetails(Int64 orderID, DataGridView gv, DataGridViewColumn proGV, DataGridViewColumn quanGV)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("st_getOrderDetailForChef", MainClass.con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@orderID", orderID);
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable      dt = new DataTable();
         da.Fill(dt);
         proGV.DataPropertyName  = dt.Columns["Item"].ToString();
         quanGV.DataPropertyName = dt.Columns["Quantity"].ToString();
         gv.DataSource           = dt;
     }
     catch (Exception ex)
     {
         MainClass.showMessage(ex.Message, "Error", "Error");
     }
 }
        private double orderAmount(Int64 orderID)
        {
            double om = 0;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getAmountWRTOrderID", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@orderID", orderID);
                MainClass.con.Open();
                om = Convert.ToDouble(cmd.ExecuteScalar().ToString());
                MainClass.con.Close();
            }
            catch (Exception ex)

            {
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(om);
        }
예제 #30
0
        public static Int16 getTaxID(string taxtype)
        {
            Int16 id = 0;

            try
            {
                SqlCommand cmd = new SqlCommand("st_getTaxID", MainClass.con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@taxtype", taxtype);
                MainClass.con.Open();
                id = Convert.ToInt16(cmd.ExecuteScalar().ToString());
                MainClass.con.Close();
            }
            catch (Exception ex)
            {
                MainClass.con.Close();
                MainClass.showMessage(ex.Message, "Error", "Error");
            }
            return(id);
        }