コード例 #1
0
        public void Save(bool modifyPurchases = false)
        {
            dbConnect dbCon     = new dbConnect();
            Int32     receiptid = this.ORNumber;

            if (dbCon.CreateReceipt(ref receiptid, this.CashierName, this.TotalAmountDue, this.CashTendered, this.SeniorDiscount, this.ItemDiscount, this.Accountid, this.TransDate) == false)
            {
                return;
            }
            if (this.ORNumber != receiptid || this.ORNumber == receiptid && modifyPurchases)
            {
                this.ORNumber = receiptid;

                dbCon.RemoveFromHistory(this._ORNumber);
                foreach (KeyValuePair <string, clsPurchasedItem> purchaseditem in _lstPurchasedItems)
                {
                    if (purchaseditem.Value.Qty > 0)
                    {
                        purchaseditem.Value.ORNumber = this.ORNumber;
                        if (dbCon.AddTransaction(purchaseditem.Value))
                        {
                            clsProductItem prod = clsProductItem.SearchProduct(purchaseditem.Value.BarCode);
                            prod.QtySold += purchaseditem.Value.Qty;
                            prod.Save();
                        }
                    }
                }
            }
            this.ORNumber = receiptid;

            dbCon.Close();
        }
コード例 #2
0
        public void SaveTemp(string CustomerName, bool modifyPurchases = false)
        {
            dbConnect dbCon     = new dbConnect();
            Int32     receiptid = this.ORNumber;

            if (dbCon.CreateTempReceipt(ref receiptid, CustomerName, this.TotalAmountDue, this.CashTendered, this.SeniorDiscount, this.ItemDiscount, this.Accountid) == false)
            {
                return;
            }
            if (this.ORNumber != receiptid || this.ORNumber == receiptid && modifyPurchases)
            {
                this.ORNumber = receiptid;

                dbCon.RemoveFromTempHistory(this._ORNumber);
                foreach (KeyValuePair <string, clsPurchasedItem> purchaseditem in _lstPurchasedItems)
                {
                    if (purchaseditem.Value.Qty > 0)
                    {
                        purchaseditem.Value.ORNumber = this.ORNumber;
                        dbCon.AddTempTransaction(purchaseditem.Value);
                    }
                }
            }
            dbCon.Close();
        }
コード例 #3
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            string limit = req.GetQueryNameValuePairs()
                           .FirstOrDefault(q => string.Compare(q.Key, "limit", true) == 0)
                           .Value;
            string action = req.GetQueryNameValuePairs()
                            .FirstOrDefault(q => string.Compare(q.Key, "action", true) == 0)
                            .Value;
            string message = req.GetQueryNameValuePairs()
                             .FirstOrDefault(q => string.Compare(q.Key, "message", true) == 0)
                             .Value;
            dbConnect db = new dbConnect();

            if (action == "get_logs")
            {
                List <log> logs = db.get_logs(limit);
                return(req.CreateResponse(HttpStatusCode.OK, logs, JsonMediaTypeFormatter.DefaultMediaType));
            }
            else
            {
                db.insert_log(message);
                response res = new response(1, "Log Added");
                return(req.CreateResponse(HttpStatusCode.OK, res, JsonMediaTypeFormatter.DefaultMediaType));
            }
        }
コード例 #4
0
ファイル: clsCheckOut.cs プロジェクト: radtek/NSS_POS
        public bool Save()
        {
            dbConnect con = new dbConnect();
            bool      ret = con.SaveCheckOut(this);

            if (ret && this.LstItems.Count > 0)
            {
                this.Id = clsCheckOut.GetCheckOutID(this.Timestamp, this.UserName);
                con.DeleteCheckOutItem(this.Id);
                foreach (clsCheckOutItem chkOutItem in this.LstItems)
                {
                    chkOutItem.CheckOutId = this.Id;
                    if (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount != 0)
                    {
                        chkOutItem.Remarks = string.Format("{0} [{1:0.00}]", chkOutItem.ActualAmount - chkOutItem.ExpectedAmount > 0 ? "Over" : (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount == 0 ? "Match" : "Short"), chkOutItem.ActualAmount - chkOutItem.ExpectedAmount);
                    }
                    else
                    {
                        chkOutItem.Remarks = "Match";
                    }
                    chkOutItem.Save();
                }
            }
            con.Close();
            return(ret);
        }
