Ejemplo n.º 1
0
        //
        // GET: /Customers/Create
        public ActionResult Create()
        {
            int employee_id = Convert.ToInt32(Session["user_id"]);
            if (Session["customer_dni"] != null)
            {
                string customer_dni = Session["customer_dni"].ToString();

                var customer = new CUSTOMER
                {
                    EMPLOYEE_ID = employee_id,
                    DNI = customer_dni
                };
                return View(customer);
            }
            else {
                var customer = new CUSTOMER
                {
                    EMPLOYEE_ID = employee_id
                };

                return View(customer);
            }

            //ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEES, "ID", "LOGIN");
            //return View(customer);
        }
Ejemplo n.º 2
0
        public ActionResult Create(CUSTOMER customer)
        {
            if (ModelState.IsValid)
            {
                db.CUSTOMERS.AddObject(customer);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEES, "ID", "LOGIN", customer.EMPLOYEE_ID);
            return View(customer);
        }
Ejemplo n.º 3
0
        public ActionResult Create(CUSTOMER customer)
        {
            if (ModelState.IsValid)
            {
                db.CUSTOMERS.AddObject(customer);
                db.SaveChanges();

                //int employee_id = Convert.ToInt32(Session["user_id"]);
                //var last_customer= db.CUSTOMERS.ToList().Where(m => m.EMPLOYEE_ID == employee_id).LastOrDefault();

                var new_customer = db.CUSTOMERS.Single(m => m.DNI == customer.DNI);

                return RedirectToAction("Customer", new { id = new_customer.ID });
            }

            ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEES, "ID", "LOGIN", customer.EMPLOYEE_ID);
            return View(customer);
        }
Ejemplo n.º 4
0
        public CUSTOMER getCustomer(decimal C_ID)
        {
            CUSTOMER customer = db.Queryable <CUSTOMER>().Where(it => it.ID == C_ID).Single();

            return(customer);
        }
Ejemplo n.º 5
0
 public static CUSTOMER CreateCUSTOMER(int ID, string nAME, string pASSWORD, decimal bALANCE, double lEARN_RATE, double tEACH_RATE, global::System.DateTime bIRTHDAY, bool aLLOW)
 {
     CUSTOMER cUSTOMER = new CUSTOMER();
     cUSTOMER.ID = ID;
     cUSTOMER.NAME = nAME;
     cUSTOMER.PASSWORD = pASSWORD;
     cUSTOMER.BALANCE = bALANCE;
     cUSTOMER.LEARN_RATE = lEARN_RATE;
     cUSTOMER.TEACH_RATE = tEACH_RATE;
     cUSTOMER.BIRTHDAY = bIRTHDAY;
     cUSTOMER.ALLOW = aLLOW;
     return cUSTOMER;
 }
Ejemplo n.º 6
0
    protected void btnSaveSA_Click(object sender, EventArgs e)
    {
        CUSTOMER cUSTOMER = new CUSTOMER();

        cUSTOMER.EMTID              = "";
        cUSTOMER.USERNAME           = "";
        cUSTOMER.CUSTFNAME          = txtCUSTFNAME.Text;
        cUSTOMER.CUSTMNAME          = txtCUSTMNAME.Text;
        cUSTOMER.CUSTLNAME          = txtCUSTLNAME.Text;
        cUSTOMER.CUSTADDRESS1       = txtCUSTADDRESS1.Text;
        cUSTOMER.CUSTADDRESS2       = txtCUSTADDRESS2.Text;
        cUSTOMER.CUSTCITY           = txtCUSTCITY.Text;
        cUSTOMER.CUSTSTATE          = txtCUSTSTATE.Text;
        cUSTOMER.CUSTZIP            = txtCUSTZIP.Text;
        cUSTOMER.CUSTHPHONE         = txtCUSTHPHONE.Text;
        cUSTOMER.CUSTCPHONE         = txtCUSTCPHONE.Text;
        cUSTOMER.CUSTWPHONE         = txtCUSTWPHONE.Text;
        cUSTOMER.CUSTSSN            = txtCUSTSSN.Text;
        cUSTOMER.CUSTDRIVINGLICENSE = txtDrivingLicense.Text;
        cUSTOMER.CUSTIDTYPE         = Int32.Parse(ddlCUST.SelectedValue);
        cUSTOMER.CUSTIDNUMBER       = txtCUSTIDNUMBER.Text;
        cUSTOMER.CUSTDOB            = DateTime.Parse(txtCUSTDOB.Text);
        cUSTOMER.CUSTISSUEDATE      = DateTime.Parse(txtCUSTISSUEDATE.Text);
        cUSTOMER.CUSTEXPIREDATE     = DateTime.Parse(txtCUSTEXPIREDATE.Text);
        cUSTOMER.ISOFACVERIFIED     = "Y";
        cUSTOMER.CUSTREMARKS        = txtCUSTREMARKS.Text;
        cUSTOMER.SCANURL            = "";
        cUSTOMER.CREATEDBY          = 1;
        cUSTOMER.CREATEDON          = DateTime.Now;
        cUSTOMER.UPDATEDBY          = 1;
        cUSTOMER.UPDATEDON          = DateTime.Now;

        if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0)
        {
            try
            {
                string dirUrl  = "~/Uploads/Customer";
                string dirPath = Server.MapPath(dirUrl);

                if (!Directory.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath);
                }

                string fileName = Path.GetFileName(uplFile.PostedFile.FileName);
                string fileUrl  = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName);
                string filePath = Server.MapPath(fileUrl);
                uplFile.PostedFile.SaveAs(filePath);

                cUSTOMER.SCANURL = dirUrl + "/" + fileName;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message.ToString();
            }
        }
        else
        {
            cUSTOMER.SCANURL = "~/Uploads/Customer/no_image.jpeg";
        }

        if (chkSuspicious.Checked)
        {
            cUSTOMER.ISOFACVERIFIED = "Y";
        }
        else
        {
            cUSTOMER.ISOFACVERIFIED = "N";
        }

        int resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);

        if (resutl > 0)
        {
            lblMessage.Text       = "Saved Successfully .<br/><a href='SearchReceiverPage.aspx'>Next</a>";
            Session["snsenderID"] = resutl.ToString();
            panlIFrame.Visible    = false;
            //Response.Redirect("SearchReceiverPage.aspx");
        }
    }
