예제 #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            CustomerDAO customersearch = new CustomerDAO();

            DataSet ds = new DataSet();
            ds = customersearch.getcustomersarch(txtClient.Text.Trim());
            if (ds.Tables[0].Rows.Count > 0)
            {
                lblmsg.Text = "Customer found with the " + txtClient.Text + "";

            }
            else
            {

                Session["result"] = "1";

                Response.Redirect("PersonalInfo.aspx");

            }
        }
예제 #2
0
        public string customeradd(customer customer1, Account account)
        {
            string str = "";
            SqlConnection conn = null;
            SqlTransaction trans = null;

            string returnString = IdProConstants.SUCCESS;

            CustomerDAO customerdao = new CustomerDAO();
            AccountDao accountdao = new AccountDao();
            ConnectionDao ConnectionDao = new ConnectionDao();
            Customer_Account_O2M customerAccountO2M = new Customer_Account_O2M();
            Customer_Account_O2MDAO customerAccountO2Mservice = new Customer_Account_O2MDAO();

            try
            {
                conn = ConnectionDao.getConnection();

                trans = conn.BeginTransaction();

                customerAccountO2M.CustomerID  = customerdao.addCustomerBasicInfo(conn, trans, customer1);
                if (!customerAccountO2M.CustomerID.Equals(0))
                {
                    customerAccountO2M.AccountID = accountdao.addAccountBasicInfo(conn, trans, account);

                    if (!customerAccountO2M.AccountID.Equals(0))
                    {
                       returnString =  customerAccountO2Mservice.addCustomerAccountO2MInfo(conn, trans,customerAccountO2M);

                    }
                    str = customer1.cofirstname;
                    if (str != "")
                    {
                        customerAccountO2M.CustomerID = customerdao.addCustomerCoinfo(conn, trans, customer1);
                        if (!customerAccountO2M.CustomerID.Equals(0))
                        {
                            customerAccountO2M.AccountID = accountdao.addAccountBasicInfo(conn, trans, account);

                            if (!customerAccountO2M.AccountID.Equals(0))
                            {
                                returnString = customerAccountO2Mservice.addCustomerAccountO2MInfo(conn, trans, customerAccountO2M);

                            }
                       }
                    }

                }

                if (returnString.Equals(IdProConstants.SUCCESS))
                {
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }
            }
            catch (Exception exception)
            {
                trans.Rollback();
                System.Diagnostics.Trace.WriteLine("[EmployeeServices:addEmployee] Exception " + exception.StackTrace);

            }
            finally
            {
                ConnectionDao.closeConnection(conn);

            }

            string finalreturnvalue="";
            if (returnString == "Success")
            {

                finalreturnvalue = "Thanks record saved successfully";
            }

            else
            {
                finalreturnvalue = "Sorry, Your request could not be processed. Please try after some time";

            }

            return finalreturnvalue;
        }