コード例 #5
0
ファイル: frmSalesReport.cs プロジェクト: radtek/NSS_POS
        private void SearchPurchases(DateTime startdate, DateTime enddate, string cashier)
        {
            List <Receipt> lstReceipt = new List <Receipt>();
            dbConnect      con        = new dbConnect();

            TotalIncome             = 0.0;
            NetProfit               = 0.0;
            TotalAccountsReceivable = 0.0;
            lstReceipt              = con.GetReceiptInfo(startdate, enddate, cashier);
            con.Close();
            dgvPurchase.Rows.Clear();
            dgvSenior.Rows.Clear();
            dgvAccounts.Rows.Clear();
            dgvPayments.Rows.Clear();
            TotalQty = 0;
            foreach (Receipt r in lstReceipt)
            {
                AddItemToGridReceipt(r);
                AddAccountsReceivableItemToGrid(r);
                //AddItemToGrid(r);
                TotalIncome += (r.TotalDiscountedAmount > r.CashTendered ? r.CashTendered : r.TotalDiscountedAmount);
                NetProfit   += (r.TotalDiscountedAmount - r.TotalCapital);
            }
            lblTotalSales.Text = string.Format("Total Sales: P {0:0.00}", TotalIncome);
            lblNetProfit.Text  = string.Format("Net Profit: P {0:0.00}", NetProfit);
            lblReceivable.Text = string.Format("Receivable: P {0:0.00}", TotalAccountsReceivable);
            lblItems.Text      = "Total Qty:" + TotalQty;
        }
コード例 #6
0
ファイル: Login.cs プロジェクト: MeerimI/desk-apps
        private void button1_Click(object sender, EventArgs e)
        {
            dbConnect dbCon = new dbConnect();

            string log  = TextBox1.Text;
            string pass = TextBox2.Text;

            if (count <= 3)
            {
                if (dbCon.ReadData($"SELECT * FROM admin WHERE login='******' AND password ='******'") == 1)
                {
                    /* using (Form1 fd = new Form1())
                     * {
                     *   fd.Show();
                     *   this.Hide();
                     * }
                     */
                    Form1 fd = new Form1();
                    fd.Show();
                    this.Hide();
                }
                else
                {
                    count2--;
                    label4.Text = $"Неправильный логин или пароль. Осталось {count2}-попытки";
                    count++;
                }
            }
            else
            {
                label4.Text = "Нет Попыток!";
            }
        }
コード例 #7
0
        public void Delete(int inventoryid)
        {
            dbConnect connect = new dbConnect();

            connect.DeleteInventoryItem(inventoryid);
            connect.Close();
        }