Ejemplo n.º 7
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (txtCUSTFNAME.Text != ""

            //&& txtCUSTLNAME.Text != ""

            )
        {
            CUSTOMER cUSTOMER = new CUSTOMER();
            cUSTOMER = CUSTOMERManager.GetCUSTOMERByID(Int32.Parse(Request.QueryString["cUSTOMERID"]));


            CUSTOMER tempCUSTOMER = new CUSTOMER();
            tempCUSTOMER.CUSTOMERID = cUSTOMER.CUSTOMERID;

            tempCUSTOMER.EMTID              = "";
            tempCUSTOMER.USERNAME           = "";
            tempCUSTOMER.CUSTFNAME          = txtCUSTFNAME.Text;
            tempCUSTOMER.CUSTMNAME          = txtCUSTMNAME.Text;
            tempCUSTOMER.CUSTLNAME          = txtCUSTLNAME.Text;
            tempCUSTOMER.CUSTADDRESS1       = txtCUSTADDRESS1.Text;
            tempCUSTOMER.CUSTADDRESS2       = txtCUSTADDRESS2.Text;
            tempCUSTOMER.CUSTCITY           = txtCUSTCITY.Text;
            tempCUSTOMER.CUSTSTATE          = txtCUSTSTATE.Text;
            tempCUSTOMER.CUSTZIP            = txtCUSTZIP.Text;
            tempCUSTOMER.CUSTHPHONE         = txtCUSTHPHONE.Text;
            tempCUSTOMER.CUSTCPHONE         = txtCUSTCPHONE.Text;
            tempCUSTOMER.CUSTWPHONE         = txtCUSTWPHONE.Text;
            tempCUSTOMER.CUSTSSN            = txtCUSTSSN.Text;
            tempCUSTOMER.CUSTDRIVINGLICENSE = txtDrivingLicense.Text;
            tempCUSTOMER.CUSTIDTYPE         = Int32.Parse(ddlCUST.SelectedValue);
            tempCUSTOMER.CUSTIDNUMBER       = txtCUSTIDNUMBER.Text;
            tempCUSTOMER.CUSTDOB            = DateTime.Parse(txtCUSTDOB.Text);
            tempCUSTOMER.CUSTISSUEDATE      = DateTime.Parse(txtCUSTISSUEDATE.Text);
            tempCUSTOMER.CUSTEXPIREDATE     = DateTime.Parse(txtCUSTEXPIREDATE.Text);
            tempCUSTOMER.ISOFACVERIFIED     = cUSTOMER.ISOFACVERIFIED;
            tempCUSTOMER.CUSTREMARKS        = txtCUSTREMARKS.Text;
            tempCUSTOMER.SCANURL            = cUSTOMER.SCANURL;
            tempCUSTOMER.CREATEDBY          = 1;
            tempCUSTOMER.CREATEDON          = cUSTOMER.CREATEDON;
            tempCUSTOMER.UPDATEDBY          = 1;
            tempCUSTOMER.UPDATEDON          = DateTime.Now;


            if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0)
            {
                try
                {
                    string dirUrl  = "~/Uploads/Customer";
                    string dirPath = Server.MapPath(dirUrl);

                    if (!Directory.Exists(dirPath))
                    {
                        Directory.CreateDirectory(dirPath);
                    }

                    string fileName = Path.GetFileName(uplFile.PostedFile.FileName);
                    string fileUrl  = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName);
                    string filePath = Server.MapPath(fileUrl);
                    uplFile.PostedFile.SaveAs(filePath);

                    tempCUSTOMER.SCANURL = dirUrl + "/" + fileName;
                }
                catch (Exception ex)
                {
                    lblMessage.Text = ex.Message.ToString();
                }
            }
            else
            {
                tempCUSTOMER.SCANURL = cUSTOMER.SCANURL;
            }


            bool result = CUSTOMERManager.UpdateCUSTOMER(tempCUSTOMER);
            if (result == true)
            {
                lblMessage.Text       = "Update Successfully";
                Session["snsenderID"] = Request.QueryString["cUSTOMERID"];
                Response.Redirect("SearchReceiverPage.aspx");
            }
        }
        else
        {
            lblMessage.Text = "Please enter the First Name and Last Name.";
        }
    }
Ejemplo n.º 8
0
        //
        // GET: /Cus/Edit/5

        public ActionResult Edit(int id)
        {
            CUSTOMER customer = etMgr.CUSTOMER.FirstOrDefault(x => x.CUSTOMER_ID == id);

            return(View(customer));
        }
Ejemplo n.º 9
0
 public CustomerPresenter()
 {
     cus        = new CUSTOMER();
     this.model = new CustomerModel();
 }
Ejemplo n.º 10
0
 public void Delete(CUSTOMER Entity)
 {
     _customerDAO.Delete(Entity);
     Context.SaveChanges();
 }
