Наследование: MonoBehaviour
Пример #1
0
    protected void btnAddCustomer_Click(object sender, EventArgs e)
    {
        //luodaan uusi entiteetti kokoelmaan ja luodaan muutos kantaan
        //pöljän pojan tarkistus että kakissa kentissä on arvot
        try
        {
            if(txtCity.Text.Length * txtFirstName.Text.Length * txtAdress.Text.Length * txtLastName.Text.Length * txtZip.Text.Length > 0)
            {
                ViiniEntities ctx = new ViiniEntities();
                customer uusi = new customer();
                uusi.Firstname = txtFirstName.Text;
                uusi.Lastname = txtLastName.Text;
                uusi.Address = txtAdress.Text;
                uusi.City = txtCity.Text;
                uusi.ZIP = txtZip.Text;
                ctx.SaveChanges();
                lblMessages.Text = string.Format("Uusi asiakas {0} lisätty kantaan", uusi.Firstname + " " + uusi.Lastname);
            }
            else
            {
                lblMessages.Text = "Jokin kentistä on tyhjä";
            }
        }
        catch (Exception ex)
        {

           lblMessages.Text = ex.Message;
        }

    }
Пример #2
0
        static void Main(string[] args)
        {
            var customer1 = new customer
            {
                FirstName = "Sally",
                LastName = "Williams",
                Age = 23,
                Birthday = DateTime.Parse("01/01/2028")
            };

            var customer2 = new customer
            {
                FirstName = "Mike",
                LastName = "Harrison",
                Age = 10, //default 10, test with negative age
                Birthday = DateTime.Parse("01/01/2019")
            };

            //var customer3 = new customer
            //{
            //    firstName = Console.ReadLine(),
            //    lastName = Console.ReadLine(),
            //    age = int.Parse(Console.ReadLine()),
            //    birthday = int.Parse(Console.ReadLine())
            //};

            Console.WriteLine("Customer {0} {1} is {2} years old and was born in year {3}", customer2.FirstName, customer2.LastName, customer2.Age, customer2.Birthday);

            Debug.Assert(customer1.Age == 23, "Sally is 23.");
            //Debug.Assert(customer2.age == 10, "Mike is 10.");
            //Console.WriteLine("Thank you for joining {0} {1}", customer3.firstName, customer3.lastName);
            Console.ReadLine();
        }
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     //Luodaan uusi entiteetti kokoelmaan ja tallennetaan muutos kantaan
     
     try
     {
         //Pöljän pojan tarkistus että kaikissa kentissä on arvot
         if(txtFirstName.Text.Length * txtLastName.Text.Length * txtAddress.Text.Length * txtZIP.Text.Length * txtCity.Text.Length != 0)
         {
             ViiniEntities ctx = new ViiniEntities();
             customer uusi = new customer();
             uusi.Firstname = txtFirstName.Text;
             uusi.Lastname = txtLastName.Text;
             uusi.Address = txtAddress.Text;
             uusi.ZIP = txtZIP.Text;
             uusi.City = txtCity.Text;
             //Lisätään kontekstiin
             ctx.customers.Add(uusi);
             //Tallennetaan kantaan
             ctx.SaveChanges();
             lblMessage.Text = string.Format("Uusi asiakas {0} lisätty kantaan", uusi.Firstname + " " + uusi.Lastname);
         }
         else
         {
             lblMessage.Text = "Tarkista kentät, jotain puuttuu";
         }
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
         throw;
     }
 }
Пример #4
0
        public CustomerForm(customer c)
        {
            InitializeComponent();
            ControlsUtil.SetBackColor(this.Controls);
            bdgStates.DataSource = state.Fetch("ORDER BY symbol");
            address d;
            if (c == null)
                IsNew = true;

            if (IsNew)
            {
                c = new customer();
                d = new address();
            }
            else
            {
                d = address.SingleOrDefault(c.address_id);
                tfCnpj.Properties.ReadOnly = true;
                tfIE.Properties.ReadOnly = true;
                rgType.Properties.ReadOnly = true;
                if (c.inactive || c.is_business)
                {
                    pnData.Enabled = false;
                    pnAddress.Enabled = false;
                }
            }
            bdgCustomer.DataSource = c;
            bdgAddress.DataSource = d;
        }
Пример #5
0
 public void loadFromCnpj(customer c, address d)
 {
     rgType.EditValue = c.type;
     bdgCustomer.DataSource = c;
     bdgAddress.DataSource = d;
     IsNew = true;
     subPnData.Enabled = true;
     pnAddress.Enabled = true;
 }
Пример #6
0
        public CustomerForm(customer c)
        {
            try
            {
                SplashScreenManager.ShowForm(null, typeof(PleaseWaitForm), false, false, false);
                address ad;
                InitializeComponent();
                ControlsUtil.SetBackColor(this.Controls);
                if (c == null)
                {
                    c = new customer();
                    ad = new address();
                    IsNew = true;
                }
                else
                {
                    IsNew = false;
                    ad = address.SingleOrDefault(c.address_id);
                    foreach (phones_customer pc in phones_customer.Fetch("WHERE customer_id=@0", c.id))
                        listPhones.Items.Add(pc.phone);
                    pePicture.Image = new FTPUtil().getImageFromFile(c.directory_picture);
                    cbOrganEmitter.EditValue = c.organ_emitter_rg.Split('/')[0];
                    cbStateRG.EditValue = c.organ_emitter_rg.Split('/')[1];
                }

                List<state> listS = state.Fetch("");
                bdgStates.DataSource = listS;
                foreach (state e in listS)
                    cbStateRG.Properties.Items.Add(e.symbol);
                bdgOrganEmitter.DataSource = organ_emitter.Fetch("");
                bdgAddress.DataSource = ad;
                bdgCustomer.DataSource = c;

                Validations.ValidatorCPFCNPJ vcpf = new Validations.ValidatorCPFCNPJ() { ErrorText = "O CPF informado é inválido." };
                validatorCustomer.SetValidationRule(tfCPF, vcpf);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(String.Format("Ocorreu um erro.\n\n{0}\n{1}", ex.Message, ex.InnerException));
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Пример #7
0
        public ActionResult Create(CustomerFormStub model)
        {
            //bool isNameExist = RepoCustomer.Find().Where(p => p.name == model.Name).Count() > 0;

            if (ModelState.IsValid)
            {
                customer dbItem = new customer();
                dbItem = model.GetDbObject(dbItem);

                try
                {
                    RepoCustomer.Save(dbItem);
                }
                catch (Exception e)
                {
                    model.FillOwnerOptions(RepoOwner.FindAll());
                    model.FillTypeOptions();
                    model.FillTitleOptions();

                    return(View("Form", model));
                }

                //message
                string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "CreateSuccess").ToString();
                this.SetMessage(model.Name, template);

                return(RedirectToAction("Index"));
            }
            else
            {
                model.FillOwnerOptions(RepoOwner.FindAll());
                model.FillTypeOptions();
                model.FillTitleOptions();
                return(View("Form", model));
            }
        }
 public ActionResult Edit([Bind(Include = "customer_id,customer_name,customer_email,customer_phone,customer_state")] customer customer, HttpPostedFileBase customer_photo)
 {
     if (ModelState.IsValid)
     {
         ViewData.Clear();
         if (customer_photo != null && customer_photo.ContentLength > 0)
         {
             BinaryReader binaryReader = new BinaryReader(customer_photo.InputStream);
             customer.customer_photo = binaryReader.ReadBytes((int)customer_photo.ContentLength);
         }
         else
         {
             var ts = db.customers.AsNoTracking().FirstOrDefault(s => s.customer_id == customer.customer_id);
             customer.customer_photo = ts.customer_photo;
         }
         customer.customer_name   = customer.customer_name.ToLower();
         customer.customer_state  = customer.customer_state.ToLower();
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         ViewData["saved"] = "yes";
         return(RedirectToAction("Edit", "Customers", new { id = customer.customer_id, saved = "true" }));
     }
     return(View(customer));
 }
Пример #9
0
        private void MaterialListView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 1)
            {
                customer selectedCustomer = CustomerList.Where(u => u.customerid ==
                                                               Convert.ToInt32(listView1.SelectedItems[0].Tag)).FirstOrDefault();

                if (selectedCustomer != null)
                {
                    ShowCustomer(selectedCustomer);
                    panel1.Visible = true;
                    panel2.Visible = true;
                    FormHelper.AreRaisedButtonsVisible(BtnList, true);
                    LockFields(true);
                    FormHelper.ViewModeButtons(BtnList, FormHelper.ViewMode.View, this.Name);
                }
            }
            else
            {
                panel1.Visible = false;
                panel2.Visible = false;
                FormHelper.AreRaisedButtonsVisible(BtnList, false);
            }
        }