コード例 #8
0
 private void BackupData()
 {
     if (clsUtil.GetApproval(m_user, UserAccess.Manager))
     {
         string directory = Path.GetDirectoryName(Application.ExecutablePath);
         directory = directory.Substring(0, directory.LastIndexOf("\\"));
         string backup   = directory + "\\iPOSBackup";
         string filename = string.Format("{0}\\backup_{1:yyyMMdd_HHmm}.mdb", backup, DateTime.Now);
         if (!Directory.Exists(backup))
         {
             Directory.CreateDirectory(backup);
         }
         dbConnect con    = new dbConnect();
         string    dbName = con.GetDatabaseName();
         con.Close();
         try
         {
             File.Copy(dbName, filename, true);
             MessageBox.Show(string.Format("Backup was saved successfully to {0}", filename), "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Backup Failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
     }
 }
コード例 #9
0
    protected void save_encoded_Click(object sender, EventArgs e)
    {
        string map       = HiddenMap.Value;
        string mapCenter = HiddenCenter.Value;
        string mapZoom   = HiddenZoom.Value;

        try
        {
            if (map != "")
            {
                string    query  = "update Applicant set GoogleMap='" + map + "', MapCenter='" + mapCenter + "' , MapZoom='" + mapZoom + "' where Applicant_ID=" + applicantID;
                dbConnect obj    = new dbConnect();
                string    result = obj.executeNonQuery(query);
                if (!result.Contains("Occured"))
                {
                    Response.Write("<div class='notification green'>Success</div>");
                }
                else
                {
                    Response.Write("<div class='notification red'>" + result + "</div>");
                    throw new Exception("Could not save maps");
                }
            }
            else
            {
                Response.Write("<div class='notification red'>No Data</div>");
            }
        }
        catch (Exception ex)
        {
            writeException obj = new writeException();
            obj.WriteExceptionToFile(ex, "Applicant.aspx.cs-save_encoded_Click");
        }
    }
コード例 #10
0
    public DataSet applicationComplete()
    {
        string    query = "select Complete from Applicant where Applicant_ID=" + applicantID;
        dbConnect obj   = new dbConnect();

        return(obj.executeSelectStatemant(query));
    }
コード例 #11
0
ファイル: Dept.cs プロジェクト: gonick/NOCApp
 public DataSet retrieveAppData(int deptid)
 {
     try
     {
         //string query = "select u.Datetime,u.Name,a.Address,a.Applicant_ID,a.Oil_Company from applicant a inner join userLogin u on a.Applicant_ID=u.Id where Applicant_ID not in (select Applicant_ID from noc where deptid=" + DeptID + ") and Applicant_ID !=0";
         string    query = "select v.[" + deptid + "],u.Datetime,u.Name,a.LOC_Petrol_Pump,a.Applicant_ID,a.Oil_Company from applicant a inner join userLogin u on a.Applicant_ID=u.Id inner join noc_view v on v.applicant_ID=a.Applicant_ID inner join applicantDepts ad on a.applicant_ID=ad.Applicant_ID where a.Applicant_ID !=0 and a.authorized='True' and (ad.[1]=" + deptid + " or ad.[2]=" + deptid + " or ad.[3]=" + deptid + " or ad.[4]=" + deptid + " or ad.[5]=" + deptid + " or ad.[6]=" + deptid + " or ad.[7]=" + deptid + " or ad.[8]=" + deptid + " or ad.[9]=" + deptid + " or ad.[10]=" + deptid + " or ad.[11]=" + deptid + " ) order by datetime desc";
         dbConnect obj   = new dbConnect();
         DataSet   dset  = obj.executeSelectStatemant(query);
         if (dset.Tables[0].Rows.Count > 0)
         {
             return(dset);
         }
         else
         {
             //    string query2 = "select u.Name,a.Address,a.Applicant_ID,a.Oil_Company from applicant a inner join userLogin u on a.Applicant_ID=u.Id";
             //    DataSet dset2 = obj.executeSelectStatemant(query2);
             //    if (dset2.Tables[0].Rows.Count > 0)
             //    {
             //        return dset2;
             //    }
             //    else
             //    {
             return(dset);
             //}
         }
     }
     catch (Exception ex)
     {
         writeException obj = new writeException();
         obj.WriteExceptionToFile(ex, "Dept-retrieveAppData");
         return(new DataSet());
     }
 }
コード例 #12
0
        private void NewCustomer()
        {
            ClearFields();
            mReceipt = new Receipt();

            if (mReceipt.CustomerName == null)
            {
                mReceipt = null;
                return;
            }
            dbConnect connect = new dbConnect();
            Receipt   OR      = new Receipt();

            OR.ORNumber = connect.GetNextORNumber();
            if (OR.ORNumber > 0)
            {
                mReceipt.ORNumber    = OR.ORNumber + 1;
                lblOR.Text           = mReceipt.ToString();
                cboName.SelectedItem = mReceipt.CustomerName;
                mReceipt.ORNumber    = 0;
            }
            else
            {
                mReceipt.ORNumber    = 1;
                lblOR.Text           = mReceipt.ToString();
                cboName.SelectedItem = mReceipt.CustomerName;
                mReceipt.ORNumber    = 0;
            }
            radAdd.Checked = true;
            txtInput.SelectAll();
            txtInput.Focus();
        }
コード例 #13
0
ファイル: Dept.cs プロジェクト: gonick/NOCApp
 public string deleteDeptFromUserLogin()
 {
     try
     {
         string    query = "select Username from Departments where DeptId=" + DeptID;
         dbConnect obj   = new dbConnect();
         DataSet   dset  = obj.executeSelectStatemant(query);
         if (dset.Tables[0].Rows.Count > 0)
         {
             string usn = dset.Tables[0].Rows[0][0].ToString();
             query = "delete from userLogin where Username='******' and Type=3";
             return(obj.executeNonQuery(query));
         }
         else
         {
             return("Error Occured");
         }
     }
     catch (Exception ex)
     {
         writeException obj = new writeException();
         obj.WriteExceptionToFile(ex, "Dept-deleteDeptFromUserLogin");
         return("Exception Occured");
     }
 }
コード例 #14
0
ファイル: Dept.cs プロジェクト: gonick/NOCApp
 public string deleteDeptFromNOC_View()
 {
     try
     {
         //string query = "alter table NOC_View alter column NOC_View[" + DeptID + "] drop default";
         string    query = "select name from sys.default_constraints where parent_object_id = object_id('NOC_VIEW') AND type = 'D' AND parent_column_id = (select column_id from sys.columns where object_id = object_id('NOC_VIEW') and name = '" + DeptID + "')";
         dbConnect obj   = new dbConnect();
         DataSet   dset  = obj.executeSelectStatemant(query);
         if (dset.Tables[0].Rows.Count > 0)
         {
             query = "alter table NOC_View drop constraint " + dset.Tables[0].Rows[0][0].ToString();
             string result = obj.executeNonQuery(query);
             if (!result.Contains("Occured"))
             {
                 query = "alter table NOC_View drop column [" + DeptID + "]";
                 return(obj.executeNonQuery(query));
             }
             else
             {
                 return("Error Occured");
             }
         }
         else
         {
             return("Error Occured");
         }
     }
     catch (Exception ex)
     {
         writeException obj = new writeException();
         obj.WriteExceptionToFile(ex, "Dept-deleteDeptFromNOC_View");
         return("Exception Occured");
     }
 }
コード例 #15
0
    public static int inboxCountAdmin()
    {
        int count = 0;

        try
        {
            string    query  = "select count(id) from Files where Files.[To]='Admin' and Seen='False'";
            dbConnect obj    = new dbConnect();
            DataSet   result = obj.executeSelectStatemant(query);
            if (!result.HasErrors && result.Tables[0].Rows.Count > 0)
            {
                count += Convert.ToInt32(result.Tables[0].Rows[0][0]);
            }
            query = "select count(id) from Messages where Messages.[To]='Admin' and Seen='False'";
            result.Dispose();
            result = obj.executeSelectStatemant(query);
            if (!result.HasErrors && result.Tables[0].Rows.Count > 0)
            {
                count += Convert.ToInt32(result.Tables[0].Rows[0][0]);
            }
        }
        catch (Exception ex)
        {
            writeException obj = new writeException();
            obj.WriteExceptionToFile(ex, "AjaxRequests-inboxCount");
        }

        return(count);
    }
コード例 #16
0
 public string updateAdminPass(string old)
 {
     try
     {
         string    query  = "update userLogin set Password='******' where Username='******' and Type=" + 2 + " and Password='******'";
         dbConnect obj    = new dbConnect();
         string    result = obj.executeNonQuery(query);
         if (result.Contains("Occured") || result.Contains("Exception") || result.Contains("Error"))
         {
             return(result);
         }
         else if (Convert.ToInt32(result) == 1)
         {
             return("Password Changed");
         }
         else
         {
             return("Incorect Password");
         }
     }
     catch (Exception ex)
     {
         writeException obj = new writeException();
         obj.WriteExceptionToFile(ex, "user-updateAdminPass");
         return("Exception Occured");
     }
 }
コード例 #17
0
 public DataSet retrieveData()
 {
     try
     {
         string    query = "select Id from userLogin where Username='******'";
         dbConnect obj   = new dbConnect();
         DataSet   dset  = obj.executeSelectStatemant(query);
         if (dset.Tables[0].Rows.Count > 0)
         {
             ApplicantID = Convert.ToInt32(dset.Tables[0].Rows[0]["Id"]);
             string query2 = "select * from Applicant where Applicant_ID=" + Convert.ToInt32(dset.Tables[0].Rows[0]["Id"]);
             return(obj.executeSelectStatemant(query2));
         }
         else
         {
             throw new Exception();
         }
     }
     catch (Exception ex)
     {
         writeException obj = new writeException();
         obj.WriteExceptionToFile(ex, "Applicant-retrieveData");
         return(new DataSet());
     }
 }
コード例 #18
0
        public void SaveHistory()
        {
            dbConnect connect = new dbConnect();

            connect.InsertInventoryHistory(this._or_num, this._desc, this._amount, this._qty, this._barcode, this._date);
            connect.Close();
        }
コード例 #19
0
        public static double GetInitialCash(DateTime date, string username)
        {
            dbConnect con    = new dbConnect();
            double    amount = con.GetInitialCash(date, username);

            con.Close();
            return(amount);
        }
コード例 #20
0
        public static bool Delete(int initCashid)
        {
            dbConnect con = new dbConnect();
            bool      ret = con.DeleteInitialCash(initCashid);

            con.Close();
            return(ret);
        }
コード例 #21
0
        public static int ChangeBarcode(string oldBarcode, string newBarcode)
        {
            dbConnect connect = new dbConnect();
            int       ret     = connect.ChangeBarcode(oldBarcode, newBarcode);

            connect.Close();
            return(ret);
        }
コード例 #22
0
ファイル: clsUsers.cs プロジェクト: radtek/NSS_POS
        public bool UsernameExists(string username)
        {
            dbConnect con = new dbConnect();
            bool      ret = con.UserNameExists(username);

            con.Close();
            return(ret);
        }
コード例 #23
0
ファイル: clsUsers.cs プロジェクト: radtek/NSS_POS
        public bool Save()
        {
            dbConnect con = new dbConnect();
            bool      ret = con.SaveUser(this);

            con.Close();
            return(ret);
        }
コード例 #24
0
        public bool Save()
        {
            dbConnect con = new dbConnect();
            bool      ret = con.SaveCheckOutItem(this);

            con.Close();
            return(ret);
        }
コード例 #25
0
        public static List <clsCheckOutItem> GetCheckOutItems(int checkoutId)
        {
            dbConnect con = new dbConnect();
            List <clsCheckOutItem> lstCheckoutItems = con.GetCheckOutItems(checkoutId);

            con.Close();
            return(lstCheckoutItems);
        }
コード例 #26
0
ファイル: clsUsers.cs プロジェクト: radtek/NSS_POS
        public static List <clsUsers> GetUsers()
        {
            dbConnect       con = new dbConnect();
            List <clsUsers> ret = con.GetUsers();

            con.Close();
            return(ret);
        }
コード例 #27
0
        public static clsProductItem SearchProduct(string barcode)
        {
            dbConnect      connect = new dbConnect();
            clsProductItem item    = connect.GetProductItem(barcode);

            connect.Close();
            return(item);
        }
コード例 #28
0
ファイル: clsUsers.cs プロジェクト: radtek/NSS_POS
        public static List <string> GetUserList()
        {
            dbConnect     con = new dbConnect();
            List <string> ret = con.GetUser();

            con.Close();
            return(ret);
        }
コード例 #29
0
        public static clsChargedTransaction GetChargedTransaction(int ornum)
        {
            dbConnect             con   = new dbConnect();
            clsChargedTransaction trans = con.GetChargedTransaction(ornum);

            con.Close();
            return(trans);
        }
コード例 #30
0
        public bool SaveChargeTransaction()
        {
            dbConnect con = new dbConnect();
            bool      ret = con.SaveChargedTransaction(this);

            con.Close();
            return(ret);
        }
コード例 #31
0
    protected void Button7_Click(object sender, EventArgs e)
    {
        dbConnect db = new dbConnect();
        string RoomID = Session["RoomID"].ToString();
        string qry = "update Room set RoomNO='" + txtRoomNo.Text + "',roomType='" + txtRoomtype.Text + "',floor_num='" + txtfloorNo.Text + "' where RoomID='"+RoomID+"'";

        bool conf = db.insert(qry);

        if (conf == true)
        {

            LblMsg.Text = "successful";
        }
        else
        {
            LblMsg.Text = "unSuccessful";
        }
    }
コード例 #32
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        dbConnect dc = new dbConnect();
        string qry = "select password , status from login where userName = '******'";
        DataTable dt = dc.selectIt(qry);

        try
        {

            if (dt == null || dt.Rows.Count == 0) // username error
            {
                lblMessage.Text = "Incorrect Username";
                lblMessage.Visible = true;
            }
            else // username correct
            {
                String pw = dt.Rows[0][0].ToString(); // get password

                if (pw != txtPassword.Text) // password not match
                {

                    lblMessage.Text = "incorrect password";
                    lblMessage.Visible = true;

                }
                else // password match
                {
                    txtPassword.Visible = false; // after login make invisible login controls
                    txtUserName.Visible = false;
                    btnLogin.Visible = false;
                    lblUserName.Visible = false;
                    lblPassword.Visible = false;
                    lblMessage.Visible = false;

                    lbtnLogout.Visible = true; // visible logout btn

                    String status = dt.Rows[0][1].ToString(); // get the status
                    String email = txtUserName.Text;  // get username
                    String qryUserName = "";
                    String sessionStatus = null;
                    Session["user"] = null;

                    if (status == "admin") // admin login
                    {
                        lblLoggedUser.Text = "Admin";

                        Session["user"] = "******"; // user status
                        Session["userFname"] = "Admin";// user's name
                        String url = "EmpImage/admin.jpg";
                        imgUser.ImageUrl = "EmpImage/admin.jpg";

                        ibtnAgen.Visible = true;
                        //ibtnManage.Visible = true;
                        ibtnChangePassword.Visible = true; // set visible all controls
                        ibtnMail.Visible = true;
                        ibtnCustomer.Visible = true;
                        ibtnReceptionist.Visible = true;
                        ibtnHotelManagement.Visible = true;

                    }
                    else if (status == "reseption") // employee login
                    {
                        qryUserName = "******"+email+"'";
                        DataTable empNameImg = dc.selectIt(qryUserName);
                        String eName = empNameImg.Rows[0][0].ToString(); // user fname
                        String url = empNameImg.Rows[0][1].ToString(); // user img

                        lblLoggedUser.Text = eName; // display name of user
                        imgUser.ImageUrl = url;

                        Session["userFname"] = eName;
                        Session["user"] = "******";

                       // Response.Redirect("Home.aspx");

                    }
                    else if (status == "agent") // agent login
                    {
                        qryUserName = "******" + email + "'";
                        DataTable empNameImg = dc.selectIt(qryUserName);
                        String eName = empNameImg.Rows[0][0].ToString(); // user fname
                        String url = empNameImg.Rows[0][1].ToString(); // user img

                        lblLoggedUser.Text = eName; // display name of user
                        imgUser.ImageUrl = url;

                        Session["userFname"] = eName;
                        Session["user"] = "******";
                    }

                }

            }

        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
            lblMessage.Visible = true;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        /* insert payment details first then insert reservation details according to the reservation type session variable */

        String[] customerD = (String[])Session["billingDetails"]; // all customer details (passport , fname , lname , country , Street add , city , postal code , 4n , mail , salute )

        String agentID = "null";
        String salute = customerD[9];
        String fName = customerD[1];
        String lName = customerD[2];
        String StateAdd = customerD[4];
        String city = customerD[5];
        String postelCode = customerD[6];
        String phone = customerD[7];
        String email = customerD[8];
        String country = customerD[3];
        String passport = customerD[0];
        String cusType = " ";

        // before insert check this customer added by sefl or by agent(check any agent is logged now)

        if (Session["user"] != null)
        {
            if (Session["user"].ToString() == "Agent") // agent logged in
            {
                //get agent id from db

                String mail = Session["email"].ToString();

                String qry = "select agentID from Agent where email = '" + mail + "'"; // select agent id
                dbConnect dc = new dbConnect();
                DataTable dt = dc.selectIt(qry);

                if (dt != null) // correct agent values are retriewed
                {
                    agentID = dt.Rows[0][0].ToString();

                    // now insert details to customer

                    //String salute = customerD[9];
                    //String fName = customerD[1];
                    //String lName = customerD[2];
                    //String StateAdd = customerD[4];
                    //String city = customerD[5];
                    //String postelCode = customerD[6];
                    //String phone = customerD[7];
                    //String email = customerD[8];
                    //String country = customerD[3];
                    //String passport = customerD[0];

                    cusType = "Agent Through"; // by agent customer if agent wise

                    String qry2 = "insert into customer (salutation,fname,lname,state_address,city,postelCode,phone,email,country,passport_NIC,customer_Type,Agent_id) " +
                                    " values ('" + salute + "' , '" + fName + "' , '" + lName + "' , '" + StateAdd + "' , '" + city + "' , '" + postelCode + "' , '" + phone + "' , '" + email + "' , '" + country + "' , '" + passport + "' , '" + cusType + "' , '" + agentID + "') ";

                    dbConnect dc2 = new dbConnect();
                    bool conf = dc2.insertIt(qry2); // customer details inserted
                }
            }
            else // reseption or admin logged (that means walk in customer)
            {
                //String agentID = "null";
                //String salute = customerD[9];
                //String fName = customerD[1];
                //String lName = customerD[2];
                //String StateAdd = customerD[4];
                //String city = customerD[5];
                //String postelCode = customerD[6];
                //String phone = customerD[7];
                //String email = customerD[8];
                //String country = customerD[3];
                //String passport = customerD[0];

                cusType = "Walk-in"; // walkin customer

                String qry2 = "insert into customer (salutation,fname,lname,state_address,city,postelCode,phone,email,country,passport_NIC,customer_Type,Agent_id) " +
                                " values ('" + salute + "' , '" + fName + "' , '" + lName + "' , '" + StateAdd + "' , '" + city + "' , '" + postelCode + "' , '" + phone + "' , '" + email + "' , '" + country + "' , '" + passport + "' , '" + cusType + "' , '" + agentID + "') ";

                dbConnect dc2 = new dbConnect();
                bool conf = dc2.insertIt(qry2); // customer details inserted if reseption or admin wise

            }
        }
        else // no login ( that means online customer)
        {
            //String agentID = "null";
            //String salute = customerD[9];
            //String fName = customerD[1];
            //String lName = customerD[2];
            //String StateAdd = customerD[4];
            //String city = customerD[5];
            //String postelCode = customerD[6];
            //String phone = customerD[7];
            //String email = customerD[8];
            //String country = customerD[3];
            //String passport = customerD[0];

            cusType = "Walk-in"; // walkin customer

            String qry2 = "insert into customer (salutation,fname,lname,state_address,city,postelCode,phone,email,country,passport_NIC,customer_Type,Agent_id) " +
                            " values ('" + salute + "' , '" + fName + "' , '" + lName + "' , '" + StateAdd + "' , '" + city + "' , '" + postelCode + "' , '" + phone + "' , '" + email + "' , '" + country + "' , '" + passport + "' , '" + cusType + "' , '" + agentID + "') ";

            dbConnect dc2 = new dbConnect();
            bool conf = dc2.insertIt(qry2); // customer details inserted if self reg

        }
        dbConnect dc22 = new dbConnect();
        // now add payment details

        //select added customer id

        String qry3 = "select customerID from customer where Passport_nic = '" + passport + "'";
        DataTable dt3 = dc22.selectIt(qry3);

        String cusID = dt3.Rows[0][0].ToString();

        String totAmt = ""; // total price
        String[] paymentD = new String[6];

        // get total amount

        if (Session["reservationType"].ToString() == "sport")// Sport reservation request
        {
            String[] sportD = (String[])Session["sportReservationDetails"];  // passed by sport reservation function
            totAmt = sportD[2];

        }
        else if (Session["reservationType"].ToString() == "wedding")// wedding reservation request
        {
            totAmt = Session["payAmount"].ToString();

        }
        else if (Session["reservationType"].ToString() == "Room")
        {
            String roomD = Session["tot_price"].ToString();
            totAmt = roomD;
        }
        else if (Session["reservationType"].ToString() == "tour")
        {
            String tourD = Session["price"].ToString();
            totAmt = tourD;
        }

        // get orther payment details from session

        paymentD = (String[])Session["payMethodDetails"];

        String paid = paymentD[2];
        String remAmt = paymentD[3];
        String resType = Session["reservationType"].ToString(); // sport , wedding , Room , tour
        String remdate = paymentD[4];
        String payBy = paymentD[1];
        String agntID = paymentD[5];
        String reserveID = cusID; // we have to genarate a reservation id

        // res id is identtity

        String qry4 = "insert into payment (totalAmount,paidAmount,remainamount,reservationType,remainingDate,pay_by,agentID,cusID,resID) " +
                        " values ('" + totAmt + "' , '" + paid + "' , '" + remAmt + "' , '" + resType + "' , '" + remdate + "' , '" + payBy + "' , '" + agntID + "' , '" + cusID + "' , '" + reserveID + "') ";

        dbConnect dc4 = new dbConnect();
        bool confpay = dc4.insertIt(qry4);

        if (Session["reservationType"].ToString() == "sport")// Sport reservation request
        {
            String[] sportReserveD = (String[])Session["sportReservationDetails"];

            String rid = reserveID;
            String sdate = sportReserveD[0];
            String edate = sportReserveD[1];
            String location = sportReserveD[4];
            String fee = sportReserveD[2];
            String noOfMem = sportReserveD[3];
            String sportID = sportReserveD[5];
            String cid = cusID;
            String hid;

            String qry = "insert into sportsReservation (rid,sdate,edate,location,fee,noofMem,sportId,cid) " +
                            " values ('" + rid + "' , '" + sdate + "' , '" + edate + "' , '" + location + "' , '" + fee + "' , '" + noOfMem + "' , '" + sportID + "' , '" + cid + "' )";

            dbConnect dc = new dbConnect();
            bool confSport = dc.insertIt(qry);

            if (confSport == true)
            {
                lblMessage.Visible = true;
            }
            else
            {
                lblMessage.Text = "Cannot insert";
                lblMessage.Visible = true; ;
            }

        }
        else if (Session["reservationType"].ToString() == "wedding")// wedding reservation request
        {

        }
        else if (Session["reservationType"].ToString() == "Room")
        {

        }
        else if (Session["reservationType"].ToString() == "tour")
        {

        }
    }