Ejemplo n.º 11
0
 public ActionResult Edit(CUSTOMER customer)
 {
     if (ModelState.IsValid)
     {
         db.CUSTOMERS.Attach(customer);
         db.ObjectStateManager.ChangeObjectState(customer, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEES, "ID", "LOGIN", customer.EMPLOYEE_ID);
     return View(customer);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            // create record to hold customer data
            CUSTOMER cus = new CUSTOMER();

            // only create a new customer if running test case alone
            if (this._varCustomer == "")
            {
                cus.name = "cust" + StringFunctions.RandStr("X(8)");

                ReceivablesLedger._SA_Create(cus);
                ReceivablesLedger._SA_Close();
            }
            else
            {
                // other wise take customer name from global variable
                cus.name = this._varCustomer;
            }

            // create item to use in invoice
            ITEM item = new ITEM();

            item.ItemPrices.Add(new ITEM_PRICE("Canadian Dollars"));
            item.ItemPrices[0].priceList           = "Regular";
            item.ItemPrices[0].pricePerSellingUnit = Functions.RandCashAmount();


            // only create a new item if running test case alone
            if (this._varItem == "")
            {
                item.invOrServNumber = StringFunctions.RandStr("A(9)");
                InventoryServicesLedger._SA_Create(item);
                InventoryServicesLedger._SA_Close();
            }
            else
            {
                item.invOrServNumber = this._varItem;
            }

            // Create an Invoice
            SALES_INVOICE sale = new SALES_INVOICE();

            sale.Customer = cus;

            ROW r = new ROW();

            r.Item            = item;
            r.quantityShipped = Functions.RandCashAmount(2);
            r.price           = Functions.RandCashAmount();

            sale.GridRows.Add(r);

            SalesJournal._SA_Create(sale);
            System.Threading.Thread.Sleep(2000);
            SalesJournal._SA_Close();

            this.varSInvoice = sale.transNumber;
        }
Ejemplo n.º 13
0
        public ActionResult UserAddOrSearch(string op)
        {
            ViewData["front"] = "4";
            EntitieFinal entitie = new EntitieFinal();

            if (op == "add")
            {
                var user = new CUSTOMER();
                user.CUSTOMER_ID   = long.Parse(Request["ID"]);
                user.CUSTOMER_NAME = Request["NAME"];
                user.CUSTOMER_SEX  = 0;
                if (Request["SEX"] == "女")
                {
                    user.CUSTOMER_SEX = 1;
                }
                user.CUSTOMER_ADDRESS_ID   = Int32.Parse(Request["ADDRESS"]);
                user.CUSTOMER_EMAIL        = Request["EMAIL"];
                user.CUSTOMER_IS_ASSOCIATE = 1;
                entitie.CUSTOMERs.Add(user);
                entitie.SaveChanges();
                GetData();
                return(RedirectToAction("AdminView"));
            }
            else
            {
                var userList = from user in entitie.CUSTOMERs
                               select user;
                if (!string.IsNullOrEmpty(Request["ID"]))
                {
                    var p = long.Parse(Request["ID"]);
                    userList = from user in userList
                               where user.CUSTOMER_ID == p
                               select user;
                }
                if (!string.IsNullOrEmpty(Request["NAME"]))
                {
                    var p = Request["NAME"];

                    userList = from user in userList
                               where user.CUSTOMER_NAME == p
                               select user;
                }
                if (!string.IsNullOrEmpty(Request["SEX"]))
                {
                    long p = 0;
                    if (Request["SEX"] == "女")
                    {
                        p = 1;
                    }
                    userList = from user in userList
                               where user.CUSTOMER_SEX == p
                               select user;
                }
                if (!string.IsNullOrEmpty(Request["ADDRESS"]))
                {
                    var p = long.Parse(Request["ADDRESS"]);
                    userList = from user in userList
                               where user.CUSTOMER_ADDRESS_ID == p
                               select user;
                }
                if (!string.IsNullOrEmpty(Request["EMAIL"]))
                {
                    var p = Request["DEP"];
                    userList = from user in userList
                               where user.CUSTOMER_EMAIL == p
                               select user;
                }
                GetData();
                ViewData["USER"] = userList.ToList();
            }


            return(View("AdminView"));
        }
Ejemplo n.º 14
0
        public ActionResult CUSTOMER_Update([DataSourceRequest] DataSourceRequest request, CUSTOMER cUSTOMER)
        {
            if (ModelState.IsValid)
            {
                var entity = new CUSTOMER
                {
                    cust_id       = cUSTOMER.cust_id,
                    cust_name     = cUSTOMER.cust_name,
                    cust_phone    = cUSTOMER.cust_phone,
                    cust_mail     = cUSTOMER.cust_mail,
                    cust_dir      = cUSTOMER.cust_dir,
                    cust_longitud = cUSTOMER.cust_longitud,
                    cust_latitud  = cUSTOMER.cust_latitud,
                    cust_km       = cUSTOMER.cust_km,
                };

                db.CUSTOMER.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { cUSTOMER }.ToDataSourceResult(request, ModelState)));
        }
Ejemplo n.º 15
0
        protected void saveEasyPayOrder(EasyPayData data, List <SHOPPING_CART> carts, string originalResponse, decimal charge)
        {
            if (carts != null && carts.Count > 0)
            {
                int     addrId, bonId = 0;
                decimal bonusUsed = 0;
                if (Session["AddrForEasyPay"] != null)
                {
                    addrId = (int)Session["AddrForEasyPay"];
                }
                else
                {
                    BasePage.Log(null, "EasyPay save - null address.", "", "EasyPay.saveOrder");
                }

                CultureInfo ci     = new CultureInfo("en-US");
                string      cartID = data.OrderId;

                decimal total = ApplicationContext.Current.Carts.GetShoppingCartTotalAmount(cartID).Value;

                ORDERS order = new ORDERS();

                int addrID = 0;
                // Bonus has been used
                decimal rate   = ApplicationContext.Current.Payments.GetLastConversionRate().CurrencyRate + Configuration.CurrencyDelta;
                decimal amount = data.Amount / rate;
                if (total != amount)
                {
                    if (Session["BonForEasyPay"] != null && Session["BonIdForEasyPay"] != null && !String.IsNullOrWhiteSpace(Session["BonIdForEasyPay"].ToString()))
                    {
                        bonusUsed = (decimal)Session["BonForEasyPay"];
                        bonId     = (int)Session["BonIdForEasyPay"];
                    }
                    if (bonusUsed == total - amount)
                    {
                        setBonus(order, bonId, bonusUsed);
                    }
                    else
                    {
                        BasePage.Log(null, "EasyPay order save - bonus MANIPULATION. Original:" + (total - amount) + " new: " + bonusUsed +
                                     " - txnID: " + data.TransactionId, "", "EasyPay order save");
                        return;
                    }
                }

                order.TotalAmount = total;
                order.AmountPaid  = amount;
                order.Verified    = false;
                order.Canceled    = false;

                order.Completed = true;
                order.Status    = 1;

                try
                {
                    order.CustomerID = carts.First().CustomerID;

                    order.PAYMENT = new PAYMENT()
                    {
                        Type = 3
                    };
                    originalResponse = originalResponse.Replace("&", "\n");
                    order.PAYMENT.EASYPAY_PAYMENT = new EASYPAY_PAYMENT()
                    {
                        Amount            = data.Amount,
                        MerchantUsername  = Configuration.EasyPayMerchantUser,
                        TransactionID     = data.TransactionId,
                        ResponseCode      = data.ErrorCode,
                        Rate              = rate,
                        OriginalResponse  = originalResponse,
                        TransactionStatus = data.ErrorCodeS,
                        Date              = DateTime.Now,
                        Fee = charge
                    };

                    // TODO for now it is set to carrier without a fee
                    order.ShippingID = 3;

                    order.DateCreated = DateTime.Now;
                    ADDRESS addr = ApplicationContext.Current.Customers.GetAddressById(addrID);
                    // addresses
                    if (addr != null)
                    {
                        ADDRESSINFO shipping = new ADDRESSINFO(addr);
                        order.ADDRESSINFO = shipping;
                    }
                    //inserting and not saving as the saving will be done in the details insertion
                    ApplicationContext.Current.Orders.Insert(order, true, false);

                    // inserting the products of this order

                    ApplicationContext.Current.Orders.InsertDetailsFromCart(order, carts, false);

                    List <ORDER_DETAIL> details = ApplicationContext.Current.Orders.GetDetails(order.ID);

                    CUSTOMER customer = ApplicationContext.Current.Customers.GetById(carts[0].CustomerID);

                    Thread thread = new Thread(() => BasePage.sendOrderMailToAdmins(details, "EasyPay", "EasyPay Order", order.TotalAmount, customer.Name + " " + customer.Surname));
                    thread.Start();

                    Thread thread2 = new Thread(() => BasePage.sendOrderMailToCustomer(customer, details, "Porosia ne FZone.al"));
                    thread2.Start();

                    lblResult.Text = "<b>" + Resources.Lang.PayPalThankyouLabel + "</b> <br/><br/>" +
                                     Resources.Lang.SaveTransactionID + "<b>" + data.TransactionId + "</b>";
                }
                catch (System.Threading.ThreadAbortException ex)
                {
                }
                catch (Exception e)
                {
                    //TODO log exception
                    BasePage.Log(e, e.Message, e.StackTrace, "easyPay.Save");
                    lblResult.Text = Resources.Lang.PaymentProblemLiteral + "</b> <br/><br/>" +
                                     Resources.Lang.SaveTransactionID + "<b>" + data.TransactionId + "</b>";;
                }
            }
        }
Ejemplo n.º 16
0
 public void Update(CUSTOMER Entity)
 {
     Update(Entity, true);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            // Remove existing print file
            string printedInvoice = @"C:\Users\Public\Documents\Simply Accounting\2018\Data\Invoice.pdf"; // @"C:\Users\_sabvt\Documents\Simply Accounting\DATA\Invoice.pdf";

            Functions.RemoveExistingFile(printedInvoice);

            // Create a customer
            CUSTOMER cus = new CUSTOMER();

            if (this.varCustomer == "")
            {
                cus.name = "cust" + StringFunctions.RandStr("X(8)");

                ReceivablesLedger._SA_Create(cus);
                ReceivablesLedger._SA_Close();
            }
            else
            {
                cus.name = this.varCustomer;
            }


            // Create an item
            ITEM item = new ITEM();

            ITEM_PRICE itemPrice = new ITEM_PRICE();

            itemPrice.currency            = "Canadian Dollars";
            itemPrice.priceList           = "Regular";
            itemPrice.pricePerSellingUnit = Functions.RandCashAmount();
            item.ItemPrices.Add(itemPrice);

            if (this.varItem == "")
            {
                item.invOrServNumber = StringFunctions.RandStr("A(9)");
                InventoryServicesLedger._SA_Create(item);
                InventoryServicesLedger._SA_Close();
            }
            else
            {
                item.invOrServNumber = this._varItem;
            }

            // Create an invoice and print a Simply form
            SALES_INVOICE salesInv = new SALES_INVOICE();

            salesInv.Customer = cus;

            ROW firstRow = new ROW();

            firstRow.Item.invOrServNumber = item.invOrServNumber;
            firstRow.quantityShipped      = Functions.RandCashAmount(2);
            salesInv.GridRows.Add(firstRow);

            SalesJournal._SA_Create(salesInv, false);

            // Print. Install, then setup pdf printer to be default printer first
            SalesJournal._SA_PrintToFile(printedInvoice);

            // wait for file to be created
            Thread.Sleep(13000);

            // undo and close journal
            SalesJournal.UndoChanges();
            SalesJournal._SA_Close();

            // Verify file has been printed
            if (!Functions.VerifyFileExists(printedInvoice))
            {
                Functions.Verify(false, true, "Printed Simply form found");
            }
        }
Ejemplo n.º 18
0
 public void ResetPassword(CUSTOMER Customer)
 {
     _customerDAO.ResetPassword(Customer);
 }
Ejemplo n.º 19
0
 partial void UpdateCUSTOMER(CUSTOMER instance);
Ejemplo n.º 20
0
 public List <SHOPPING_CART> GetCart(CUSTOMER Customer)
 {
     return(_customerDAO.GetCart(Customer));
 }
Ejemplo n.º 21
0
        //
        // GET: /Demos/Delete/5

        public ActionResult Delete(int id)
        {
            CUSTOMER customer = db.CUSTOMERS.Single(c => c.ID == id);

            return(View(customer));
        }
Ejemplo n.º 22
0
 public List <CUSTOMER> Search(CUSTOMER Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_customerDAO.Search(Entity, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Ejemplo n.º 23
0
 public ActionResult AddCustomer(CUSTOMER cust)
 {
     data.Addcustomer(cust.ID, cust.AGE, cust.SALARY, cust.ADDRESS, cust.NAME);
     return(Redirect("Index"));
     //  return View("Index", data.GetAll());
 }
Ejemplo n.º 24
0
 public void Insert(CUSTOMER Entity)
 {
     _customerDAO.Insert(Entity);
     Context.SaveChanges();
 }
Ejemplo n.º 25
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblOfacMessage.Text = "";
        //lblCheckSus.Text = "";
        lblMessage.Text = "";
        //if (txtCUSTFNAME.Text != "" && txtCUSTCPHONE.Text != "")
        //{
        CUSTOMER cUSTOMER = new CUSTOMER();

        cUSTOMER.EMTID              = "";
        cUSTOMER.USERNAME           = "";
        cUSTOMER.CUSTFNAME          = txtCUSTFNAME.Text;
        cUSTOMER.CUSTMNAME          = txtCUSTMNAME.Text;
        cUSTOMER.CUSTLNAME          = txtCUSTLNAME.Text;
        cUSTOMER.CUSTADDRESS1       = txtCUSTADDRESS1.Text;
        cUSTOMER.CUSTADDRESS2       = txtCUSTADDRESS2.Text;
        cUSTOMER.CUSTCITY           = txtCUSTCITY.Text;
        cUSTOMER.CUSTSTATE          = txtCUSTSTATE.Text;
        cUSTOMER.CUSTZIP            = txtCUSTZIP.Text;
        cUSTOMER.CUSTHPHONE         = txtCUSTHPHONE.Text;
        cUSTOMER.CUSTCPHONE         = txtCUSTCPHONE.Text;
        cUSTOMER.CUSTWPHONE         = txtCUSTWPHONE.Text;
        cUSTOMER.CUSTSSN            = txtCUSTSSN.Text;
        cUSTOMER.CUSTDRIVINGLICENSE = txtDrivingLicense.Text;
        cUSTOMER.CUSTIDTYPE         = Int32.Parse(ddlCUST.SelectedValue);
        cUSTOMER.CUSTIDNUMBER       = txtCUSTIDNUMBER.Text;
        cUSTOMER.CUSTDOB            = DateTime.Parse(txtCUSTDOB.Text);
        cUSTOMER.CUSTISSUEDATE      = DateTime.Parse(txtCUSTISSUEDATE.Text);
        cUSTOMER.CUSTEXPIREDATE     = DateTime.Parse(txtCUSTEXPIREDATE.Text);
        cUSTOMER.ISOFACVERIFIED     = "Y";
        cUSTOMER.CUSTREMARKS        = txtCUSTREMARKS.Text;
        cUSTOMER.SCANURL            = "";
        cUSTOMER.CREATEDBY          = 1;
        cUSTOMER.CREATEDON          = DateTime.Now;
        cUSTOMER.UPDATEDBY          = 1;
        cUSTOMER.UPDATEDON          = DateTime.Now;

        if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0)
        {
            try
            {
                string dirUrl  = "~/Uploads/Customer";
                string dirPath = Server.MapPath(dirUrl);

                if (!Directory.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath);
                }

                string fileName = Path.GetFileName(uplFile.PostedFile.FileName);
                string fileUrl  = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName);
                string filePath = Server.MapPath(fileUrl);
                uplFile.PostedFile.SaveAs(filePath);

                cUSTOMER.SCANURL = dirUrl + "/" + fileName;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message.ToString();
            }
        }
        else
        {
            cUSTOMER.SCANURL = "~/Uploads/Customer/no_image.jpeg";
        }

        int resutl = 0;

        try
        {
            string ofacVerify = string.Empty;
            ofacservice.OFACService service;
            service = new ofacservice.OFACService();
            string token = service.Logon(1881, "koromstar", "b3t5vi113");
            //string token = service.Logon(1881, "abimatu", "b3t5vi113");
            string xml = service.OFACScanName(token, txtCUSTFNAME.Text + " " + txtCUSTMNAME.Text + " " + txtCUSTLNAME.Text);

            if (xml != "")
            {
                ofacVerify = ProcessXML(xml);
                //ofacVerify = "N";
                if (ofacVerify == "Y")
                {
                    cUSTOMER.ISOFACVERIFIED = ofacVerify;
                    lblOfacMessage.Text     = "Suspecious Activity Found.";
                    //lblOfacMessage.Text = ofacVerify.ToString();

                    List <CUSTOMER> cUSTOMER1 = new List <CUSTOMER>();
                    cUSTOMER1 = CUSTOMERManager.GetAllCUSTOMERsByCUSTIDNUMBER_CUSTDOB(txtCUSTIDNUMBER.Text, DateTime.Parse(txtCUSTDOB.Text));

                    //lblMessage.Text = cUSTOMER1.Count.ToString();

                    if (cUSTOMER1.Count == 0)
                    {
                        panlIFrame.Visible = true;


                        if (lblCheckSus.Text == "1")
                        {
                            if (chkSuspicious.Checked == true)
                            {
                                cUSTOMER.ISOFACVERIFIED = "N";
                            }
                            else
                            {
                                cUSTOMER.ISOFACVERIFIED = "Y";
                            }

                            resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);
                        }
                    }
                    else
                    {
                        panlIFrame.Visible      = false;
                        cUSTOMER.ISOFACVERIFIED = "N";
                        resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);
                    }
                }
                else
                {
                    lblOfacMessage.Text = "Suspecious Activity Not Found.";
                    //lblOfacMessage.Text = ofacVerify.ToString();

                    panlIFrame.Visible      = false;
                    cUSTOMER.ISOFACVERIFIED = "Y";
                    resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);
                }
            }
            //int resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);

            if (resutl > 0)
            {
                lblMessage.Text       = "Saved Successfully .<br/><a href='SearchReceiverPage.aspx'>Next</a>";
                Session["snsenderID"] = resutl.ToString();
                //Response.Redirect("SearchReceiverPage.aspx");
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text         = "OFAC Login Problem...<br/> So without Checking OFAC we are adding this Customer.<br/>Please Contact with OFAC Office or better the Develeoper of this software(Anam)";
            cUSTOMER.ISOFACVERIFIED = "Y";
            resutl = CUSTOMERManager.InsertCUSTOMER(cUSTOMER);
            if (resutl > 0)
            {
                lblMessage.Text      += "<br/>Saved Successfully .<br/>Go for <a href='SearchReceiverPage.aspx' style='font-size:30px;'>Next  >></a>";
                Session["snsenderID"] = resutl.ToString();
                //Response.Redirect("SearchReceiverPage.aspx");
            }
        }
    }
Ejemplo n.º 26
0
 public void Update(CUSTOMER Customer, bool IgnorePass, bool Attach = true)
 {
     _customerDAO.Update(Customer, IgnorePass, Attach);
     Context.SaveChanges();
 }
Ejemplo n.º 27
0
 private void RemoveDepartment(CUSTOMER pv)
 {
     CustomerDao.Instance().Delete(pv.CUST_ID);
     CustomerLists.Remove(pv);
 }
Ejemplo n.º 28
0
 public void Update(CUSTOMER Entity, bool Attach = true)
 {
     _customerDAO.Update(Entity, Attach);
     Context.SaveChanges();
 }
Ejemplo n.º 29
0
 public void AddToCUSTOMER(CUSTOMER cUSTOMER)
 {
     base.AddObject("CUSTOMER", cUSTOMER);
 }
Ejemplo n.º 30
0
        public ActionResult Index(OrderInfoModel data)
        {
            try
            {
                if (String.IsNullOrEmpty(data.CustomerPhone) || String.IsNullOrEmpty(data.CustomerName) || String.IsNullOrEmpty(data.CustomerAddress))
                {
                    throw new Exception("Vui lòng điền đầy đủ thông tin trước khi đặt hàng");
                }
                var list = (Session["cart"] as List <PRODUCT>);
                if (list is null)
                {
                    throw new Exception("Đơn hàng rỗng không thể thanh toán");
                }
                if (list.Count < 1)
                {
                    throw new Exception("Đơn hàng rỗng không thể thanh toán");
                }

                using (THUONGMAIDIENTUEntities db = new THUONGMAIDIENTUEntities())
                {
                    // tìm và update khách nếu ko thì tạo
                    var customer = db.CUSTOMERs.Where(x => x.CustomerPhone.Equals(data.CustomerPhone)).FirstOrDefault();
                    if (customer is null)
                    {
                        customer = new CUSTOMER();
                    }
                    customer.CustomerPhone   = data.CustomerPhone;
                    customer.CustomerAddress = data.CustomerAddress;
                    customer.CustomerName    = data.CustomerName;
                    customer.CustomerEmail   = data.CustomerEmail;
                    if (customer.IdCustomer < 1)
                    {
                        db.CUSTOMERs.Add(customer);
                    }
                    db.SaveChanges();

                    ORDER o = new ORDER();
                    o.IdCustomer   = customer.IdCustomer;
                    o.DateOrder    = DateTime.Now;
                    o.DateDelivery = DateTime.Now;
                    o.OrderComment = data.CustomerComment;
                    o.IdPayment    = data.PaymentMethod;
                    o.IdStatus     = 1;
                    int total = 0;

                    foreach (var p in list)
                    {
                        total += (int)p.ProductPrice;
                        PRODUCT_ORDER po = new PRODUCT_ORDER();
                        po.Count     = 1;
                        po.Discount  = 0;
                        po.IdProduct = p.IdProduct;
                        po.Price     = p.ProductPrice;
                        o.PRODUCT_ORDER.Add(po);
                    }

                    o.Total = total;

                    db.ORDERs.Add(o);
                    db.SaveChanges();

                    if (data.PaymentMethod == 2)
                    {
                        VNPay  vnpay = new VNPay();
                        string link  = vnpay.GetBankingURL(total, data.BankCode, o.IdOrder.ToString(), DateTime.Now);
                        return(Redirect(link));
                    }
                    TempData["id"] = o.IdOrder;
                    return(RedirectToAction("Success"));
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(View());
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Creates a new customer given a customerData object which contains all relevent details about that customer.
        /// Returns a ResponseMessage object which contains the success status, and the id of the new customer if successful.
        /// </summary>
        /// <param name="customerData"></param>
        /// <returns></returns>
        public GETResponseMessage createNewCustomer(CreateNewCustomerDataSet customerData)
        {
            if (!checkCustomerNameIsUnique(customerData.customerName))
            {
                return(new GETResponseMessage(ResponseTypes.Failed, "Customer name is not unique. "));
            }

            if (!doesDealershipExist(customerData.dealershipId))
            {
                return(new GETResponseMessage(ResponseTypes.Failed, "Dealership ID not found. "));
            }

            if (customerData.customerName == "")
            {
                return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Missing required data. "));
            }

            string[] LogoArr      = customerData.logoBase64.Split(',');
            string   customerLogo = "";

            if (LogoArr.Length > 1)
            {
                customerLogo = LogoArr[1];
            }
            int?reportId = null;

            if (customerData.reportId != 0)
            {
                reportId = customerData.reportId;
            }
            CUSTOMER newCustomer = new CUSTOMER()
            {
                cust_name        = customerData.customerName,
                custid           = customerData.customerName,
                active           = true,
                billing_address  = false,
                Showlimits       = false,
                DealershipId     = customerData.dealershipId,
                cust_street      = customerData.streetNumber + " " + customerData.streetAddress,
                cust_suburb      = customerData.city,
                cust_postcode    = customerData.postCode,
                cust_state       = customerData.state,
                cust_phone       = customerData.phoneNumber,
                cust_country     = customerData.country,
                cust_mobile      = customerData.mobileNumber,
                cust_email       = customerData.emailAddress,
                created_date     = DateTime.UtcNow,
                CreatedByUserId  = customerData.authUserId,
                fullAddress      = customerData.fullAddress,
                labonly          = false,
                logo             = Convert.FromBase64String(customerLogo),
                SelectedReportId = reportId
            };

            using (var context = new SharedContext())
            {
                context.CUSTOMER.Add(newCustomer);

                try
                {
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    return(new GETResponseMessage(ResponseTypes.Failed, e.Message));
                }
            }

            using (var context = new SharedContext())
            {
                long[] userIds = context.UserAccessMaps.Where(a => (a.DealershipId == customerData.dealershipId && a.AccessLevelTypeId == (int)UserAccessTypes.DealershipAdministrator) ||
                                                              a.AccessLevelTypeId == (int)UserAccessTypes.GlobalAdministrator)
                                 .Where(m => m.user_auto != null).Select(u => (long)u.user_auto).ToArray();

                foreach (long userId in userIds)
                {
                    USER_CRSF_CUST_EQUIP accessRecord = new USER_CRSF_CUST_EQUIP()
                    {
                        user_auto     = userId,
                        customer_auto = newCustomer.customer_auto,
                        level_type    = 1,
                        modified_user = "******"
                    };
                    context.USER_CRSF_CUST_EQUIP.Add(accessRecord);
                }

                try
                {
                    context.SaveChanges();
                } catch (Exception e)
                {
                    return(new GETResponseMessage(ResponseTypes.Failed, e.Message));
                }
            }

            return(new GETResponseMessage(ResponseTypes.Success, newCustomer.customer_auto.ToString()));
        }
Ejemplo n.º 32
0
        private bool LoadCustomer(int id)
        {
            CUSTOMER customer = null;

            try
            {
                customer = ApplicationContext.Current.Customers.GetById(id);
                if (customer != null)
                {
                    txtName.Text    = customer.Name;
                    txtSurname.Text = customer.Surname;
                    txtEmail.Text   = customer.Email;
                    txtPhone.Text   = customer.Telephone;
                    txtMobile.Text  = customer.Mobile;

                    chkActive.Checked = customer.Active;
                    if (customer.Newsletter.HasValue)
                    {
                        chkNewsletter.Checked = customer.Newsletter.Value;
                    }
                    if (customer.Gender == "M")
                    {
                        btnMale.Checked = true;
                    }
                    else if (customer.Gender == "F")
                    {
                        btnFemale.Checked = true;
                    }
                    if (customer.BirthDate.HasValue)
                    {
                        txtBirthDate.Text = customer.BirthDate.Value.ToString("dd/MM/yyyy");
                    }

                    if (customer.RegistrationDate.HasValue)
                    {
                        txtRegDate.Text = customer.RegistrationDate.Value.ToString("dd/MM/yyyy");
                    }

                    txtPass.Attributes.Add("value", fakePassChars);
                    txtPass2.Attributes.Add("value", fakePassChars);

                    if (customer.ADDRESS != null && customer.ADDRESS.Count != 0)
                    {
                        loadAddresses(customer.ADDRESS, id, true);
                    }
                    else
                    {
                        addressCount.Value = "0";
                    }

                    if (customer.InvitedFrom.HasValue)
                    {
                        litInvitedFrom.Text = customer.CUSTOMER2.Name + " " + customer.CUSTOMER2.Surname;
                        aInvitedFrom.HRef   = "CustomerNew.aspx?ID=" + customer.InvitedFrom.Value;
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                writeError(ex.Message);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 33
0
 // GET: Profile
 public ActionResult Profile(CUSTOMER customerModel)
 {
     return(View(customerModel));
 }
Ejemplo n.º 34
0
        private void Save()
        {
            CUSTOMER customer = new CUSTOMER();

            customer.Name       = txtName.Text;
            customer.Surname    = txtSurname.Text;
            customer.Email      = txtEmail.Text;
            customer.Active     = chkActive.Checked;
            customer.Newsletter = chkNewsletter.Checked;
            customer.Telephone  = txtPhone.Text;
            customer.Mobile     = txtMobile.Text;

            if (btnMale.Checked)
            {
                customer.Gender = "M";
            }
            else if (btnFemale.Checked)
            {
                customer.Gender = "F";
            }
            bool ignorePass = false;

            if (txtPass.Text != fakePassChars)
            {
                customer.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPass.Text, Configuration.PasswordHashMethod).ToLower();
            }
            else
            {
                ignorePass = true;
            }

            if (!String.IsNullOrWhiteSpace(txtBirthDate.Text))
            {
                customer.BirthDate = DateTime.Parse(txtBirthDate.Text);
            }

            // not a new customer
            int id = 0;

            lblErrors.Visible   = true;
            lblErrors.ForeColor = Color.Green;
            string operation = String.Empty;

            try
            {
                if (CustomerID != 0)
                {
                    customer.ID = CustomerID;
                    ApplicationContext.Current.Customers.Update(customer, ignorePass, true);
                    operation = "updated";
                }
                else
                {
                    // new customer, set registration date to today
                    customer.RegistrationDate = DateTime.Today.Date;
                    ApplicationContext.Current.Customers.Insert(customer);
                    operation  = "inserted";
                    CustomerID = customer.ID;
                    setAddrCustomerId();
                }


                for (int i = 0; i < Int32.Parse(addressCount.Value); i++)
                {
                    CustomerAddress custAddr = (CustomerAddress)tabAddresses.FindControl("address" + (i + 1));
                    custAddr.Save(true);
                }
                lblErrors.Text = "Customer " + operation + " correctly.";
            }
            catch (Exception ex)
            {
                writeError(ex.Message);
            }
        }
Ejemplo n.º 35
0
        public void insertOrUpdateCustomer(string name, string address, string phone)
        {
            String error = "";

            try
            {
                if (!checkValidName(name))
                {
                    error += "Tên rỗng hoặc không hợp lệ \n";//"Name is empty or invalid\n";
                    throw new Exception();
                }
                if (!checkValidAddress(address))
                {
                    error += "Địa chỉ rỗng hoặc không hợp lệ \n";//"Address is empty or invalid\n";
                    throw new Exception();
                }

                if (!checkValidPhone(phone))
                {
                    error += "Số điện thoại không hợp lệ \n";//"Sev Date is empty or invalid\n";
                    throw new Exception();
                }


                cus.CUS_NAME = name;

                cus.ADDRESS = address;

                cus.PHONE = phone;


                cus.RECORD_STATUS = (char)RECORD_STATUS.ACTIVE + "";
                if (!isUpdated)
                {
                    if (model.addCustomer(cus))
                    {
                        cusAddingView.showMessageBox(Resources.MB_SUCCESS, MessageBoxIcon.Information);
                        cus = new CUSTOMER();
                        cusAddingView.refreshAll();
                    }
                    else
                    {
                        cusAddingView.showMessageBox(Resources.MB_FAILURE, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    if (model.updateCustomer(cus))
                    {
                        cusAddingView.showMessageBox(Resources.MB_SUCCESS, MessageBoxIcon.Information);
                        cusAddingView.backPreviousForm();
                    }
                    else
                    {
                        cusAddingView.showMessageBox(Resources.MB_FAILURE, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception e)
            {
                cusAddingView.showMessageBox(error, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 36
0
        /**
         * Type = 1 => Billing
         * Type = 2 => Quoting
         * Type = 3 => Shipping
         */
        private void HandleAccount(string companyName, string companyStreet, string companyProvince, string companyPostalCode,
                                   string companyCity, string companyCountry, string firstName, string lastName, string phone, string contactID, string intersection, string corner, int misJobID, int employeeNumber, string accountID, int type, string legalName)
        {
            try
            {
                int customerID = CommonMethods.GetMISID(TableName.Customer, accountID, salesForceProjectID);
                if (customerID == 0)
                {
                    /* Add new billing address */
                    CUSTOMER customer = new CUSTOMER();
                    customer.NAME = companyName;
                    //customer.LEGALNAME_SAMEAS_NAME = true;

                    if (legalName == null)
                    {
                        customer.LEGALNAME_SAMEAS_NAME = true;
                        customer.LEGAL_NAME            = companyName;
                    }
                    else
                    {
                        customer.LEGALNAME_SAMEAS_NAME = false;
                        customer.LEGAL_NAME            = legalName;//companyName;
                    }
                    customer.ADDR_1       = companyStreet;
                    customer.ADDR_2       = "";
                    customer.CITY         = companyCity;
                    customer.STATE        = companyProvince;
                    customer.ZIPCODE      = companyPostalCode;
                    customer.COUNTRY      = companyCountry;
                    customer.SalesID      = employeeNumber;
                    customer.Sa1ID        = employeeNumber;
                    customer.TERRITORY    = "6"; //other
                    customer.ACTIVE_FLAG  = "Y";
                    customer.CURRENCY_ID  = "CAD";
                    customer.Intersection = intersection;
                    switch (corner)
                    {
                    case "North West":
                        customer.NorthWest = true;
                        break;

                    case "North East":
                        customer.NorthEast = true;
                        break;

                    case "South West":
                        customer.SouthWest = true;
                        break;

                    case "South East":
                        customer.SouthEast = true;
                        break;
                    }

                    ProjectCompany cp = new ProjectCompany(misJobID);
                    cp.Insert(misJobID, 0, false, false, false);
                    int jcID = SqlCommon.GetNewlyInsertedRecordID(TableName.Sales_JobMasterList_Customer);

                    /* check if the customer has existed */
                    int rowID = CommonMethods.GetCompanyMISID(TableName.Customer, accountID);
                    if (rowID == 0)
                    {
                        //if it is not existent
                        rowID = CreateCustomer(customer, jcID);
                    }

                    if (rowID > 0)
                    {
                        CommonMethods.InsertToMISSalesForceMapping(TableName.Customer, accountID, rowID.ToString(), salesForceProjectID);
                    }
                    HandleAccountContact(misJobID, jcID, contactID, rowID, firstName, lastName, phone, accountID, type);
                }
                else
                {
                    CUSTOMER customer = _db.CUSTOMERs.FirstOrDefault(x => x.ROWID == customerID);
                    customer.NAME = companyName;
                    //customer.LEGALNAME_SAMEAS_NAME = true;
                    if (legalName == null)
                    {
                        customer.LEGALNAME_SAMEAS_NAME = true;
                        customer.LEGAL_NAME            = companyName;
                    }
                    else
                    {
                        customer.LEGALNAME_SAMEAS_NAME = false;
                        customer.LEGAL_NAME            = legalName;//companyName;
                    }

                    customer.ADDR_1      = companyStreet;
                    customer.ADDR_2      = "";
                    customer.CITY        = companyCity;
                    customer.STATE       = companyProvince;
                    customer.ZIPCODE     = companyPostalCode;
                    customer.COUNTRY     = companyCountry;
                    customer.SalesID     = employeeNumber;
                    customer.Sa1ID       = employeeNumber;
                    customer.TERRITORY   = "6"; //other
                    customer.ACTIVE_FLAG = "Y";
                    customer.CURRENCY_ID = "CAD";

                    customer.Intersection = intersection;
                    switch (corner)
                    {
                    case "North West":
                        customer.NorthWest = true;
                        break;

                    case "North East":
                        customer.NorthEast = true;
                        break;

                    case "South West":
                        customer.SouthWest = true;
                        break;

                    case "South East":
                        customer.SouthEast = true;
                        break;
                    }

                    _db.Entry(customer).State = EntityState.Modified;
                    _db.SaveChanges();

                    Sales_JobMasterList_Customer sales_JobMasterList_Customer = _db.Sales_JobMasterList_Customer.FirstOrDefault(x => x.jobID == misJobID && x.cID == customer.ROWID);
                    if (sales_JobMasterList_Customer != null)
                    {
                        HandleAccountContact(misJobID, sales_JobMasterList_Customer.jcID, contactID, customerID, firstName, lastName, phone, accountID, type);
                    }
                }

                LogMethods.Log.Debug("HandleAccount:Debug:" + "Done");
            }
            catch (Exception e)
            {
                LogMethods.Log.Error("HandleAccount:Error:" + e.Message);
            }
        }
Ejemplo n.º 37
0
 partial void InsertCUSTOMER(CUSTOMER instance);
Ejemplo n.º 38
0
        //
        // GET: /Demos/Details/5

        public ViewResult Details(int id)
        {
            CUSTOMER customer = db.CUSTOMERS.Single(c => c.ID == id);

            return(View(customer));
        }
Ejemplo n.º 39
0
 partial void DeleteCUSTOMER(CUSTOMER instance);
        public ContactViewModel convert(CUSTOMER customerToConvert)
        {
            ContactViewModel contactViewModel = new ContactViewModel();
            contactViewModel.xeroContactId = customerToConvert.ext_ref;
            contactViewModel.accountNumber = customerToConvert.CUSTOMER_ID.ToString();

            if (string.IsNullOrEmpty(customerToConvert.ext_key1))
            {
                if ((!(String.IsNullOrEmpty(customerToConvert.fname)) || (!(String.IsNullOrEmpty(customerToConvert.sname)))))
                {
                    if (!(DoesNameAlreadyExistInXero(customerToConvert.fname.Trim() + " " + customerToConvert.sname.Trim())))
                    {
                        contactViewModel.name = customerToConvert.fname.Trim() + " " + customerToConvert.sname.Trim();
                        contactViewModel.name = contactViewModel.name.Trim();
                    }
                    else
                    {
                        throw new CustomerNameAlreadyExistException("The name of customer with customer number " + customerToConvert.CUSTOMER_ID + " is already used as a contact name in Xero. The name of a contact must be unique. Please check the data and try agian.");
                    }
                }
                else if (!(String.IsNullOrEmpty(customerToConvert.company)))
                {
                    if(!(DoesNameAlreadyExistInXero(customerToConvert.company.Trim())))
                    {
                        contactViewModel.name = customerToConvert.company.Trim();
                    }
                    else
                    {
                        throw new CustomerNameAlreadyExistException("The name of customer with customer number " + customerToConvert.CUSTOMER_ID + " is already used as a contact name in Xero.  is already used as a name for a contact in Xero. The name of a contact must be unique. Please check the data and try agian.");
                    }
                }
                else
                {
                    throw new CustomerDoesNotExistException("Customer has no company name, firstname or lastname");
                }
            }
            else
            {
                contactViewModel.name = customerToConvert.ext_key1;
            }

            contactViewModel.fname = customerToConvert.fname.Trim();
            contactViewModel.sname = customerToConvert.sname.Trim();
            contactViewModel.address1 = customerToConvert.address1.Trim();
            contactViewModel.address2 = customerToConvert.address2.Trim();
            contactViewModel.address3 = customerToConvert.address3.Trim();
            contactViewModel.city = customerToConvert.city.Trim();
            contactViewModel.postalcode = customerToConvert.postalcode.Trim();
            contactViewModel.addressType = "STREET";
            contactViewModel.region = customerToConvert.region.Trim();
            contactViewModel.phone = customerToConvert.phone.Trim();
            contactViewModel.mobileNumber = customerToConvert.mphone.Trim();
            contactViewModel.faxNumber = customerToConvert.fax.Trim();
            if (customerToConvert.status.Trim() == "X")
            {
                contactViewModel.isArchived = true;
            }
            else
            {
                contactViewModel.isArchived = false;
            }

            try
            {
                contactViewModel.email = GetSplitedEmailAddress(customerToConvert.email, customerToConvert.CUSTOMER_ID);
            }
            catch (NotVailidEmailException)
            {
                throw;
            }

            return contactViewModel;
        }