Пример #10
0
 public bool DeleteCustomer(customer customerObj)
 {
     Models.ApartmentEntities entities = new Models.ApartmentEntities();
     try
     {
         Models.customer customerModel = entities.customers.FirstOrDefault(el => el.id.Equals(customerObj.id) &&
                                                                           el.first_name.Equals(customerObj.first_name) &&
                                                                           el.last_name.Equals(customerObj.last_name));
         if (customerModel != null)
         {
             entities.Entry(customerModel).State = System.Data.Entity.EntityState.Deleted;
             entities.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #11
0
        //bayi-manager için current kullanicinin Id'si
        //normal kullanici için bu current kullanicinin owner ID'si bayiID parametresi olacak.
        public void musteriEkleR(string ad, string soyad, string unvan, string adres, string tel, string telCep, string email, string kim, string tc, string prim_kar, string prim_satis, bool chcMusteri, bool chcTedarikci, bool chcUsta, bool chcDisServis, int?antenid)
        {
            int kar_oran   = 0;
            int yekun_oran = 0;

            if (!string.IsNullOrEmpty(prim_kar))
            {
                kar_oran = Int32.Parse(prim_kar);
            }
            if (!string.IsNullOrEmpty(prim_satis))
            {
                yekun_oran = Int32.Parse(prim_satis);
            }

            //müşteri ekleme normal customer tablosuna yapılacak
            customer c = new customer();

            c.Ad          = ad + " " + soyad;
            c.tedarikci   = chcTedarikci;
            c.musteri     = chcMusteri;
            c.usta        = chcUsta;
            c.disservis   = chcDisServis;
            c.Adres       = adres;
            c.telefon     = tel;
            c.telefon_cep = telCep;
            c.email       = email;
            c.tanimlayici = kim;
            c.TC          = tc;
            c.Firma       = "firma";
            c.prim_kar    = kar_oran;
            c.prim_yekun  = yekun_oran;
            c.unvan       = unvan;
            c.antenid     = antenid;
            db.customers.Add(c);
            KaydetmeIslemleri.kaydetR(db);
        }
Пример #12
0
        public ActionResult Index()
        {
            SSMEntities se   = new SSMEntities();
            AspNetUser  user = se.AspNetUsers.Find(User.Identity.GetUserId());

            if (user != null)
            {
                foreach (customer cus in user.customers.ToList())
                {
                    customer userprofile = cus;
                    if (userprofile != null)
                    {
                        ViewData["UnpaidOrder"] = se.orders.SqlQuery("SELECT * FROM orders where completedDate is null and customerID=" + userprofile.id).ToList();
                        ViewData["licenses"]    = userprofile.Licenses.ToList();
                        ViewData["Payments"]    = userprofile.Payments.ToList();
                        ViewData["profile"]     = userprofile;
                    }
                }
            }
            Signer signer = new Signer();

            //signer.sign();
            return(View());
        }
Пример #13
0
        // PUT: odata/customers(5)
        public IHttpActionResult Put([FromODataUri] int key, Delta <customer> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            customer customer = db.customers.Find(key);

            if (customer == null)
            {
                return(NotFound());
            }

            patch.Put(customer);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!customerExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(customer));
        }
Пример #14
0
        public ActionResult saved(string uname, string fname, string type, string email
                                  , int phone, long cellphone, string provience, string city, string address, int postCode, int dd, int mm,
                                  int yyyy, string vegeterian, string pass, string lname)
        {
            resturantEntities r = new resturantEntities();
            customer          c = new customer();
            DateTime          d = new DateTime(yyyy, mm, dd);

            c.birth_date         = d;
            c.c_address          = address;
            c.c_cellphone_number = cellphone;
            c.c_city             = city;
            c.c_phone_number     = phone;
            c.c_province         = provience;
            c.email     = email;
            c.post_code = postCode;
            c.username  = uname;
            if (vegeterian == "checked")
            {
                c.vegeterian = true;
            }
            else
            {
                c.vegeterian = false;
            }
            r.customer.Add(c);
            mambership m = new mambership();

            m.username  = uname;
            m.mpassword = pass;
            m.mtype     = type;
            r.mambership.Add(m);
            r.SaveChangesAsync();
            Session["nav"] = m;
            return(View("saved"));
        }
Пример #15
0
        private void update_grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.selectedindex = update_grid.SelectedIndex;
            if (selectedindex == -1 || clist.Count <= selectedindex)
            {
                cust = null;
                return;
            }
            ;
            booking bh = new booking();

            cust       = (customer)update_grid.SelectedItem;
            fname.Text = cust.fname;
            clnam.Text = cust.lastname;
            ccnic.Text = cust.cnic;
            ccont.Text = cust.cell_no;
            DateTime dateb = new DateTime();

            dateb           = (DateTime)cust.booking.booking_date;
            db.SelectedDate = dateb;
            ld.SelectedDate = cust.booking.leave_date;
            cadd.Text       = cust.Address;
            urm_type.Text   = cust.booking.room.room_type;
        }
Пример #16
0
        public ActionResult Login(LoginModel model)
        {
            if (ModelState.IsValid)
            {
                // поиск пользователя в бд
                customer cust  = null;
                store    store = null;
                using (UserContext db = new UserContext())
                {
                    cust  = db.Cust.FirstOrDefault(u => u.cust_phone == model.Phone && u.cust_password == model.Password);
                    store = db.Store.FirstOrDefault(u => u.store_code == model.Phone && u.store_password == model.Password);
                }
                if (cust != null)
                {
                    role = 1;
                    id   = cust.cust_id;

                    FormsAuthentication.SetAuthCookie(model.Phone, true);
                    return(RedirectToAction("Index", "Home"));
                }
                else if (store != null)
                {
                    role         = 2;
                    id           = store.store_id;
                    ViewBag.Name = store.store_name;
                    FormsAuthentication.SetAuthCookie(model.Phone, true);
                    return(RedirectToAction("Index", "Product"));
                }
                else
                {
                    ModelState.AddModelError("", "Пользователя с таким логином и паролем нет");
                }
            }

            return(View());
        }
Пример #17
0
        internal async Task <bool> Update(int id, customer customer)
        {
            var newitem = await client.PutAsync <customer>("Put", id, customer);

            if (newitem != default(customer))
            {
                var item = Source.Where(O => O.Id == id).FirstOrDefault();
                if (item != null)
                {
                    item.Address      = newitem.Address;
                    item.ContactName  = newitem.ContactName;
                    item.CustomerType = newitem.CustomerType;
                    item.Email        = newitem.Email;
                    item.Handphone    = newitem.Handphone;
                    item.Name         = newitem.Name;
                    item.Phone1       = newitem.Phone1;
                    item.Phone2       = newitem.Phone2;
                    item.CityID       = newitem.CityID;
                    return(true);
                }
                SourceView.Refresh();
            }
            return(false);
        }
Пример #18
0
        public customer CreateNewCustomer(Guid idOwner)
        {
            string phone2 = "";

            if (PhoneNumber2 != null)
            {
                phone2 = PhoneNumber2;
            }

            customer cust = new customer
            {
                name         = Name,
                address      = Address,
                phone_number = PhoneNumber.Replace("_", "") + ";" + phone2,
                id_owner     = idOwner
            };

            if (CustomerTitle != null)
            {
                cust.title = CustomerTitle.Value.ToString();
            }

            return(cust);
        }
 public ActionResult Register(RegisterModel model)
 {
     if (ModelState.IsValid)
     {
         // Attempt to register the user
         MembershipCreateStatus createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email);
         if (createStatus == MembershipCreateStatus.Success)
         { // On success create a new customer data
             MembershipUser newUser   = MembershipService.GetUser(model.UserName, false);
             string         newUserID = newUser.ProviderUserKey.ToString();
             string         dtStamp   = DateTime.Now.ToString();
             string         accountNo = Guid.NewGuid().ToString();
             var            dbATM     = new ATMEntities();
             var            customer  = new customer
             {
                 idCustomer = newUserID,
                 firstName  = model.FirstName,
                 lastName   = model.LastName,
                 account    = accountNo,
                 cDate      = dtStamp
             };
             dbATM.customers.AddObject(customer);
             dbATM.SaveChanges();
             FormsService.SignIn(model.UserName, false);
             Session.Add("accountNumber", accountNo);
             TempData["justRegistered"] = "Y";
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", CustomerValidation.ErrorCodeToString(createStatus));
         }
     }
     ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
     return(View(model));
 }
 /// <summary>
 /// There are no comments for customer in the schema.
 /// </summary>
 public void AddTocustomer(customer customer)
 {
     base.AddObject("customer", customer);
 }
 /// <summary>
 /// Create a new customer object.
 /// </summary>
 /// <param name="id">Initial value of Id.</param>
 public static customer Createcustomer(int id)
 {
     customer customer = new customer();
     customer.Id = id;
     return customer;
 }
Пример #22
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
                return;
              //try
               // {
                //validações
                if (!Validations.isCPFCNPJ(tfCNPJ.EditValue.ToString(), false))
                {
                    XtraMessageBox.Show("CNPJ incorreto, verifique!");
                    return;
                }

                var countcnpj = customer.repo.ExecuteScalar<string>("SELECT COUNT(id) FROM customers WHERE document=@0",
                    tfCNPJ.EditValue);
                if (!countcnpj.Equals(DBNull.Value) && !String.IsNullOrEmpty(countcnpj))
                {
                    if (Convert.ToInt32(countcnpj) >= 1)
                    {
                        XtraMessageBox.Show("CNPJ já cadastrado, verifique!", "Cadore Tecnologia");
                        return;
                    }
                }
                SearchCPFCNPJUtil cc = new SearchCPFCNPJUtil();
                if (cc.Search(Document.CNPJ, tfCNPJ.Text))
                {
                    customer cre = new customer();
                    address d = new address();

                    cre.document = cc.NCNPJ;
                    if (cre.document.Length == 18)
                        cre.type = 0;
                    else
                        cre.type = 1;
                    cre.inactive = false;
                    cre.corporate_name = cc.RAZAOSOCIAL;
                    cre.fantasy_name = cc.FANTASIA;
                    d.name = cc.ENDERECO;
                    d.number = cc.NUMERO;
                    d.complement = cc.COMPLEMENTO;
                    d.district = cc.BAIRRO;
                    d.cep = cc.CEP;

                    // para evitar problemas com estados e cidades try para ignorar esta etapa caso haja erros!
                    try
                    {
                        state st = state.SingleOrDefault("WHERE symbol=@0", cc.UF);
                        d.state_id = st != null ? st.id : 0;
                        List<city> lci = city.Fetch("WHERE remove_character(name) ILIKE @0 AND state_id=@1",
                            city.Concat(cc.CIDADE), st.id);
                        d.city_id = lci != null ? lci[0].id : 0;
                    } catch (Exception) { }

                    if (!String.IsNullOrEmpty(cc.TELEFONE))
                    {
                        string[] f = cc.TELEFONE.Replace(" ", "").Split('/');
                        if (f.Length >= 1)
                            cre.phone_fixed = f[0];
                        if (f.Length >= 2)
                            cre.phone_mobile = f[1];
                    }

                    bdgAddress.DataSource = d;
                    bdgCustomer.DataSource = cre;
                    tfCNPJ.Properties.ReadOnly = true;
                    tfType.EditValue = cc.TIPO;
                    tfSituation.EditValue = cc.SITUACAOCNPJ;
                    tfDateOpening.EditValue = cc.ABERTURA;
                    tfCnae1.EditValue = cc.CNAE1;
                    tfCnae2.EditValue = cc.CNAE2;
                    tfJuridic.EditValue = cc.NATUREZA;
                }
            //}
            //catch (Exception ex)
            //{
            //    XtraMessageBox.Show(String.Format("Ocorreu um erro:\n\n{0}\n{1}", ex.Message, ex.InnerException));
            //}
        }
Пример #23
0
        public ActionResult Edit(int?id)
        {
            customer cus = db.customers.Find(id);

            return(View(cus));
        }
Пример #24
0
        public static RegisterResponse RegisterCustomer(RegisterRequest register)
        {
            auctionEntities = new AuctionSystemEntities();
            RegisterResponse registerResponse = new RegisterResponse();
            //To retrieve customers based on customer email from customer table in database.
            customer existingCustomer = auctionEntities.customers.Where(c => c.customer_email == register.CustomerEmail).FirstOrDefault();

            //Check if customer exists or not
            if (existingCustomer != null)
            {
                //if customer alreay exist then set fault as customer already exist.
                registerResponse.Fault = new Error {
                    Code = ErrorCodes.EmailAlreadyExist, Message = "User Email already exist"
                };
                return(registerResponse);
            }

            //if customer does not exist create customer
            customer customer = new customer();

            customer.customer_firstname = register.CustomerFirstName;
            customer.customer_lastname  = register.CustomerLastName;
            customer.customer_email     = register.CustomerEmail;
            customer.customer_password  = HashPassword(register.CustomerPassword);
            customer.customer_phone     = register.CustomerPhone;

            //Add customer to customer table in database and save
            auctionEntities.customers.Add(customer);
            auctionEntities.SaveChanges();


            customer_address address = new customer_address();

            address.Address1      = register.Address1;
            address.Address2      = register.Address2;
            address.City          = register.City;
            address.Address_State = register.State;
            address.Zipcode       = register.Zipcode;
            address.country       = register.Country;
            address.customer_id   = customer.id;

            auctionEntities.customer_address.Add(address);
            auctionEntities.SaveChanges();

            customer_payment payment = new customer_payment();

            payment.card_number       = register.CardNumber;
            payment.card_pin          = register.CardPin;
            payment.card_holdername   = register.CardHolderName;
            payment.card_expirydate   = register.CardExpiryDate;
            payment.payment_method_id = register.PaymentMethodId;
            payment.customer_id       = customer.id;
            payment.address_id        = address.id;

            auctionEntities.customer_payment.Add(payment);
            auctionEntities.SaveChanges();

            registerResponse.CustomerId        = customer.id;
            registerResponse.CustomerEmail     = customer.customer_email;
            registerResponse.CustomerFirstName = customer.customer_firstname;
            registerResponse.CustomerLastName  = customer.customer_lastname;

            return(registerResponse);
        }
Пример #25
0
 public int EditCustomer(customer customer)
 {
     return(customerDal.EditCustomer(customer));
 }
Пример #26
0
 public void insert(customer newItem)
 {
     db.customers.Add(newItem);
     db.SaveChanges();
 }
Пример #27
0
        public static CustomerVM FromDto(customer dto)
        {
            CustomerVM vm = new CustomerVM()
            {
                Address      = dto.address,
                Birthday     = dto.birthday,
                BirthdayType = dto.birthdayType,
                Code         = dto.code,
                ComeFrom     = dto.comeFrom,
                CustomerType = dto.customerType,
                Description  = dto.description,
                Education    = dto.education,
                Email        = dto.email,
                Id           = dto.id,
                IdCardCode   = dto.idCardCode,
                Introducer   = dto.introducer,
                MobileNumber = dto.mobileNumber,
                Name         = dto.name,
                Nationality  = dto.nationality,
                PassWord     = dto.passWord,
                PictureUrl   = dto.pictureUrl,
                QQ           = dto.QQ,
                Sex          = dto.sex,
                UserId       = dto.userId,
                WeChat       = dto.WeChat
            };

            if (dto.userRoleIds != null)
            {
                foreach (var item in dto.userRoleIds)
                {
                    vm.UserRoleIds.Add(item);
                }
            }
            if (dto.permissionIds != null)
            {
                foreach (var item in dto.permissionIds)
                {
                    vm.PermissionIds.Add(item);
                }
            }
            if (dto.salesmen != null)
            {
                foreach (var p in dto.salesmen)
                {
                    var e = new EntityVMBase()
                    {
                        Code = p.code, Description = p.description, Id = p.id, Name = p.name
                    };
                    vm.Salesmen.Add(e);
                }
            }
            if (dto.advisors != null)
            {
                foreach (var p in dto.advisors)
                {
                    var e = new EntityVMBase()
                    {
                        Code = p.code, Description = p.description, Id = p.id, Name = p.name
                    };
                    vm.Advisors.Add(e);
                }
            }
            return(vm);
        }
Пример #28
0
 public static CustomerDto ToDto(this customer entity) => Mapper.Map <CustomerDto>(entity);
Пример #29
0
            private void GetReportPageBaseData()
            {
                m_IsEmpty = false;
                if (this.gridView1.DataRowCount == null || this.gridView1.DataRowCount < 1) {
                    BrightVision.Common.UI.NotificationDialog.Information("Reports", "No data to preview.");
                    m_IsEmpty = true;
                    return;
                }

                using (BrightPlatformEntities _efDbModel = new BrightPlatformEntities(m_DatabaseConnection) { CommandTimeout = 0 }) {
                    m_eftConfigData = _efDbModel.view_configuration.FirstOrDefault(i => i.id == m_ViewConfigId);
                    m_eftSubCampaign = _efDbModel.subcampaigns.FirstOrDefault(i => i.id == m_eftConfigData.subcampaign_id);
                    m_eftCampaign = _efDbModel.campaigns.FirstOrDefault(i => i.id == m_eftSubCampaign.campaign_id);
                    m_eftCustomer = _efDbModel.customers.FirstOrDefault(i => i.id == m_eftCampaign.customer_id);
                    _efDbModel.Detach(m_eftConfigData);
                    _efDbModel.Detach(m_eftSubCampaign);
                    _efDbModel.Detach(m_eftCampaign);
                    _efDbModel.Detach(m_eftCustomer);
                    _efDbModel.FIUpdateContactTitles();

                    /**
                     * if send email, get data for sub_campaign_account_list and final_list.
                     */
                    if (m_CallingEnvironment == eCallingEnvironment.BrightSales_SendEmail && m_AccountId > 0) {
                        m_eftFinalList = _efDbModel.final_lists.FirstOrDefault(i => i.sub_campaign_id == m_eftSubCampaign.id);
                        if (m_eftFinalList != null) {
                            _efDbModel.Detach(m_eftFinalList);
                            m_eftSubCampaignAccountList = _efDbModel.sub_campaign_account_lists.FirstOrDefault(i =>
                                i.final_list_id == m_eftFinalList.id &&
                                i.account_id == m_AccountId
                            );
                                _efDbModel.Detach(m_eftSubCampaignAccountList);
                        }
                    }
                }

                if (m_eftConfigData == null || m_eftConfigData.report_layout_config == null) {
                    WaitDialog.Close();
                    if (m_IsWebPortalCall)
                        throw new Exception("No layout available for the selected view.");

                    BrightVision.Common.UI.NotificationDialog.Information("Reports", "No layout available for this view.");
                    return;
                }

                if (string.IsNullOrEmpty(m_eftConfigData.report_data_config)) {
                    WaitDialog.Close();
                    if (m_IsWebPortalCall)
                        throw new Exception("No parameter layout has been set for this report.");

                    BrightVision.Common.UI.NotificationDialog.Information("Reports", "No parameter layout has been set for this report.");
                    return;
                }

                m_ReportPageTemplateProperty = SerializeUtility.DeserializeFromXml<TemplateProperty>(m_eftConfigData.report_data_config);
                m_ReportPageDataSet = this.GetReportDataSet(m_ReportPageTemplateProperty);

                /**
                 * if has sort info, then apply.
                 */
                #region Sorting Logic
                if (!string.IsNullOrEmpty(m_GridSortInfo)) {
                    string sortExpression = this.GetSortExpression(gridView1);
                    if (!string.IsNullOrEmpty(sortExpression)) {
                        string[] _SortInfoCollection = sortExpression.Split(';');

                        ReportDataSet _rdsTemporary = (ReportDataSet)m_ReportPageDataSet.Clone();
                        DataSet _dsSortedData = new DataSet();
                        Dictionary<string, List<string>> _TableSortRules = new Dictionary<string, List<string>>();

                        /**
                         * group all sort rules by table.
                         */
                        foreach (string _SortInfo in _SortInfoCollection) {
                            string[] _item = _SortInfo.Split('|');
                            string _FieldNameInfo = this.GetTableFieldName(_item[0].ToString());
                            if (!string.IsNullOrEmpty(_FieldNameInfo)) {
                                string[] _val = _FieldNameInfo.Split('|');
                                string _TableName = _val[0];
                                string _FieldName = _val[1];

                                /**
                                 * create new table sort rule.
                                 * else, update existing table sort rule.
                                 *
                                 * format:
                                 * <column_name1>|<sort_rule1>;<column_name2>|<sort_rule2>; and so on ...
                                 *
                                 * this would later be processed by splitting the sort rules by semicolon(;),
                                 * then split by bar(|).
                                 */
                                string _ColumnName = m_ReportPageDataSet.Tables[_TableName].Columns[_FieldName].ColumnName;
                                string _SortOrder = _item[1].ToString();
                                if (!_TableSortRules.ContainsKey(_TableName))
                                    _TableSortRules.Add(_TableName, new List<string>());

                                _TableSortRules[_TableName].Add(string.Format("{0} {1}", _ColumnName, _SortOrder));
                            }
                        }

                        /**
                         * set the sorting rules from KeyValuePair<string, List<string>> from _TableSortRules
                         * string = table name
                         * List<string> = sort rules
                         */
                        foreach (KeyValuePair<string, List<string>> _pair in _TableSortRules) {
                            DataTable _dtToSort = m_ReportPageDataSet.Tables[_pair.Key];
                            _dtToSort.DefaultView.Sort = string.Join(",", _TableSortRules[_pair.Key].ToArray());
                            _dsSortedData.Tables.Add(_dtToSort.DefaultView.ToTable());
                        }

                        /**
                         * copy all tables to the temporary report data set.
                         * then overwrite the original report data set with the
                         * temporary report dataset, since it contains the sorted
                         * tables that the report needs.
                         *
                         * order of the tables, according to relationship:
                         * 1. account
                         * 2. accountdynamic
                         * 3. accountstatic
                         * 4. contact
                         * 5. contactdynamic
                         * 6. contactstatic
                         * 7. clientinfo
                         * 8. customers
                         */
                        if (_dsSortedData.Tables["account"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["account"].Rows, "account");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["account"].Rows, "account");

                        if (_dsSortedData.Tables["accountdynamic"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["accountdynamic"].Rows, "accountdynamic");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["accountdynamic"].Rows, "accountdynamic");

                        if (_dsSortedData.Tables["accountstatic"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["accountstatic"].Rows, "accountstatic");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["accountstatic"].Rows, "accountstatic");

                        if (_dsSortedData.Tables["contact"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["contact"].Rows, "contact");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["contact"].Rows, "contact");

                        if (_dsSortedData.Tables["contactdynamic"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["contactdynamic"].Rows, "contactdynamic");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["contactdynamic"].Rows, "contactdynamic");

                        if (_dsSortedData.Tables["contactstatic"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["contactstatic"].Rows, "contactstatic");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["contactstatic"].Rows, "contactstatic");

                        if (_dsSortedData.Tables["clientinfo"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["clientinfo"].Rows, "clientinfo");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["clientinfo"].Rows, "clientinfo");

                        if (_dsSortedData.Tables["customers"] != null)
                            this.CopyTableRows(ref _rdsTemporary, _dsSortedData.Tables["customers"].Rows, "customers");
                        else
                            this.CopyTableRows(ref _rdsTemporary, m_ReportPageDataSet.Tables["customers"].Rows, "customers");

                        m_ReportPageDataSet = null;
                        m_ReportPageDataSet = _rdsTemporary;
                    }
                }
                #endregion
            }
Пример #30
0
        public void PrintIO(invoiceoutheader ioh, List <invoiceoutdetail> IODetails, string taxStr, string podocID)
        {
            Dictionary <string, string> companyInfo = getCompanyInformation();

            string[] pos = ioh.TrackingNos.Split(';');
            int      b   = 0;

            int[] a   = (from s in pos where int.TryParse(s, out b) select b).ToArray();
            int   min = a.Min();

            string[] dates      = ioh.TrackingDates.Split(';');
            string   poStr      = "";
            string   billingAdd = "";

            //StringBuilder sb = new StringBuilder();
            for (int i = 0; i < pos.Length - 1; i++)
            {
                string   custPOStr = POPIHeaderDB.getCustomerPOAndDateForInvoiceOut(Convert.ToInt32(pos[i]), Convert.ToDateTime(dates[i]), podocID);
                string[] custPO    = custPOStr.Split(Main.delimiter1);
                if (Convert.ToInt32(pos[i]) == min)
                {
                    billingAdd = custPO[2];
                }
                poStr = poStr + "\n" + custPO[0] + " : " + custPO[1];
            }
            companybank cb         = CompanyBankDB.getCompBankDetailForIOPrint(ioh.BankAcReference);
            customer    custDetail = CustomerDB.getCustomerDetailForPO(ioh.ConsigneeID);

            string[] companyBillingAdd = CompanyAddressDB.getCompTopBillingAdd(Login.companyID);
            string   ConsgAdd          = "Consignee:\n" + custDetail.name + Main.delimiter2 + "\n" + custDetail.BillingAddress + "\n";
            string   buyer             = "Buyer:\n" + custDetail.name + Main.delimiter2 + "\n" + billingAdd + "\n";

            if (custDetail.StateName.ToString().Length != 0)
            {
                ConsgAdd = ConsgAdd + "Sate Name:" + custDetail.StateName;
                buyer    = buyer + "Sate Name:" + custDetail.StateName;
                if (custDetail.StateCode.ToString().Length != 0)
                {
                    ConsgAdd = ConsgAdd + " ,\nState Code:" + custDetail.StateCode;
                    buyer    = buyer + " ,\nState Code:" + custDetail.StateCode;
                }
            }
            else
            {
                if (custDetail.StateCode.ToString().Length != 0)
                {
                    ConsgAdd = ConsgAdd + "\nState Code:" + custDetail.StateCode;
                    buyer    = buyer + "\nState Code:" + custDetail.StateCode;
                }
            }
            //string buyer =
            if (custDetail.OfficeName.ToString().Length != 0)
            {
                ConsgAdd = ConsgAdd + "\nGST:" + custDetail.OfficeName; // For GST Code
                buyer    = buyer + "\nGST:" + custDetail.OfficeName;    // For GST Code
            }
            if (CustomerDB.getCustomerPANForInvoicePrint(ioh.ConsigneeID).Length != 0)
            {
                ConsgAdd = ConsgAdd + "\nPAN:" + custDetail.OfficeName; // For PAN Code
                buyer    = buyer + "\nPAN:" + custDetail.OfficeName;    // For PAN Code
            }

            string HeaderString = companyBillingAdd[0] + Main.delimiter2 + "\n" + companyBillingAdd[1] + "\nGST:" + companyInfo["GST"] + "\nCIN:" + companyInfo["CIN"] + "\nPAN:" + companyInfo["PAN"] +
                                  Main.delimiter1 + "Invoice No : " + ioh.InvoiceNo + Main.delimiter1 + "Invoice Date: \n" + ioh.InvoiceDate.ToString("dd-MM-yyyy") +
                                  Main.delimiter1 + "Buyer PO No/Date:" + poStr + Main.delimiter1 +
                                  ConsgAdd +
                                  Main.delimiter1 + "Delivery Note No:\n" + "  " + Main.delimiter1 + "Delivery Note Date:\n" + "  " +
                                  Main.delimiter1 + "Mode/Terms Of Payment:\n" + ioh.TermsOfPayment + Main.delimiter1 +
                                  buyer +
                                  Main.delimiter1 + "Dispatch Through:\n" + ioh.TransportationType + Main.delimiter1 +
                                  "Terms of Delivery:\n" + "  ";
            string footer1   = "Amount In Words\n\n";
            string ColHeader = "SI No.;Description of Goods;HSN;Quantity;Unit;Unit Rate;Amount";
            string footer2   = "\n\nBank : " + cb.BankName + "\nBranch : " + cb.BranchName + "\nAC Type : " + cb.AccountType + "\nAC No : " +
                               cb.AccountCode + "\nSWIFT Code : " + cb.CompanyID + "\nIFSC Code : " + cb.CreateUser;
            string footer3 = "For Cellcomm Solution Limited;Authorised Signatory";
            //string termsAndCond = getTCString(poh.TermsAndCondition);
            double totQuant        = 0.00;
            double totAmnt         = 0.00;
            int    n               = 1;
            string ColDetailString = "";
            var    count           = IODetails.Count();
            string HSNCode         = "";

            foreach (invoiceoutdetail iod in IODetails)
            {
                if ((ioh.DocumentID == "SERVICEINVOICEOUT") || (ioh.DocumentID == "SERVICEEXPORTINVOICEOUT"))
                {
                    HSNCode = ServiceHSNMappingDB.getHSNCode(iod.StockItemID);
                }
                else
                {
                    HSNCode = ProductHSNMappingDB.getHSNCode(iod.StockItemID, iod.ModelNo);
                }
                //+ : main.delimiter1
                if (n == count)
                {
                    //ColDetailString = ColDetailString + n + "+" + iod.CustomerItemDescription + "+" + HSNCode + "+" + iod.Quantity + "+"
                    //                  + iod.Unit + "+" + iod.Price + "+" + (iod.Quantity * iod.Price);
                    ColDetailString = ColDetailString + n + Main.delimiter1 + iod.CustomerItemDescription + Main.delimiter1 + HSNCode + Main.delimiter1 + iod.Quantity + Main.delimiter1
                                      + iod.Unit + Main.delimiter1 + iod.Price + Main.delimiter1 + (iod.Quantity * iod.Price);
                    if (iod.Tax != 0)
                    {
                        //ColDetailString = ColDetailString + Main.delimiter2 + "" + "+" + iod.TaxCode + "+" + "" + "+"
                        //              + "" + "+" + "" + "+" + "" + "+" + iod.Tax;
                        ColDetailString = ColDetailString + Main.delimiter2 + "" + Main.delimiter1 + iod.TaxCode + Main.delimiter1 + "" + Main.delimiter1
                                          + "" + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + iod.Tax;
                    }
                }
                else
                {
                    ColDetailString = ColDetailString + n + Main.delimiter1 + iod.CustomerItemDescription + Main.delimiter1 + HSNCode + Main.delimiter1 + iod.Quantity + Main.delimiter1
                                      + iod.Unit + Main.delimiter1 + iod.Price + Main.delimiter1 + (iod.Quantity * iod.Price) + Main.delimiter2;
                    if (iod.Tax != 0)
                    {
                        //ColDetailString = ColDetailString + "" + "+" + iod.TaxCode + "+" + "" + "+"
                        //              + "" + "+" + "" + "+" + "" + "+" + iod.Tax + Main.delimiter2;
                        ColDetailString = ColDetailString + "" + Main.delimiter1 + iod.TaxCode + Main.delimiter1 + "" + Main.delimiter1
                                          + "" + Main.delimiter1 + "" + Main.delimiter1 + "" + Main.delimiter1 + iod.Tax + Main.delimiter2;
                    }
                }
                totQuant = totQuant + iod.Quantity;
                totAmnt  = totAmnt + (iod.Quantity * iod.Price);
                n++;
            }
            try
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Title            = "Save As PDF";
                sfd.Filter           = "Pdf files (*.Pdf)|*.pdf";
                sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                sfd.FileName         = ioh.DocumentID + "-" + ioh.InvoiceNo;

                if (sfd.ShowDialog() == DialogResult.Cancel || sfd.FileName == "")
                {
                    return;
                }
                FileStream fs  = new FileStream(sfd.FileName + ".pdf", FileMode.Create, FileAccess.Write);
                Rectangle  rec = new Rectangle(PageSize.A4);
                iTextSharp.text.Document doc = new iTextSharp.text.Document(rec);
                PdfWriter writer             = PdfWriter.GetInstance(doc, fs);
                MyEvent   evnt = new MyEvent();
                writer.PageEvent = evnt;

                doc.Open();
                Font   font1 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
                Font   font2 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                Font   font3 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.ITALIC, BaseColor.BLACK);
                String URL   = "Cellcomm2.JPG";
                iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(URL);
                img.Alignment = Element.ALIGN_LEFT;
                Paragraph paragraph = new Paragraph(new Phrase("Tax Invoice", font2));
                paragraph.Alignment = Element.ALIGN_CENTER;

                PrintPurchaseOrder prog      = new PrintPurchaseOrder();
                string[]           HeaderStr = HeaderString.Split(Main.delimiter1);

                PdfPTable table = new PdfPTable(7);

                table.SpacingBefore   = 20f;
                table.WidthPercentage = 100;
                float[] HWidths = new float[] { 0.5f, 8f, 1.5f, 2f, 1.5f, 2f, 3f };
                table.SetWidths(HWidths);
                PdfPCell cell;
                int[]    arr = { 3, 7, 9, 10 };
                float    wid = 0;
                for (int i = 0; i < HeaderStr.Length; i++)
                {
                    if (i == 0 || i == 4 || i == 8)
                    {
                        string[] format = HeaderStr[i].Split(Main.delimiter2);
                        Phrase   phr    = new Phrase();
                        phr.Add(new Chunk(format[0], font2));
                        phr.Add(new Chunk(format[1], font1));
                        //cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1));
                        cell                     = new PdfPCell(phr);
                        cell.Rowspan             = 2;
                        cell.Colspan             = 2;
                        cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
                        //wid = cell.MinimumHeight / 2;
                        table.AddCell(cell);
                    }
                    else if (arr.Contains(i))
                    {
                        cell               = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1));
                        cell.Colspan       = 5;
                        cell.MinimumHeight = wid;
                        table.AddCell(cell);
                    }
                    else
                    {
                        cell = new PdfPCell(new Phrase(HeaderStr[i].Trim(), font1));
                        if (i % 2 != 0)
                        {
                            cell.Colspan = 3;
                        }
                        else
                        {
                            cell.Colspan = 2;
                        }
                        table.AddCell(cell);
                    }
                }
                string[] ColHeaderStr = ColHeader.Split(';');

                PdfPTable table1 = new PdfPTable(7);
                table1.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                table1.WidthPercentage = 100;
                float[] width = new float[] { 0.5f, 8f, 1.5f, 2f, 1.5f, 2f, 3f };
                table1.SetWidths(width);

                for (int i = 0; i < ColHeaderStr.Length; i++)
                {
                    if (i == 5 || i == 6)
                    {
                        PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim() + "\n(" + ioh.CurrencyID + ")", font2));
                        hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                        table1.AddCell(hcell);
                    }
                    else
                    {
                        PdfPCell hcell = new PdfPCell(new Phrase(ColHeaderStr[i].Trim(), font2));
                        hcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                        table1.AddCell(hcell);
                    }
                }
                //---
                PdfPCell foot = new PdfPCell(new Phrase(""));
                foot.Colspan        = 7;
                foot.BorderWidthTop = 0;
                foot.MinimumHeight  = 0.5f;
                table1.AddCell(foot);

                table1.HeaderRows = 2;
                table1.FooterRows = 1;

                table1.SkipFirstHeader = false;
                table1.SkipLastFooter  = true;
                //---
                int     track = 0;
                decimal dc1   = 0;
                decimal dc2   = 0;

                string[] DetailStr = ColDetailString.Split(Main.delimiter2);
                float    hg        = 0f;
                for (int i = 0; i < DetailStr.Length; i++)
                {
                    track = 0;
                    hg    = table1.GetRowHeight(i + 1);
                    string[] str = DetailStr[i].Split(Main.delimiter1);
                    for (int j = 0; j < str.Length; j++)
                    {
                        PdfPCell pcell;
                        if (j == 3 || j == 5 || j == 6)
                        {
                            decimal p = 1;
                            if (Decimal.TryParse(str[j], out p))
                            {
                                pcell = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(str[j])), font1));
                            }
                            else
                            {
                                pcell = new PdfPCell(new Phrase(""));
                            }
                            pcell.Border = 0;
                            if (j == 6)
                            {
                                if (str[0].Length == 0)
                                {
                                    pcell.BorderWidthBottom = 0.01f;
                                    track = 1;
                                    dc2   = Convert.ToDecimal(str[j]);
                                }
                                else
                                {
                                    dc1 = Convert.ToDecimal(str[j]);
                                }
                            }
                        }
                        else
                        {
                            if (j == 2)
                            {
                                if (str[j].Trim().Length == 0)
                                {
                                    pcell = new PdfPCell(new Phrase("", font1));
                                }
                                else
                                {
                                    pcell = new PdfPCell(new Phrase(str[j], font1));
                                }
                            }
                            else if (j == 4)
                            {
                                int m = 1;
                                if (Int32.TryParse(str[j], out m) == true)
                                {
                                    if (Convert.ToInt32(str[j]) == 0)
                                    {
                                        pcell = new PdfPCell(new Phrase("", font1));
                                    }
                                    else
                                    {
                                        pcell = new PdfPCell(new Phrase(str[j], font1));
                                    }
                                }
                                else
                                {
                                    pcell = new PdfPCell(new Phrase(str[j], font1));
                                }
                            }
                            else
                            {
                                pcell = new PdfPCell(new Phrase(str[j], font1));
                            }
                            pcell.Border = 0;
                        }
                        //pcell.Border = 0;
                        //if (i == DetailStr.Length - 1)
                        //{
                        //    pcell.MinimumHeight = 50;
                        //}
                        //else
                        pcell.MinimumHeight = 10;
                        //pcell.MinimumHeight = 20;
                        if (j == 1)
                        {
                            pcell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                        }
                        else
                        {
                            pcell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                        }
                        pcell.BorderWidthLeft  = 0.01f;
                        pcell.BorderWidthRight = 0.01f;
                        table1.AddCell(pcell);
                    }
                    if (track == 1)
                    {
                        for (int j = 0; j < 7; j++)
                        {
                            PdfPCell pcell1;

                            if (j == 6)
                            {
                                pcell1                   = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(dc1 + dc2)), font1));
                                pcell1.Border            = 0;
                                pcell1.BorderWidthBottom = 0.01f;
                            }
                            else
                            {
                                pcell1        = new PdfPCell(new Phrase(""));
                                pcell1.Border = 0;
                            }
                            pcell1.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                            pcell1.BorderWidthLeft     = 0.01f;
                            pcell1.BorderWidthRight    = 0.01f;
                            table1.AddCell(pcell1);
                        }
                    }
                }
                table1.AddCell("");
                table1.AddCell(new Phrase("Total", font1));
                //table1.AddCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(totQuant)), font1));
                table1.AddCell("");
                table1.AddCell("");
                table1.AddCell("");
                //totAmnt = totAmnt + dd;
                table1.AddCell("");
                table1.AddCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(ioh.InvoiceAmount)), font1));

                string   total  = footer1 + NumberToString.convert(ioh.InvoiceAmount.ToString()).Replace("Indian Rupees", ioh.CurrencyID) + "\n\n";
                PdfPCell fcell1 = new PdfPCell(new Phrase((total), font1));
                fcell1.Colspan             = 6;
                fcell1.MinimumHeight       = 50;
                fcell1.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                fcell1.BorderWidthBottom   = 0;
                fcell1.BorderWidthRight    = 0;
                fcell1.BorderWidthTop      = 0;
                table1.AddCell(fcell1);

                PdfPCell fcell4 = new PdfPCell(new Phrase("E. & O.E", font1));
                //fcell4.MinimumHeight = 50;
                fcell4.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                fcell4.BorderWidthBottom   = 0;
                //fcell4.BorderWidthRight = 0;
                fcell4.BorderWidthLeft = 0;
                fcell4.BorderWidthTop  = 0;
                table1.AddCell(fcell4);

                PdfPCell pcelNo = new PdfPCell(new Phrase("", font1));
                pcelNo.BorderWidthTop   = 0;
                pcelNo.BorderWidthRight = 0;
                table1.AddCell(pcelNo);

                Phrase phrs = new Phrase();
                phrs.Add(new Chunk("Bank Details", font2));
                phrs.Add(new Chunk(footer2, font1));
                //PdfPCell fcell2 = new PdfPCell(new Phrase(footer2, font1));
                PdfPCell fcell2 = new PdfPCell(phrs);
                fcell2.HorizontalAlignment = PdfPCell.ALIGN_MIDDLE;
                //fcell2.BorderWidthTop = 0;
                //fcell2.BorderWidthRight = 0;
                table1.AddCell(fcell2);

                PdfPCell pcelMid = new PdfPCell(new Phrase("", font1));
                pcelMid.Colspan = 3;
                //pcelMid.Border = 0;
                pcelMid.BorderWidthTop   = 0;
                pcelMid.BorderWidthLeft  = 0;
                pcelMid.BorderWidthRight = 0;
                table1.AddCell(pcelMid);

                string[] ft = footer3.Split(';');

                PdfPCell fcell3 = new PdfPCell();
                Chunk    ch1    = new Chunk(ft[0], font1);
                Chunk    ch2    = new Chunk(ft[1], font1);
                Phrase   phrase = new Phrase();
                phrase.Add(ch1);
                for (int i = 0; i < 3; i++)
                {
                    phrase.Add(Chunk.NEWLINE);
                }
                phrase.Add(ch2);

                Paragraph para = new Paragraph();
                para.Add(phrase);
                para.Alignment = Element.ALIGN_RIGHT;
                fcell3.AddElement(para);
                fcell3.Border            = 0;
                fcell3.Colspan           = 3;
                fcell3.BorderWidthTop    = 0f;
                fcell3.BorderWidthLeft   = 0f;
                fcell3.BorderWidthRight  = 0.5f;
                fcell3.BorderWidthBottom = 0.5f;
                fcell3.MinimumHeight     = 50;
                table1.AddCell(fcell3);
                table1.KeepRowsTogether(table1.Rows.Count - 4, table1.Rows.Count);
                //-------------------------
                double    dd     = 0;
                PdfPTable taxTab = new PdfPTable(3);
                taxTab.WidthPercentage = 100;

                float[] twidth = new float[] { 3f, 3f, 10f };
                taxTab.SetWidths(twidth);
                if (ioh.TaxAmount != 0)
                {
                    PdfPCell pcell;
                    pcell = new PdfPCell(new Phrase("Tax Details", font2));
                    taxTab.AddCell(pcell);
                    PdfPCell pcellc = new PdfPCell(new Phrase("Amount(" + ioh.CurrencyID + ")", font2));
                    taxTab.AddCell(pcellc);
                    PdfPCell pcelllst = new PdfPCell(new Phrase("", font1));
                    pcelllst.Border = 0;
                    taxTab.AddCell(pcelllst);

                    string[] tax = taxStr.Split(Main.delimiter2);
                    for (int i = 0; i < tax.Length - 1; i++)
                    {
                        string[] subtax = tax[i].Split(Main.delimiter1);
                        PdfPCell pcell1;
                        pcell1 = new PdfPCell(new Phrase(subtax[0], font1));
                        PdfPCell pcell2;
                        pcell2 = new PdfPCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(subtax[1])), font1));
                        PdfPCell pcell3 = new PdfPCell(new Phrase("", font1));
                        pcell3.Border = 0;
                        taxTab.AddCell(pcell1);
                        taxTab.AddCell(pcell2);
                        taxTab.AddCell(pcell3);
                    }
                    taxTab.AddCell(new Phrase("Total Tax Amount", font2));
                    taxTab.AddCell(new Phrase(String.Format("{0:0.00}", Convert.ToDecimal(ioh.TaxAmount)), font2));
                    PdfPCell pcellt = new PdfPCell(new Phrase("", font1));
                    pcellt.Border = 0;
                    taxTab.AddCell(pcellt);
                    taxTab.KeepTogether  = true;
                    taxTab.SpacingAfter  = 2f;
                    taxTab.SpacingBefore = 3f;
                }
                //PdfPTable TCTab = new PdfPTable(2); ;
                //if (poh.TermsAndCondition.Trim().Length != 0)
                //{
                //    Chunk TCchunk = new Chunk("Terms And Conditoins:\n", font2);
                //    TCchunk.SetUnderline(0.2f, -2f);
                //    TCTab = new PdfPTable(2);
                //    TCTab.WidthPercentage = 100;
                //    PdfPCell TCCell = new PdfPCell();
                //    TCCell.Colspan = 2;
                //    TCCell.Border = 0;
                //    TCCell.AddElement(TCchunk);
                //    TCTab.AddCell(TCCell);
                //    try
                //    {
                //        string[] ParaTC = termsAndCond.Split(Main.delimiter2);
                //        for (int i = 0; i < ParaTC.Length - 1; i++)
                //        {
                //            TCCell = new PdfPCell();
                //            TCCell.Colspan = 2;
                //            TCCell.Border = 0;
                //            Paragraph header = new Paragraph();
                //            Paragraph details = new Paragraph();
                //            details.IndentationLeft = 12f;
                //            details.IndentationRight = 12f;
                //            string paraHeaderStr = (i + 1) + ". " + ParaTC[i].Substring(0, ParaTC[i].IndexOf(Main.delimiter1)) + ":";
                //            string paraFooterStr = ParaTC[i].Substring(ParaTC[i].IndexOf(Main.delimiter1) + 1);
                //            header.Add(new Phrase(paraHeaderStr, font2));
                //            details.Add(new Phrase(paraFooterStr, font1));
                //            TCCell.AddElement(header);
                //            TCCell.AddElement(details);
                //            TCTab.AddCell(TCCell);
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString());
                //    }
                //    try
                //    {
                //        if (TCTab.Rows.Count >= 3)
                //        {
                //            TCTab.KeepRowsTogether(0, 3);
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString());
                //    }
                //}
                //doc.Add(jpg);
                doc.Add(img);
                doc.Add(paragraph);
                doc.Add(table);
                doc.Add(table1);
                if (ioh.TaxAmount != 0)
                {
                    doc.Add(taxTab);
                }
                //if(poh.TermsAndCondition.Trim().Length != 0)
                //    doc.Add(TCTab);
                doc.Close();
                MessageBox.Show("Saved Sucessfully.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error-" + ex.ToString());
                MessageBox.Show("Failed TO Save");
            }
        }
Пример #31
0
        public customer checkUser(customer customer)
        {
            SqlConnection con = null;

            try
            {
                con = connect("DBConnectionString");

                using (SqlCommand cmd = new SqlCommand("checkUserLog", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@email", customer.Email);
                    cmd.Parameters.AddWithValue("@password", customer.Password);
                    var returnParameter = cmd.Parameters.Add("@results", SqlDbType.Int);
                    returnParameter.Direction = ParameterDirection.ReturnValue;
                    cmd.ExecuteNonQuery();

                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        var result = returnParameter.Value;
                        if (result.Equals(1))
                        {
                            while (dr.Read())
                            {
                                if (dr["firstName"] != DBNull.Value)
                                {
                                    {
                                        customer.FirstName = (string)dr["firstName"];
                                        customer.SurName   = (string)dr["lastName"];
                                        customer.Gender    = (string)dr["gender"];
                                        //customer.Birthdate = (string)dr["dateOfBirth"];
                                        //customer.Birthdate = Convert.ToDateTime(dr["dateOfBirth"]);
                                        customer.Email        = (string)dr["mail"];
                                        customer.Password     = (string)dr["password"];
                                        customer.CategoryType = Convert.ToInt32(dr["CategorycategoryCode"]);
                                        //customer.RegistrationDate = (string)dr["registrationDate"];
                                        //customer.SportType = (string)dr["bodyType"];
                                        customer.Weight = Convert.ToDouble(dr["weight"]);
                                        customer.Height = Convert.ToInt32(dr["height"]);
                                    }
                                }
                            }
                        }
                        if (result.Equals(2))
                        {
                            while (dr.Read())
                            {
                                if (dr["firstName"] != DBNull.Value)
                                {
                                    {
                                        customer.FirstName = (string)dr["firstName"];
                                        customer.Password  = (string)dr["password"];
                                    }
                                }
                            }
                        }

                        if (result.Equals(2))
                        {
                            while (dr.Read())

                            {
                                customer.FirstName = (string)dr["firstName"];
                                customer.Password  = (string)dr["password"];
                            }
                        }

                        if (result.Equals(3))

                        {
                            customer.FirstName = "not exist";
                        }

                        return(customer);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
Пример #32
0
 public int AddCustomer(customer customer)
 {
     return(customerDal.AddCustomer(customer));
 }
Пример #33
0
 public BarCodeForm(customer c)
 {
     InitializeComponent();
     barCode.BarCode = c.barcode;
     lbCod.Text = c.barcode;
 }
Пример #34
0
        private void rgType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Validations.ValidatorCPFCNPJ validatorCPFCNPJ1 = new Validations.ValidatorCPFCNPJ();
            subPnData.Enabled = false;
            pnAddress.Enabled = false;
            int t = Convert.ToInt32(rgType.EditValue);

            if (t == 0)
            {
                lbCNPJ.Text          = "CNPJ:";
                lbCorporateName.Text = "Razão Social:";
                lbFantasyName.Text   = "Nome Fantasia:";
                lbIE.Text            = "IE:";

                tfCnpj.Properties.Mask.EditMask = "00.000.000/0000-00";
                if (validatorCPFCNPJ1 != null)
                {
                    validatorCPFCNPJ1.ErrorText = "O CNPJ informado é inválido.";
                }

                tfManager.Enabled         = true;
                tfDocumentManager.Enabled = true;
                tfPhoneManager.Enabled    = true;
            }
            else if (t == 1)
            {
                lbCNPJ.Text          = "CPF:";
                lbCorporateName.Text = "Nome:";
                lbFantasyName.Text   = "Sobrenome:";
                lbIE.Text            = "RG/IE:";

                if (validatorCPFCNPJ1 != null)
                {
                    validatorCPFCNPJ1.ErrorText = "O CPF informado é inválido.";
                }
                tfCnpj.Properties.Mask.EditMask = "000.000.000-00";

                tfManager.Enabled         = false;
                tfDocumentManager.Enabled = false;
                tfPhoneManager.Enabled    = false;
            }

            tfCnpj.EditValue          = null;
            tfIE.EditValue            = null;
            tfCorporateName.EditValue = null;
            tfFantasyName.EditValue   = null;

            tfCnpj.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Simple;
            subPnData.Enabled = true;
            pnAddress.Enabled = true;

            this.validator.SetValidationRule(this.tfCnpj, validatorCPFCNPJ1);

            customer c = ((customer)bdgCustomer.Current);

            c.manager              = "";
            c.document_manager     = "";
            c.contact_manager      = "";
            bdgCustomer.DataSource = c;

            tfCnpj.Focus();
            tfCnpj.SelectAll();
        }
Пример #35
0
        public customer GetSupplier(string companyid, string supplierid, string creatorid)
        {
            customer Supplier = new customer();

            try
            {
                Supplier = appclient.GetSupplier(companyid, supplierid, creatorid);
            }
            catch (Exception getSupplierException)
            {
                string getSupplierExceptionMessage = getSupplierException.Message;
            }
            return Supplier;
        }
        public ActionResult UpdateUserdata(int id, FormCollection fc)
        {
            int a = 0;

            try
            {
                customer cus = Ad.customers.Where(c => c.Customer_Id == id).Single();

                if (cus.Shop_name == null)
                {
                    a = 1;
                    ViewBag.listProduct = Ad.customers.ToList();
                    cus.E_mail          = fc["Email"];
                    cus.Username        = fc["Username"];
                    cus.Fullname        = fc["Fullname"];
                    cus.Phone_No        = fc["Tel"];
                    cus.Address         = fc["Address"];
                    Ad.SaveChanges();
                }
                else
                {
                    ViewBag.listProduct = Ad.customers.Where(c => c.Shop_name != null).ToList();
                    cus.E_mail          = fc["Email"];
                    cus.Username        = fc["Username"];
                    cus.Fullname        = fc["Fullname"];
                    cus.Phone_No        = fc["Tel"];
                    cus.Address         = fc["Address"];
                    cus.Shop_name       = fc["Shop_name"];
                    cus.Name_Bank       = fc["Bank_Name"];
                    cus.Name_Owner      = fc["Bank_NameOwner"];
                    cus.Id_Bank         = fc["Bank_No"];
                    cus.Card_No         = fc["Credit_No"];
                    Ad.SaveChanges();
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }



            ViewData["ShowDataUser"] = Ad.customers.Where(c => c.Customer_Id == id).Single();
            Session["ShowDataUser"]  = "******";

            if (a == 1)
            {
                return(View("User"));
            }
            else
            {
                return(View("Shop"));
            }
        }
Пример #37
0
            private void btnShowReport_Click(object sender, EventArgs e)
            {
                WaitDialog.Show("Sending web service request ...");
                List<int> _SubCampaignIds = new List<int>();
                _SubCampaignIds.Add(m_SubCampaignId);

                using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                    _efDbContext.FIClearUserReuests(UserSession.CurrentUser.UserId);
                    m_eftConfigData = _efDbContext.view_configuration.FirstOrDefault(i => i.id == m_ViewConfigId);
                    m_eftSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_eftConfigData.subcampaign_id);
                    m_eftCampaign = _efDbContext.campaigns.FirstOrDefault(i => i.id == m_eftSubCampaign.campaign_id);
                    m_eftCustomer = _efDbContext.customers.FirstOrDefault(i => i.id == m_eftCampaign.customer_id);

                    _efDbContext.Detach(m_eftConfigData);
                    _efDbContext.Detach(m_eftSubCampaign);
                    _efDbContext.Detach(m_eftCampaign);
                    _efDbContext.Detach(m_eftCustomer);

                    Guid _RequestId = Guid.NewGuid();
                    string _GridSortInfo = this.GetSerializedSortInfo(gridView1.SortInfo);
                    string _ColumnsInfo = this.GetSerializedColumnsInfo();

                    serverside_report_requests _eftRequest = new serverside_report_requests() {
                        id = _RequestId,
                        calling_environment = (short)m_CallingEnvironment,
                        display_mode = (short)m_ViewType,
                        //calling_environment = (short)ReportsUtility.eCallingEnvironment.BrightSales_ViewDisplay,
                        //display_mode = (short)ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData,
                        campaign_info = string.Format("{0}>{1}>{2}",
                            m_eftCustomer.customer_name,
                            m_eftCampaign.campaign_name,
                            m_eftSubCampaign.title
                        ),
                        sub_campaign_ids = string.Join(",", _SubCampaignIds),
                        view_config_id = m_ViewConfigId,
                        account_id = 0,
                        active_filter_string = gridView1.ActiveFilterString,
                        sort_info = _GridSortInfo,
                        columns_info = _ColumnsInfo,
                        requested_by = UserSession.CurrentUser.UserId,
                        requested_on = DateTime.Now
                    };
                    _efDbContext.serverside_report_requests.AddObject(_eftRequest);
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftRequest);
                    ReportsUtility.SendReportRequest(_RequestId.ToString());
                }
                WaitDialog.Close();

                //WaitDialog.Show("Sending web service request ...");
                //using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                //    serverside_report_requests _eftRequest = new serverside_report_requests() {
                //        calling_environment = (short)ReportsUtility.eCallingEnvironment.BrightSales_ViewDisplay,
                //        display_mode = (short)ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData,
                //        campaign_info = m_CampaignInfo,
                //        //sub_campaign_ids = string.Join(",", pSubCampaignIds),
                //        view_config_id = m_ViewConfigId,
                //        account_id = 0,
                //        requested_by = UserSession.CurrentUser.UserId,
                //        requested_on = DateTime.Now
                //    };
                //    _efDbContext.serverside_report_requests.AddObject(_eftRequest);
                //    string _RequestId = _eftRequest.id.ToString();
                //    _efDbContext.Detach(_eftRequest);
                //    this.SendReportRequest(_RequestId);
                //}
                //WaitDialog.Close();

                //WaitDialog.Show("Loading report preview ...");
                //this.ReportPagePreview();
                //WaitDialog.Close();
            }
Пример #38
0
 public IHttpActionResult save(customer customer)
 {
     DB.customers.RemoveAll(c => c.id == customer.id);
     DB.customers.Add(customer);
     return(Ok(new result()));
 }
Пример #39
0
            private void btnSaveReportPerPdf_Click(object sender, EventArgs e)
            {
                WaitDialog.Show("Sending web service request ...");
                List<int> _SubCampaignIds = new List<int>();
                _SubCampaignIds.Add(m_SubCampaignId);

                using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                    m_eftConfigData = _efDbContext.view_configuration.FirstOrDefault(i => i.id == m_ViewConfigId);
                    m_eftSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_eftConfigData.subcampaign_id);
                    m_eftCampaign = _efDbContext.campaigns.FirstOrDefault(i => i.id == m_eftSubCampaign.campaign_id);
                    m_eftCustomer = _efDbContext.customers.FirstOrDefault(i => i.id == m_eftCampaign.customer_id);

                    _efDbContext.Detach(m_eftConfigData);
                    _efDbContext.Detach(m_eftSubCampaign);
                    _efDbContext.Detach(m_eftCampaign);
                    _efDbContext.Detach(m_eftCustomer);

                    string _GridSortInfo = this.GetSerializedSortInfo(gridView1.SortInfo);
                    string _ColumnsInfo = this.GetSerializedColumnsInfo();
                    short _CallingEnvironment = (short)(m_CallingApplication == eCallingApplication.BrightManager ? eCallingEnvironment.BrightManager_SaveAccountPerPdf : eCallingEnvironment.BrightSales_SaveAccountPerPdf);

                    Guid _RequestId = Guid.NewGuid();
                    serverside_report_requests _eftRequest = new serverside_report_requests() {
                        id = _RequestId,
                        calling_environment = _CallingEnvironment,
                        display_mode = (short)m_ViewType,
                        campaign_info = string.Format("{0}>{1}>{2}",
                            m_eftCustomer.customer_name,
                            m_eftCampaign.campaign_name,
                            m_eftSubCampaign.title
                        ),
                        sub_campaign_ids = string.Join(",", _SubCampaignIds),
                        view_config_id = m_ViewConfigId,
                        account_id = 0,
                        active_filter_string = gridView1.ActiveFilterString,
                        sort_info = _GridSortInfo,
                        columns_info = _ColumnsInfo,
                        requested_by = UserSession.CurrentUser.UserId,
                        requested_on = DateTime.Now
                    };
                    _efDbContext.serverside_report_requests.AddObject(_eftRequest);
                    _efDbContext.SaveChanges();
                    _efDbContext.Detach(_eftRequest);
                    ReportsUtility.CreatePdfFilesPerAccount(_RequestId.ToString());
                }
                WaitDialog.Close();

                //WaitDialog.Show("Generating PDF reports ...");
                //this.GenerateReports();
                //WaitDialog.Close();
            }
Пример #40
0
        public ActionResult Index(customer customer)
        {
            if (Session["user"] == null)
            {
                TempData["error2"] = "Bạn cần đăng nhập trước khi Order !.";
                return(RedirectToAction("Login", "Account"));
            }

            if (Session["Cart"] == null)
            {
                ViewBag.error = "Giỏ hàng của bạn đang trống !";
                return(Index());
            }
            if (ModelState.IsValid)
            {
                order order = new order
                {
                    customer_id = ((Session["user"] as customer).customer_id),
                    first_name  = customer.first_name,
                    last_name   = customer.last_name,
                    email       = customer.email,
                    //staff_id = 6,
                    phone        = customer.phone,
                    street       = customer.street,
                    city         = customer.city,
                    zip_code     = customer.zip_code,
                    order_status = false,
                    order_date   = DateTime.Now,
                    shipped_date = DateTime.Now.AddDays(4)
                };
                db.orders.Add(order);
                db.SaveChanges();
                List <CartItem> cart = (List <CartItem>)Session["Cart"];
                Xmail.XMail.Send(order.email, 1, 0, order, cart);
                List <staff> staff = db.staffs.ToList();
                foreach (var item in staff)
                {
                    Xmail.XMail.Send(item.email, 0, 0, order, cart);
                }
                ViewBag.success = "Đặt hàng thành công!";

                for (int i = 0; i < cart.Count; i++)
                {
                    order_items item = new order_items
                    {
                        order_id   = order.order_id,
                        product_id = cart[i].cart.product_id,
                        quantity   = cart[i].quantity,
                        list_price = cart[i].cart.list_price
                    };
                    product product = db.products.Find(cart[i].cart.product_id);
                    product.quantity = product.quantity - cart[i].quantity;
                    db.order_items.Add(item);
                    db.SaveChanges();
                }
                Session.Remove("Cart");
                return(Index());
            }
            else
            {
                return(Index());
            }
        }
Пример #41
0
            public static bool DocumentCustomerIsUnique(customer c)
            {
                try
                {
                    string s = TruckSystemRepo.GetInstance().ExecuteScalar<string>
                        ("SELECT COUNT(id) FROM customers WHERE document=@0", c.document);
                    int count;
                    if (s.Equals(DBNull.Value) || String.IsNullOrEmpty(s))
                        count = 0;
                    else
                        count = Convert.ToInt32(s);

                    if (count == 0)
                        return true;
                    else
                        return false;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message, ex.InnerException);
                }
            }
Пример #42
0
        private void testDoSale()
        {
            CustomerSalesServicesClient client = new CustomerSalesServicesClient();

            doSaleRequest request = new doSaleRequest();

            customer c = new customer();

            c.birthDate          = new DateTime(1984, 3, 3);
            c.birthDateSpecified = true;

            addressDTO add = new addressDTO();

            add.addressDetail     = "Rua 1";
            add.type              = addressType.RESIDENTIAL;
            add.typeSpecified     = true;
            add.addressNumber     = "123";
            add.addressPostalCode = "06871120";
            add.city              = "Embu";
            add.neighborhood      = "Marilú";
            add.state             = "SP";

            phoneDTO phone = new phoneDTO();

            phone.phoneNumber   = "1143216363";
            phone.type          = phoneType.RESIDENTIAL;
            phone.typeSpecified = true;

            c.fullName        = "Teste Abobrinha";
            c.gender          = gender.MALE;
            c.genderSpecified = true;

            identityDTO iden = new identityDTO();

            iden.documentType          = document.CPF;
            iden.documentTypeSpecified = true;
            iden.documentValue         = "40614102022";


            c.maritalStatus          = maritalStatus.SINGLE;
            c.maritalStatusSpecified = true;
            //criar novo contato para celular e repetir
            //cus.contacts[1].phone.phoneNumber = segurosuppro.Celular;
            //cus.contacts[1].phone.type = phoneType.MOBILE;

            cardPaymentDTO card = new cardPaymentDTO();

            card.cardDisplayName       = "THIAGO SANTANA";
            card.cardFlag              = "luiza";
            card.cardNumber            = "5307804589564512";
            card.cardSecurityCode      = "456";
            card.cardValidity          = new DateTime(1985, 1, 26);
            card.cardValiditySpecified = true;
            card.cardValue             = Convert.ToDecimal("19,90");
            card.cardValueSpecified    = true;

            productDTO prod = new productDTO();

            prod.descripton  = "CARTÃO PROTEGIDO";
            prod.ID          = 25;
            prod.IDSpecified = true;

            contactDTO cc = new contactDTO();

            cc.address = add;
            cc.phone   = phone;

            contactDTO[] contatos = new contactDTO[] { cc };
            c.contacts = contatos;
            c.identity = iden;

            paymentMethod payM = new paymentMethod();

            payM.cardPayment = card;

            identityDTO idensales = new identityDTO();

            idensales.documentType          = document.CPF;
            idensales.documentTypeSpecified = true;
            idensales.documentValue         = "10752104969";

            loginDTO log = new loginDTO();

            log.username = "******";
            log.password = "******";

            partner part = new partner();

            part.ID          = 001;
            part.IDSpecified = true;

            salesman salman = new salesman();

            salman.identity     = idensales;
            salman.login        = log;
            salman.partner      = part;
            salman.operatorName = "Saulo Mezencio";

            sale sa = new sale();

            sa.customer      = c;
            sa.paymentMethod = payM;
            sa.product       = prod;
            sa.salesman      = salman;

            request.sale = sa;

            doSaleResponse response = null;

            try {
                response = client.doSale(request);

                Console.WriteLine("Response = " + response);
                Console.WriteLine("PARANDO PARA VISUALIZAR JANELA");
            } catch (Microsoft.Web.Services3.ResponseProcessingException exR) {
                Console.WriteLine("Exception to call service FAULT: " + exR.Response.OuterXml);
                Console.WriteLine("PARANDO PARA VISUALIZAR JANELA ANTERIOR");
            }/* catch (Exception ex) {
              * Console.WriteLine("Exception : " + ex);
              * Console.WriteLine("PARANDO PARA VISUALIZAR JANELA");
              * }*/
        }
Пример #43
0
    /*
    ArrayList getEmptyCustomerIndexes()
    {
        ArrayList ec = new ArrayList();
        for (int i=0; i < 5; i++)
        {
            if (!customerList[i])
            {
                ec.Add(i);
            }
        }
        return ec;
    }*/
    public GameObject Spawn(string customerName, CustomerAI cAI)
    {
        //ArrayList emptyCustomers = getEmptyCustomerIndexes();

        //int i = randomCustomerIndexes.Dequeue();

        current_customer = cAI.customer;
        print("FOOD QUEUE:::::" + cAI.customer.foodQueue.Count);
        GameObject tempcustomer = Resources.Load("Customers/Peasants/customer") as GameObject;

        if (current_customer.type == "peasant")
        {
            print("foodqueue: " + current_customer.foodQueue.Count);
            tempcustomer.GetComponent<Customer>().foodQueue = current_customer.foodQueue;
            //tempcustomer.GetComponent<Customer>().current_food = findRecipe(current_customer.foodQueue.Dequeue());
        }

        else if (current_customer.type == "artisan")
        {
            print("foodqueue: " + current_customer.foodQueue.Count);
            tempcustomer.GetComponent<Customer>().foodQueue = current_customer.foodQueue;
            //tempcustomer.GetComponent<Customer>().current_food = findRecipe(current_customer.foodQueue.Dequeue());
        }

        if (CustomerAI.customerSat1 && customerName == "cus_1")// && emptyCustomers.Contains(0))
        {
            tempcustomer.GetComponent<nameAndPosition>().x = 6;
            tempcustomer.GetComponent<nameAndPosition>().y = 2;
            tempcustomer.transform.position = new Vector2(this.transform.position.x, this.transform.position.y + 1.0f);
            //tempcustomer.transform.position = new Vector3(9, 2, 0);
            customer1 = true;
        }
        else if (CustomerAI.customerSat2 && customerName == "cus_2")// && emptyCustomers.Contains(1))
        {
            tempcustomer.GetComponent<nameAndPosition>().x = 7;
            tempcustomer.GetComponent<nameAndPosition>().y = 2;
            tempcustomer.transform.position = new Vector2(this.transform.position.x, this.transform.position.y + 1.0f);
            //tempcustomer.transform.position = new Vector3(10.5f, 2, 0);
            customer2 = true;
        }
        else if (CustomerAI.customerSat3 && customerName == "cus_3")// && emptyCustomers.Contains(2))
        {
            tempcustomer.GetComponent<nameAndPosition>().x = 8;
            tempcustomer.GetComponent<nameAndPosition>().y = 2;
            tempcustomer.transform.position = new Vector2(this.transform.position.x, this.transform.position.y + 1.0f);
            //tempcustomer.transform.position = new Vector3(12, 2, 0);
            customer3 = true;
        }
        else if (CustomerAI.customerSat4 && customerName == "cus_4")// && emptyCustomers.Contains(3))
        {
            tempcustomer.GetComponent<nameAndPosition>().x = 9;
            tempcustomer.GetComponent<nameAndPosition>().y = 2;
            tempcustomer.transform.position = new Vector2(this.transform.position.x, this.transform.position.y + 1.0f);
            //tempcustomer.transform.position = new Vector3(13.5f, 2, 0);
            customer4 = true;
        }
        else if (CustomerAI.customerSat5 && customerName == "cus_5")// && emptyCustomers.Contains(4))
        {
            tempcustomer.GetComponent<nameAndPosition>().x = 10;
            tempcustomer.GetComponent<nameAndPosition>().y = 2;
            tempcustomer.transform.position = new Vector2(this.transform.position.x, this.transform.position.y + 1.0f);
            //tempcustomer.transform.position = new Vector3(15, 2, 0);
            customer5 = true;
        }

        return Instantiate(tempcustomer);

        /*
        for (int i = 0; i < 5; i++)
        {
            if (!customerList[i] && peasantFoodQueue.Count > 0)
            {
                //spawn
                GameObject tempcustomer = Resources.Load("Customers/Peasants/customer") as GameObject;

                tempcustomer.GetComponent<Customer>().current_food = findRecipe(peasantFoodQueue.Dequeue());
                if (i == 0)
                {
                    tempcustomer.GetComponent<nameAndPosition>().x = 6;
                    tempcustomer.GetComponent<nameAndPosition>().y = 2;
                    tempcustomer.transform.position = new Vector3(9, 2, 0);
                    customer1 = true;
                }
                else if (i == 1)
                {
                    tempcustomer.GetComponent<nameAndPosition>().x = 7;
                    tempcustomer.GetComponent<nameAndPosition>().y = 2;
                    tempcustomer.transform.position = new Vector3(10.5f, 2, 0);
                    customer2 = true;
                }
                else if (i == 2)
                {
                    tempcustomer.GetComponent<nameAndPosition>().x = 8;
                    tempcustomer.GetComponent<nameAndPosition>().y = 2;
                    tempcustomer.transform.position = new Vector3(12, 2, 0);
                    customer3 = true;
                }
                else if (i == 3)
                {
                    tempcustomer.GetComponent<nameAndPosition>().x = 9;
                    tempcustomer.GetComponent<nameAndPosition>().y = 2;
                    tempcustomer.transform.position = new Vector3(13.5f, 2, 0);
                    customer4 = true;
                }
                else if (i == 4)
                {
                    tempcustomer.GetComponent<nameAndPosition>().x = 10;
                    tempcustomer.GetComponent<nameAndPosition>().y = 2;
                    tempcustomer.transform.position = new Vector3(15, 2, 0);
                    customer5 = true;
                }
                customerList[i] = Instantiate(tempcustomer);
            }

        }
        */

        //OLD SPAWN
        /*
        if (!waitingForC1 && peasantFoodQueue.Count > 0)
        {
            _c1 = Instantiate(c1);
            _c1.GetComponent<Customer>().current_food = findRecipe(peasantFoodQueue.Dequeue());
            waitingForC1 = true;
        }
        if (!waitingForC2 && peasantFoodQueue.Count > 0)
        {
            _c2 = Instantiate(c2);
            _c2.GetComponent<Customer>().current_food = findRecipe(peasantFoodQueue.Dequeue());
            waitingForC2 = true;
        }*/
    }
Пример #44
0
        /// <summary>
        /// Processes the notification.
        /// </summary>
        /// <param name="xmlFile">The XML file.</param>
        /// <returns>Serial number of the notification</returns>
        public static string ProcessNotification(string xmlFile)
        {
            string conn = GetConnectionString();
            StoreDataClassesDataContext db = new StoreDataClassesDataContext(conn);
            string SerialNumber            = "";
            //Read XML file
            StreamReader strReader    = new StreamReader(xmlFile);
            string       requestedXml = strReader.ReadToEnd();

            //Act on XML file
            switch (EncodeHelper.GetTopElement(requestedXml))
            {
            case "new-order-notification":
                NewOrderNotification N1 = (NewOrderNotification)EncodeHelper.Deserialize(requestedXml, typeof(NewOrderNotification));
                ///This notification tells us that Google has accepted the order
                SerialNumber = N1.serialnumber;
                Int64  OrderNumber1    = Int64.Parse(N1.googleordernumber);
                int    pos             = N1.buyershippingaddress.contactname.IndexOf(" ");
                string ShipToFirstName = N1.buyershippingaddress.contactname.Substring(0, pos);
                string ShipToLatsName  = N1.buyershippingaddress.contactname.Substring(pos + 1);
                string UserName        = N1.shoppingcart.merchantprivatedata.Any[1].InnerText;
                int    internalOrderId = int.Parse(EncodeHelper.GetElementValue(requestedXml, "MERCHANT_DATA_HIDDEN"));

                order newOrder = db.orders.Where(o => o.order_id == internalOrderId).Single <order>();

                newOrder.google_order_number = OrderNumber1;
                newOrder.order_date          = N1.timestamp;
                newOrder.order_by            = UserName;
                newOrder.sub_total           = N1.ordertotal.Value;
                newOrder.total          = N1.ordertotal.Value;
                newOrder.charged_amount = 0;
                newOrder.status         = "NEW";
                newOrder.root_id        = 1;
                //newOrder.shipping_first_name = ShipToFirstName;
                //newOrder.shipping_last_name = ShipToLatsName;
                //newOrder.shipping_address = N1.buyershippingaddress.address1;
                //newOrder.shipping_city = N1.buyershippingaddress.city;
                //newOrder.shipping_state = N1.buyershippingaddress.region;
                //newOrder.shipping_zip = N1.buyershippingaddress.postalcode;
                //newOrder.shipping_country = N1.buyerbillingaddress.countrycode;

                db.SubmitChanges();
                db.orders.DeleteAllOnSubmit(db.orders.Where(o => (o.status == "TEMP" && o.order_by == UserName)));
                db.SubmitChanges();

                foreach (Item ThisItem in N1.shoppingcart.items)
                {
                    int     itemId   = int.Parse(ThisItem.merchantprivateitemdata.Any[0].InnerText);
                    string  desc     = ThisItem.itemdescription;
                    int     quantity = ThisItem.quantity;
                    decimal price    = ThisItem.unitprice.Value;
                    bool    tangible = false;
                    if (ThisItem.digitalcontent != null)
                    {
                        tangible = true;
                    }

                    order_item newItem = new order_item();
                    newItem.item_id   = itemId;
                    newItem.order_id  = internalOrderId;
                    newItem.price     = price;
                    newItem.qty       = quantity;
                    newItem.tangible  = tangible;
                    newItem.item_desc = desc;
                    newItem.item_name = ThisItem.itemname;

                    db.order_items.InsertOnSubmit(newItem);
                    db.SubmitChanges();
                }

                break;

            case "risk-information-notification":
                RiskInformationNotification N2 = (RiskInformationNotification)EncodeHelper.Deserialize(requestedXml, typeof(RiskInformationNotification));
                // This notification tells us that Google has authorized the order and it has passed the fraud check
                SerialNumber = N2.serialnumber;
                long   googleOrderNumber = Int64.Parse(N2.googleordernumber);
                string contactName       = EncodeHelper.GetElementValue(requestedXml, "contact-name");
                string email             = EncodeHelper.GetElementValue(requestedXml, "email");
                string city     = EncodeHelper.GetElementValue(requestedXml, "city");
                int    zip      = int.Parse(EncodeHelper.GetElementValue(requestedXml, "postal-code"));
                string country  = EncodeHelper.GetElementValue(requestedXml, "country-code");
                bool   elibible = N2.riskinformation.eligibleforprotection;
                char   cvn      = char.Parse(N2.riskinformation.cvnresponse);

                if (elibible && N2.riskinformation.cvnresponse == "M")
                {
                    customer newCustomer = new customer();
                    newCustomer.google_order_number = googleOrderNumber;
                    newCustomer.eligibility         = elibible;
                    newCustomer.contact_name        = contactName;
                    newCustomer.email     = email;
                    newCustomer.address   = N2.riskinformation.billingaddress.address1;
                    newCustomer.city      = city;
                    newCustomer.zip       = zip;
                    newCustomer.country   = country;
                    newCustomer.avs       = char.Parse(N2.riskinformation.avsresponse);
                    newCustomer.cvn       = cvn;
                    newCustomer.cc_number = int.Parse(N2.riskinformation.partialccnumber);
                    newCustomer.ip        = N2.riskinformation.ipaddress;

                    db.customers.InsertOnSubmit(newCustomer);
                    db.SubmitChanges();
                }
                else
                {
                    string reason  = "You did not pass Google security check!";
                    string comment = "Please visis http://checkout.google.com/support/sell/bin/topic.py?topic=15055 for more information";
                    GCheckout.OrderProcessing.CancelOrderRequest cancelReq = new GCheckout.OrderProcessing.CancelOrderRequest(N2.googleordernumber, reason, comment);
                    cancelReq.Send();
                }

                break;

            case "order-state-change-notification":
                OrderStateChangeNotification N3 = (OrderStateChangeNotification)EncodeHelper.Deserialize(requestedXml, typeof(OrderStateChangeNotification));
                // The order has changed either financial or fulfillment state in Google's system.
                SerialNumber = N3.serialnumber;
                long   googleOrderNumber1   = Int64.Parse(N3.googleordernumber);
                string newFinanceState      = N3.newfinancialorderstate.ToString();
                string newFulfillmentState  = N3.newfulfillmentorderstate.ToString();
                string prevFinanceState     = N3.previousfinancialorderstate.ToString();
                string prevFulfillmentState = N3.previousfulfillmentorderstate.ToString();

                order thisOrder1 = (from or in db.orders where or.google_order_number == googleOrderNumber1 select or).Single <order>();
                //if (newFinanceState == "CHARGEABLE")
                //{
                //    GCheckout.OrderProcessing.ChargeOrderRequest chargeReq = new GCheckout.OrderProcessing.ChargeOrderRequest(N3.googleordernumber);
                //    chargeReq.Send();
                //}
                thisOrder1.status = newFinanceState;
                if (newFulfillmentState == "WILL_NOT_DELIVER")
                {
                    thisOrder1.shipping_status = "CANCELLED";
                }
                else
                {
                    thisOrder1.shipping_status = newFulfillmentState;
                }
                db.SubmitChanges();
                break;

            case "charge-amount-notification":
                ChargeAmountNotification N4 = (ChargeAmountNotification)EncodeHelper.Deserialize(requestedXml, typeof(ChargeAmountNotification));
                // Google has successfully charged the customer's credit card.
                SerialNumber = N4.serialnumber;
                long    googleOrderNumber2 = Int64.Parse(N4.googleordernumber);
                decimal chargedAmount      = N4.latestchargeamount.Value;

                order thisOrder2 = (from or in db.orders where or.google_order_number == googleOrderNumber2 select or).Single <order>();
                thisOrder2.charged_amount += chargedAmount;
                thisOrder2.sub_total      -= chargedAmount;
                db.SubmitChanges();

                break;

            case "refund-amount-notification":
                RefundAmountNotification N5 = (RefundAmountNotification)EncodeHelper.Deserialize(requestedXml, typeof(RefundAmountNotification));
                // Google has successfully refunded the customer's credit card.
                SerialNumber = N5.serialnumber;
                long    googleOrderNumber3 = Int64.Parse(N5.googleordernumber);
                decimal refundedAmount     = N5.latestrefundamount.Value;

                order thisOrder3 = (from or in db.orders where or.google_order_number == googleOrderNumber3 select or).Single <order>();
                thisOrder3.status          = "REFUNDED";
                thisOrder3.charged_amount -= refundedAmount;
                db.SubmitChanges();

                break;

            case "chargeback-amount-notification":
                ChargebackAmountNotification N6 = (ChargebackAmountNotification)EncodeHelper.Deserialize(requestedXml, typeof(ChargebackAmountNotification));
                // A customer initiated a chargeback with his credit card company to get her money back.
                SerialNumber = N6.serialnumber;
                long    googleOrderNumber4 = Int64.Parse(N6.googleordernumber);
                decimal chargebackAmount   = N6.latestchargebackamount.Value;

                order thisOrder4 = (from or in db.orders where or.google_order_number == googleOrderNumber4 select or).Single <order>();
                thisOrder4.status = "CHARGEBACK";
                db.SubmitChanges();

                break;

            default:
                break;
            }

            strReader.Close();
            strReader.Dispose();
            return(SerialNumber);
        }
Пример #45
0
    void createCustomerQueue()
    {
        customer[] customerArray = new customer[numberofCustomers];
        print(numberofCustomers);
        int i = 0;
        if (numPeasants > 0)
        {
            foreach (customer c in peasantQueue)
            {
                customerArray[i] = c;
                i++;
            }
        }
        if (numArtisans > 0)
        {
            foreach (customer c in artisanQueue)
            {
                customerArray[i] = c;
                i++;
            }
        }
        if (numMiddle > 0)
        {
            foreach (customer c in middleQueue)
            {
                customerArray[i] = c;
                i++;
            }
        }
        if (numNobles > 0)
        {
            foreach (customer c in nobleQueue)
            {
                customerArray[i] = c;
                i++;
            }
        }
        if (numRoyals > 0)
        {
            print(numRoyals);
            foreach (customer c in royalQueue)
            {
                customerArray[i] = c;
                i++;
            }
        }
        //foreach customer in artisanqueue...etc
        shuffle_customers(customerArray);

        foreach (customer c in customerArray)
        {
            print("customer type: " + c.type);
            foreach (string s in c.foodQueue)
            {
                print("i want: " + s);
            }
            customerQueue.Enqueue(c);
        }

        GameObject.Find("Customer").GetComponent<CustomerList>().customerQ = new Queue<customer>(customerQueue); //clunky fix for sprites
    }
Пример #46
0
        public customer selectSingle(customer findItem)
        {
            customer selectedItem = db.customers.SingleOrDefault(item => item.id == findItem.id);

            return(selectedItem);
        }
Пример #47
0
 void shuffle_customers(customer[] c)
 {
     // Knuth shuffle algorithm :: courtesy of Wikipedia :)
     for (int t = 0; t < c.Length; t++)
     {
         customer tmp = c[t];
         int r = Random.Range(t, c.Length);
         c[t] = c[r];
         c[r] = tmp;
     }
 }
Пример #48
0
        void searchFreights()
        {
            try
            {
                SplashScreenManager.ShowForm(desk, typeof(PleaseWaitForm), false, false, false);
                List <freight> listF = new List <freight>();
                string         st    = "";

                if (Convert.ToInt64(tfId.EditValue) > 0 || Convert.ToInt64(cbTruck.EditValue) > 0 ||
                    Convert.ToInt32(tfNumberNote.EditValue) > 0 || (tfStart.EditValue != null && tfEnd.EditValue != null))
                {
                    st += "WHERE";
                }
                if (Convert.ToInt64(tfId.EditValue) > 0)
                {
                    st += String.Format(" id={0}", tfId.EditValue);
                }

                if (Convert.ToInt64(cbTruck.EditValue) > 0)
                {
                    if (Convert.ToInt64(tfId.EditValue) > 0)
                    {
                        st += " AND";
                    }
                    st += String.Format(" truck_id={0}", cbTruck.EditValue);
                }

                if (Convert.ToInt64(tfNumberNote.EditValue) > 0)
                {
                    if (Convert.ToInt64(tfId.EditValue) > 0 || Convert.ToInt64(cbTruck.EditValue) > 0)
                    {
                        st += " AND";
                    }
                    st += String.Format(" number_note={0}", tfNumberNote.EditValue);
                }

                if (tfStart.EditValue != null && tfEnd.EditValue != null)
                {
                    if (Convert.ToInt64(tfId.EditValue) > 0 || Convert.ToInt64(cbTruck.EditValue) > 0 ||
                        Convert.ToInt32(tfNumberNote.EditValue) > 0)
                    {
                        st += " AND";
                    }
                    st += String.Format(" start BETWEEN to_date('{0:yyyy-MM-dd}', 'yyyy-MM-dd') AND to_date('{1:yyyy-MM-dd}', 'yyyy-MM-dd')",
                                        tfStart.DateTime, tfEnd.DateTime);
                }
                st   += " ORDER BY start, id";
                listF = freight.Fetch(st);

                for (int i = 0; i < listF.Count; i++)
                {
                    freight  f    = listF[i];
                    customer cs   = customer.SingleOrDefault(f.company_source);
                    city     cacs = city.SingleOrDefault(address.SingleOrDefault(cs.address_id).city_id);
                    f.company_source_name = String.Format("{0}/{1}", cacs.name, cs.corporate_name);
                    customer cd   = customer.SingleOrDefault(f.company_destination);
                    city     cacd = city.SingleOrDefault(address.SingleOrDefault(cd.address_id).city_id);
                    f.company_destination_name = String.Format("{0}/{1}", cacd.name, cd.corporate_name);
                    f.truck_board = truck.SingleOrDefault(f.truck_id).board;
                    f.driver_name = driver.SingleOrDefault(f.driver_id).full_name;

                    decimal vgross  = ((f.weight * f.value_ton) + totalStays(f.id));
                    decimal fueleds = totalFueleds(f.id);
                    decimal outputs = totalOutputs(f.id);
                    f.value_gross = vgross;
                    f.total       = (vgross - f.value_comission) - (fueleds + outputs);
                    listF[i]      = f;
                }
                bdgFreights.DataSource = listF;
                SplashScreenManager.CloseForm(false);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(String.Format("Ocorreu um erro:\n\n{0}\n{1}", ex.Message, ex.InnerException));
            }
        }
Пример #49
0
 public static string GenerateCardCode(customer c)
 {
     string NC = c.name.Substring(0, 1).ToUpper();
     string Number = String.Format("{0:D8}", c.id);
     return String.Format("{0}{1}{2}", GetVersionCard(), NC, Number);
 }