Пример #1
0
        private List <string> Get_Lic_Data()
        {
            List <string> retData = new List <string>();

            try
            {
                string           Prc_id    = GetProc_Id();
                string           HDD_id    = GetHardDiskSerialNo();
                string           OS_id     = GetOSSerialNo();
                string           Comp_data = "";
                Database.ConnStr db        = new Database.ConnStr();
                DataTable        dtbl      = db.GetCompInfo();
                if (dtbl.Rows.Count > 0)
                {
                    retData.Add(dtbl.Rows[0]["ID"].ToString());
                    retData.Add(dtbl.Rows[0]["Client_Name"].ToString());
                    retData.Add(dtbl.Rows[0]["Client_Place"].ToString());
                    retData.Add(dtbl.Rows[0]["Mobile_No"].ToString());
                    retData.Add(dtbl.Rows[0]["Lic_info"].ToString());
                    retData.Add(dtbl.Rows[0]["Lic_Status"].ToString());
                    Comp_data = dtbl.Rows[0]["Client_Name"].ToString() + dtbl.Rows[0]["Mobile_No"].ToString();
                }

                retData.Add(Prc_id + HDD_id + OS_id + Comp_data);
            }
            catch
            {
            }
            return(retData);
        }
Пример #2
0
        private void Save()
        {
            try
            {
                decimal enterpoint = decimal.Parse(txtPoints.Text.Trim());
                if (intType > 0)
                {
                    if (enterpoint > availpoint)
                    {
                        MessageBox.Show("Availalble Point is " + availpoint + " only" + Environment.NewLine
                                        + "This customer can not redeem " + enterpoint + " Points");
                        txtPoints.Focus();
                        return;
                    }
                }
                Database.ConnStr obj = new Database.ConnStr();

                string sql = "call SP_SavePoint('" + dtpDate.Value.ToString("yyyy-MM-dd")
                             + "','" + txtBarcode.Tag.ToString()
                             + "','" + txtPoints.Text.Trim()
                             + "','" + intType
                             + "')";

                obj.RunQuery(sql);
                MessageBox.Show("Record Saved!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshGrid();
                ClearText();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void radioButton_Click(object sender, EventArgs e)
        {
            RadioButton rb      = (RadioButton)sender;
            string      sql     = "";
            int         Cust_Id = (cmbCustomer.SelectedValue != null) ? int.Parse(cmbCustomer.SelectedValue.ToString()) : 0;

            if (rb.Checked)
            {
                if (rb.Name == "RB1")
                {
                    sql = string.Format("Call SP_Report_Details(0,'" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + dateTimePicker2.Value.ToString("yyyy-MM-dd") + "');", "");
                }
                else if (rb.Name == "RB2")
                {
                    sql = string.Format("Call SP_Report_Details(" + Cust_Id + ",'" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + dateTimePicker2.Value.ToString("yyyy-MM-dd") + "');", "");
                }
                else if (rb.Name == "RB3")
                {
                    sql = string.Format("Call SP_Report_Summary(0,'" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + dateTimePicker2.Value.ToString("yyyy-MM-dd") + "');", "");
                }
                else if (rb.Name == "RB4")
                {
                    sql = string.Format("Call SP_Report_Summary(" + Cust_Id + ",'" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + dateTimePicker2.Value.ToString("yyyy-MM-dd") + "');", "");
                }
                else if (rb.Name == "RB5")
                {
                    sql = string.Format("Call SP_Report_PendingPoints();", "");
                }

                Database.ConnStr obj = new Database.ConnStr();
                DataTable        dt  = new DataTable();
                dt = obj.GetRecords(sql);
                dgvReprt.DataSource = dt;
            }
        }
Пример #4
0
 private void LoadWidgetData()
 {
     try
     {
         Database.ConnStr obj = new Database.ConnStr();
         string           sql;
         DataTable        dt = new DataTable();
         sql = string.Format("SELECT FORMAT(CustTotal,0) AS CustTotal," +
                             " FORMAT(EarndPoint,0) AS EarndPoint," +
                             " FORMAT(RedPoint, 0) AS RedPoint, " +
                             " FORMAT(EarndPoint-RedPoint,0) AS AvailPoint FROM ( SELECT " +
                             " (SELECT Count(*)  FROM tbl_customers) as CustTotal, " +
                             " (SELECT SUM(Point)   FROM tbl_point_add) as EarndPoint," +
                             " (SELECT SUM(Point)   FROM tbl_point_redeem) as RedPoint)t; ", "");
         dt = obj.GetRecords(sql);
         if (dt.Rows.Count > 0)
         {
             lblCountCust.Text        = dt.Rows[0]["CustTotal"].ToString();
             lblCountAvailPoint.Text  = dt.Rows[0]["AvailPoint"].ToString();
             lblCountEarnedPoint.Text = dt.Rows[0]["EarndPoint"].ToString();
             lblCountRedPoint.Text    = dt.Rows[0]["RedPoint"].ToString();
         }
     }
     catch
     {
     }
 }
Пример #5
0
        private void Save()
        {
            try
            {
                if (IsExistBarcode(txtBarcode.Text.Trim()))
                {
                    MessageBox.Show("This Barcode already used!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtBarcode.Focus();
                }
                else
                {
                    Database.ConnStr obj = new Database.ConnStr();

                    string sql = "Insert into tbl_customers(Barcode, Cust_name, Place, Mobile, email) values('"
                                 + txtBarcode.Text.Trim() + "','" + txtname.Text.Trim() + "','" + txtplace.Text.Trim() + "','"
                                 + txtmobile.Text.Trim() + "','" + txtemail.Text.Trim() + "')";

                    obj.RunQuery(sql);
                    MessageBox.Show("Record Saved!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshGrid();
                    ClearText();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #6
0
        private void RefreshGrid()
        {
            Database.ConnStr obj = new Database.ConnStr();
            string           sql;
            DataTable        dt = new DataTable();

            sql = string.Format("Call SP_ViewCustomerPointAlltrabs(" + intType + ")", "");
            dt  = obj.GetRecords(sql);
            dgvPointadded.DataSource = dt;

            txtBarcode.Focus();
        }
Пример #7
0
        private void FillCustomers()
        {
            Database.ConnStr obj = new Database.ConnStr();
            string           sql;
            DataTable        dt = new DataTable();

            sql = string.Format("SELECT ID,concat(Barcode,'-',Cust_name) as Cname FROM smartl.tbl_customers;", "");
            dt  = obj.GetRecords(sql);
            cmbCustomer.ValueMember   = "ID";
            cmbCustomer.DisplayMember = "Cname";
            cmbCustomer.DataSource    = dt;
        }
Пример #8
0
        private void RefreshGrid()
        {
            Database.ConnStr obj = new Database.ConnStr();
            string           sql;
            DataTable        dt = new DataTable();

            sql = string.Format("Select * from tbl_customers", "");
            dt  = obj.GetRecords(sql);
            dgvCust.DataSource = dt;

            txtBarcode.Focus();
        }
Пример #9
0
        private bool IsExistBarcode(string strBarcode)
        {
            bool sts = false;

            try
            {
                Database.ConnStr obj = new Database.ConnStr();
                string           sql;
                DataTable        dt = new DataTable();
                sql = string.Format("Call SP_ViewDdetByBarcode(" + strBarcode + ")", "");
                dt  = obj.GetRecords(sql);
                sts = (dt.Rows.Count > 0);
            }
            catch
            {
            }
            return(sts);
        }
Пример #10
0
        private int Customer_detbyBarcode(string strBarcode)
        {
            int Cust_Id = 0;

            try
            {
                Database.ConnStr obj = new Database.ConnStr();
                string           sql;
                DataTable        dt = new DataTable();
                sql = string.Format("Call SP_ViewDdetByBarcode(" + strBarcode + ")", "");
                dt  = obj.GetRecords(sql);

                if (dt.Rows.Count > 0)
                {
                    Cust_Id = int.Parse(dt.Rows[0]["ID"].ToString());
                    string custde = "";

                    custde += String.Format("{0}\t{1}", "Name                        :", dt.Rows[0]["Cust_name"].ToString()) + Environment.NewLine;
                    custde += String.Format("{0}\t{1}", "Mobile                      :", dt.Rows[0]["Mobile"].ToString()) + Environment.NewLine;
                    custde += String.Format("{0}\t{1}", "Place                        :", dt.Rows[0]["Place"].ToString()) + Environment.NewLine;

                    sql = string.Format("Call SP_ViewAddRedTotalPoints(" + Cust_Id + ")", "");
                    dt  = obj.GetRecords(sql);
                    if (dt.Rows.Count > 0)
                    {
                        decimal ep = 0;
                        decimal.TryParse(dt.Rows[0]["EarnedPoint"].ToString(), out ep);
                        decimal rp = 0;
                        decimal.TryParse(dt.Rows[0]["RedeemedPoint"].ToString(), out rp);
                        availpoint = ep - rp;

                        custde += String.Format("{0}\t{1}", "Earned Points           :", ep) + Environment.NewLine;
                        custde += String.Format("{0}\t{1}", "Redeemed Points      :", rp) + Environment.NewLine;
                        custde += String.Format("{0}\t{1}", "Available Points        :", availpoint) + Environment.NewLine;
                    }
                    lblCustdet.Text = custde;
                }
            }
            catch
            {
            }
            return(Cust_Id);
        }
Пример #11
0
 private void Delete(int ID)
 {
     try
     {
         Database.ConnStr obj = new Database.ConnStr();
         DialogResult     dlk = MessageBox.Show("Do you want to delete the customer?", "Smart Loyalty", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dlk == DialogResult.Yes)
         {
             string sql = "DELETE FROM tbl_customers WHERE ID = '" + ID + "'";
             obj.RunQuery(sql);
             MessageBox.Show("Record Deleted!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
             RefreshGrid();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error : " + ex.Message, "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #12
0
        private int CheckUserLogin(string GivUid, string GivPswd)
        {
            Database.ConnStr obj = new Database.ConnStr();
            string           sql;
            int       ActUid = 0;
            DataTable dt     = new DataTable();

            sql = string.Format("SELECT * FROM tbl_users;", "");
            dt  = obj.GetRecords(sql);
            List <string> users     = new List <string>();
            List <string> passwords = new List <string>();
            List <int>    ids       = new List <int>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string tempUser, tempPassword;
                int    tmpID;
                tmpID        = int.Parse(dt.Rows[i]["ID"].ToString());
                tempUser     = dt.Rows[i]["Username"].ToString();
                tempPassword = dt.Rows[i]["Password"].ToString();
                ids.Add(tmpID);
                users.Add(tempUser);
                passwords.Add(tempPassword);
            }

            for (int x = 0; x < users.Count; x++)
            {
                if (users[x] == GivUid && passwords[x] == GivPswd)
                {
                    ActUid            = ids[x];
                    Database.Username = users[x];
                }
            }

            if (ActUid < 1)
            {
                MessageBox.Show("Incorrect Username or Password!", "Samrt Loylty", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(ActUid);
        }
Пример #13
0
        private void Edit()
        {
            try
            {
                Database.ConnStr obj = new Database.ConnStr();

                string sql = "call SP_EditPoint(" + CurrID + ",'" + dtpDate.Value.ToString("yyyy-MM-dd")
                             + "','" + txtBarcode.Tag.ToString()
                             + "','" + txtPoints.Text.Trim()
                             + "','" + intType
                             + "')";

                obj.RunQuery(sql);
                MessageBox.Show("Record Updated!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #14
0
        private void Edit()
        {
            try
            {
                Database.ConnStr obj = new Database.ConnStr();

                string sql = "UPDATE tbl_customers SET "
                             + " Barcode = '" + txtBarcode.Text
                             + "', Cust_name = '" + txtname.Text
                             + "', Place = '" + txtplace.Text
                             + "', Mobile = '" + txtmobile.Text
                             + "', email = '" + txtmobile.Text
                             + "' WHERE ID = '" + CurrID + "'";

                obj.RunQuery(sql);
                MessageBox.Show("Record Updated!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshGrid();
                ClearText();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }