Ejemplo n.º 1
0
        public SetCustomerSiteRequest(CustomerSite request)
        {
            CustomerID = request.CustomerID;
            WebAlias   = request.WebAlias;
            FirstName  = request.FirstName;
            LastName   = request.LastName;
            Company    = request.Company;

            Email  = request.Email;
            Phone  = request.PrimaryPhone;
            Phone2 = request.SecondaryPhone;
            Fax    = request.Fax;

            if (request.Address != null)
            {
                Address1 = request.Address.Address1;
                Address2 = request.Address.Address2;
                City     = request.Address.City;
                State    = request.Address.State;
                Zip      = request.Address.Zip;
                Country  = request.Address.Country;
            }

            Notes1 = request.Notes1;
            Notes2 = request.Notes2;
            Notes3 = request.Notes3;
            Notes4 = request.Notes4;
        }
        public async Task <IActionResult> PutCustomerSite([FromRoute] int id, [FromBody] CustomerSite customerSite)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customerSite.CustomerSiteId)
            {
                return(BadRequest());
            }

            _context.Entry(customerSite).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerSiteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostCustomerSite([FromBody] CustomerSite customerSite)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.CustomerSite.Add(customerSite);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CustomerSiteExists(customerSite.CustomerSiteId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCustomerSite", new { id = customerSite.CustomerSiteId }, customerSite));
        }
Ejemplo n.º 4
0
        public JsonNetResult UpdateWebsitePhoneNumbers(CustomerSite customersite)
        {
            var testa = Exigo.GetCustomerSite(Identity.Current.CustomerID);

            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID     = Identity.Current.CustomerID,
                PrimaryPhone   = customersite.PrimaryPhone,
                SecondaryPhone = customersite.SecondaryPhone
            });

            var testb = Exigo.GetCustomerSite(Identity.Current.CustomerID);

            var html = string.Format(@"
                " + Resources.Common.Primary + @": <strong>{0}</strong><br />
                " + Resources.Common.Secondary + @": <strong>{1}</strong>
                ", customersite.PrimaryPhone, customersite.SecondaryPhone);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsitePhoneNumbers",
                html = html
            }));
        }
Ejemplo n.º 5
0
        private static CustomerSite getEntityByModel(CustomerSiteModel model)
        {
            if (model == null)
            {
                return(null);
            }

            CustomerSite entity = new CustomerSite();

            if (model.Id == 0)
            {
                entity.CreateBy   = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy   = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }
            entity.CodeCombinationId = model.CodeCombinationId;
            entity.CustomerId        = model.CustomerId;
            entity.EndDate           = model.EndDate;
            entity.Id          = model.Id;
            entity.SiteAddress = model.SiteAddress;
            entity.SiteContact = model.SiteContact;
            entity.SiteName    = model.SiteName;
            entity.StartDate   = model.StartDate;
            entity.TaxCodeId   = model.TaxId;
            entity.UpdateBy    = AuthenticationHelper.UserId;
            entity.UpdateDate  = DateTime.Now;
            return(entity);
        }
    private async Task <ClaimsPrincipal> getClaims(CustomerSite user)
    {
        if (user == null)
        {
            throw new ArgumentNullException(nameof(user));
        }
        var userId = await _myUserManager.GetUserIdAsync(user);

        var userName = await _myUserManager.GetUserNameAsync(user);

        var id = new ClaimsIdentity();

        id.AddClaim(new Claim(JwtClaimTypes.Id, userId));
        id.AddClaim(new Claim(JwtClaimTypes.PreferredUserName, userName));

        var roles = await _myUserManager.GetRolesAsync(user);

        foreach (var roleName in roles)
        {
            id.AddClaim(new Claim(JwtClaimTypes.Role, roleName));
        }

        id.AddClaims(await _myUserManager.GetClaimsAsync(user));

        return(new ClaimsPrincipal(id));
    }
        public string Update(CustomerSite entity)
        {
            CustomerSite originalEntity = this.Context.CustomerSites.Find(entity.Id);

            this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
            this.Context.Entry(originalEntity).State = EntityState.Modified;
            this.Commit();
            return(entity.Id.ToString());
        }
Ejemplo n.º 8
0
    private static string BuildTitle(Task emailTask, IMTDService service)
    {
        string retVal = "";

        retVal = emailTask.Task_CID.GetExternalText() + "; ";

        Base.Attribute projectAttr = emailTask.Attributes.Find(CodeTranslator.Find("TASK_ATTR", "PROJECT"));
        if (projectAttr != null)
        {
            BaseExtendable project = new BaseExtendable(CodeTranslator.Find("ENTITY_TYPE", "PROJECT").Code_IID);
            project.Entity_IID = (int)projectAttr.Value;
            project            = (BaseExtendable)service.Load(project);
            service.LoadAttributes(project);

            Base.Attribute contactAttr = project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "CONTACT"));
            if (contactAttr != null)
            {
                Contact targetContact = new Contact((int)contactAttr.Value);
                targetContact = (Contact)service.Load(targetContact);
                retVal       += targetContact.Customer_Name + "; ";

                /*
                 * CustomerSite targetSite = new CustomerSite(targetContact.Site_IID);
                 * targetSite = (CustomerSite)service.Load(targetSite);
                 * Customer targetCustomer = new Customer(targetSite.Customer_IID);
                 * targetCustomer = (Customer)service.Load(targetCustomer);
                 * retVal += targetCustomer.Name + "; ";
                 */
            }

            retVal += project.Description + "; ";

            Base.Attribute projectNumAttr = project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "PROJECTNUM"));
            if (projectNumAttr != null)
            {
                retVal += "P#:" + (string)projectNumAttr.Value;
            }
            else
            {
                retVal += "Q#:" + project.OID;
            }
        }
        else
        {
            Base.Attribute prospectAttr = emailTask.Attributes.Find(CodeTranslator.Find("TASK_ATTR", "PROSPECT"));
            if (prospectAttr != null)
            {
                int          prospectIID = (int)prospectAttr.Value;
                Prospect     propect     = service.LoadProspect(prospectIID);
                CustomerSite site        = service.LoadCustomerSite(propect.Site_IID);
                Customer     cust        = service.LoadCustomer(site.Customer_IID);
                retVal += " " + propect.First_Name + " " + propect.Last_Name + " (" + cust.Name + ")";
            }
        }

        return(retVal);
    }
        public CustomerSite GetSingle(string id, long companyId)
        {
            long         longId   = Convert.ToInt64(id);
            CustomerSite custSite = (from a in this.Context.CustomerSites
                                     join b in this.Context.Customers on a.CustomerId equals b.Id
                                     where b.CompanyId == companyId && a.Id == longId
                                     select a).FirstOrDefault();

            return(custSite);
        }
Ejemplo n.º 10
0
    //protected override void OnPreLoad(EventArgs e)
    //{
    //    if (Page.User.Identity.IsAuthenticated)
    //    {
    //        try
    //        {
    //            customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0];
    //            customerexists = true;
    //        }
    //        catch
    //        {
    //            //no entry in Customer table for current member
    //            customerexists = false;
    //        }
    //    }
    //}

    //protected override void OnPreRender(EventArgs e)
    //{
    //    CheckProfiles myCheckProfiles = new CheckProfiles();

    //    //MessageBox.Show(Convert.ToString(myCheckProfiles.Personal()));
    //    //MessageBox.Show(Convert.ToString(myCheckProfiles.Address()));
    //    //MessageBox.Show(Convert.ToString(myCheckProfiles.Contact()));

    //    //if (this.User.Identity.IsAuthenticated)
    //    //{
    //        if (!myCheckProfiles.Personal())
    //        {
    //            //MessageBox.Show("1a");
    //            this.Page.Response.Redirect("~/Users/MyAccount.aspx");
    //        }

    //        if (!myCheckProfiles.Address())
    //        {
    //            if (myCheckProfiles.Personal() && myCheckProfiles.Facility())
    //            {
    //                //MessageBox.Show("2a");
    //                this.Page.Response.Redirect("~/Users/MyAccount.aspx");
    //            }
    //        }

    //        if (!myCheckProfiles.Facility())
    //        {
    //            if (myCheckProfiles.Personal() && myCheckProfiles.Address())
    //            {
    //                //MessageBox.Show("3a");
    //                this.Page.Response.Redirect("~/Users/MyAccount.aspx");
    //            }
    //        }

    //        if (!myCheckProfiles.Dimensions())
    //        {
    //            if (myCheckProfiles.Personal() && myCheckProfiles.Address() && myCheckProfiles.Facility())
    //            {
    //                //MessageBox.Show("4a");
    //                this.Page.Response.Redirect("~/Users/MyDimensions.aspx");
    //            }
    //        }

    //        if (!myCheckProfiles.Golf())
    //        {
    //            if (myCheckProfiles.Personal() && myCheckProfiles.Address() && myCheckProfiles.Facility() && myCheckProfiles.Dimensions())
    //            {
    //                //MessageBox.Show("5a");
    //                this.Page.Response.Redirect("~/Users/MyGolf.aspx");
    //            }
    //        }
    //    //}
    //}

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Image1.Visible      = false;
            Label1.Visible      = false;
            FileUpload1.Visible = false;
            Label5.Visible      = false;
            Label6.Visible      = false;
            Label7.Visible      = false;
            Label2.Visible      = false;
            Label3.Visible      = false;
        }
        customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0];
        teacher  = DataRepository.TeacherProvider.GetByAspnetMembershipUserId(customer.AspnetMembershipUserId)[0];

        customer        = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0];
        customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];

        customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite);
        // Label1.Text = customersite.SiteName;

        teachersatsite = DataRepository.TeacherSiteProvider.GetBySiteId(customerprofile.CustomerSite);
        teachersatsite.Sort("TeacherId ASC");

        if (DropDownList1.Items.Count.Equals(0))
        {
            DropDownList1.Items.Clear();
            DropDownList1.Items.Add("Make a Selection");
            DropDownList1.Items[0].Value = "-1";
            int x = 0;
            foreach (TeacherSite ts in teachersatsite)
            {
                x++;
                string userrolename = string.Empty;
                teacher       = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId);
                CoachSearched = DataRepository.TeacherProvider.GetByTeacherId(teacher.TeacherId);
                Guid           MemGuid  = new Guid(CoachSearched.AspnetMembershipUserId.ToString());
                MembershipUser user     = Membership.GetUser(MemGuid);
                string[]       userrole = Roles.GetRolesForUser(user.UserName);
                userrolename = userrole[0];
                if (userrolename != "Athletes")
                {
                    DropDownList1.Items.Add(teacher.FirstName + " " + teacher.LastName);
                    DropDownList1.Items[x].Value = teacher.TeacherId.ToString();
                }
            }
        }
    }
Ejemplo n.º 11
0
        public JsonNetResult UpdateWebsiteEmail(CustomerSite customersite)
        {
            ExigoDAL.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Email      = customersite.Email
            });

            var html = string.Format("{0}", customersite.Email);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteEmail",
                html = html
            }));
        }
Ejemplo n.º 12
0
        public JsonNetResult UpdateWebsiteMessage(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Notes1     = customersite.Notes1
            });

            var html = "<p>" + customersite.Notes1 + "</p>";

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteMessage",
                html = html
            }));
        }
Ejemplo n.º 13
0
        public JsonNetResult UpdateWebsiteFax(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Fax        = customersite.Fax
            });

            var html = string.Format("{0}", customersite.Fax);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteFax",
                html = html
            }));
        }
 protected override void OnPreLoad(EventArgs e)
 {
     if (Page.User.Identity.IsAuthenticated)
     {
         try
         {
             _teacher = DataRepository.TeacherProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0];
             int teacherid = _teacher.TeacherId;
             _teachersite = DataRepository.TeacherSiteProvider.GetByTeacherId(teacherid)[0];
             int techersiteid = _teachersite.SiteId;
             _customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(techersiteid);
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 15
0
        public JsonNetResult UpdateWebsiteName(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                FirstName  = customersite.FirstName,
                LastName   = customersite.LastName
            });

            var html = string.Format("{0} {1}", customersite.FirstName, customersite.LastName);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteName",
                html = html
            }));
        }
        public JsonNetResult UpdateWebsiteAddress(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Address    = customersite.Address
            });


            var html = customersite.Address.AddressDisplay + "<br />" + customersite.Address.City + ", " + customersite.Address.State + " " + customersite.Address.Zip + ", " + customersite.Address.Country;

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteAddress",
                html = html
            }));
        }
Ejemplo n.º 17
0
 public CustomerSiteModel(CustomerSite entity)
 {
     if (entity != null)
     {
         this.CustomerId        = entity.CustomerId;
         this.CodeCombinationId = entity.CodeCombinationId;
         this.SiteAddress       = entity.SiteAddress;
         this.SiteContact       = entity.SiteContact;
         this.SiteName          = entity.SiteName;
         this.TaxId             = entity.TaxCodeId;
         this.EndDate           = entity.EndDate;
         this.Id         = entity.Id;
         this.StartDate  = entity.StartDate;
         this.CreateBy   = entity.CreateBy;
         this.CreateDate = entity.CreateDate;
         this.UpdateBy   = entity.UpdateBy;
         this.UpdateDate = entity.UpdateDate;
     }
 }
Ejemplo n.º 18
0
        public JsonNetResult UpdateWebsiteAddress(CustomerSite customersite)
        {
            // Attempt to validate the user's entered address if US address
            customersite.Address = GlobalUtilities.ValidateAddress(customersite.Address) as Address;

            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Address    = customersite.Address
            });


            var html = customersite.Address.AddressDisplay + "<br />" + customersite.Address.City + ", " + customersite.Address.State + " " + customersite.Address.Zip + ", " + customersite.Address.Country;

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteAddress",
                html = html
            }));
        }
Ejemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        customer         = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0];
        customerprofile  = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
        SelectedFacility = customerprofile.CustomerSite;
        customersite     = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(SelectedFacility);
        Label1.Text      = customersite.SiteName;
        facilityteachers = DataRepository.TeacherSiteProvider.GetBySiteId(SelectedFacility);
        dt.Columns.Add("TeacherId", typeof(int));
        dt.Columns.Add("First Name", typeof(string));
        dt.Columns.Add("Last Name", typeof(string));
        dt.Columns.Add("Roles", typeof(string));
        dt.Columns.Add("Mobile Phone", typeof(string));
        dt.Columns.Add("Fax", typeof(string));
        dt.Columns.Add("AspNetMembershipUserId", typeof(string));
        dt.Columns.Add("Picture Path", typeof(string));
        dt.Columns.Add("Bio Text", typeof(string));
        dt.Columns.Add("Welcome Text", typeof(string));
        dt.Columns.Add("Teaching Password", typeof(string));
        dt.Columns.Add("TeacherLocationId", typeof(int));
        x = 0;
        foreach (TeacherSite ts in facilityteachers)
        {
            teacher      = DataRepository.TeacherProvider.GetByTeacherId(ts.TeacherId);
            customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(ts.SiteId);
            Guid           MemGuid      = new Guid(teacher.AspnetMembershipUserId.ToString());
            MembershipUser user         = Membership.GetUser(MemGuid);
            string[]       userrole     = Roles.GetRolesForUser(user.UserName);
            string         userrolename = string.Empty;
            if (userrole.Length > 0)
            {
                userrolename = userrole[0];
            }

            dt.Rows.Add(teacher.TeacherId, teacher.FirstName, teacher.LastName, userrolename, teacher.MobilePhone, teacher.Fax, teacher.AspnetMembershipUserId.ToString(), teacher.PicturePath, teacher.BioText, teacher.WelcomeText, teacher.TeachingPassword, ts.TeacherLocationId);
            x++;
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
 public string Insert(CustomerSite entity)
 {
     this.Context.CustomerSites.Add(entity);
     this.Commit();
     return(entity.Id.ToString());
 }
Ejemplo n.º 21
0
 public CustomerWithMainSite(string name, string email, CustomerSite mainSite)
     : base(name, email)
 {
     MainSite = mainSite;
 }
        public BaseExtendable createMTDQuote(int contact_iid, string projDesc, TMAMessage msg, IMTDService svc, UserSession us, Guid mtdGUID, int srcLangCID, int[] targetLangCIDs)
        {
            BaseExtendable newQuote = new BaseExtendable(Code.Find(AppCodes.PROJECT_TARGET_TYPE).CID);

            if (msg.name != null)
            {
                newQuote.Description = msg.name;
            }
            else
            {
                newQuote.Description = projDesc;
            }
            newQuote.OID = svc.NextSequenceNumber(true);
            svc.Store(newQuote);
            ///// Add Attributes
            /////////////////////////////////////////////////////////////////////////////////////

            //           int contact_iid = Convert.ToInt32(ConfigurationSettings.AppSettings["CONTACT_IID"]);

            Contact      contact        = svc.LoadContact(contact_iid);
            CustomerSite site           = svc.LoadCustomerSite(contact.Site_IID);
            int          salesPersonIID = site.Sales_Employee_IID;

            if (salesPersonIID == -1)
            {
                salesPersonIID = us.Current_User.Employee.Employee_IID; // vilma
            }

            Base.Attribute salesAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "SALESPERSON"), salesPersonIID);
            salesAttr.SetParent(newQuote.Attributes);

            Base.Attribute contactAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "CONTACT"), contact_iid);
            contactAttr.SetParent(newQuote.Attributes);
            // msg.status ='approved"
            Base.Attribute statusAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "STATUS"), Code.Find(10033));
            statusAttr.SetParent(newQuote.Attributes);
            // Quoted
            int perCt = 10;

            Base.Attribute pmPercentAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PM_PERCENT"), perCt);
            pmPercentAttr.SetParent(newQuote.Attributes);

            decimal internalRate = 35;

            Base.Attribute internalRateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "BASE_INTERNAL_RATE"), internalRate);
            internalRateAttr.SetParent(newQuote.Attributes);

            Base.Attribute sourceAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "SOURCE_LANG"), Code.Find(srcLangCID));
            sourceAttr.SetParent(newQuote.Attributes);
            int targetCID;
            int numLangs = targetLangCIDs.Length;

            for (int i = 0; i < numLangs; i++)
            {
                targetCID = targetLangCIDs[i];
                if (targetCID > 0)
                {
                    Base.Attribute targetLang = newQuote.Attributes.Add(CodeTranslator.Find("CTYPE", "LOC"), Code.Find(targetCID), 0);
                    targetLang.SetParent(newQuote.Attributes);
                }
            }

            /*
             * Base.Attribute budgetAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "BUDGET"), this.BudgetCheckBox.Checked);
             * budgetAttr.SetParent(newQuote.Attributes);
             * Base.Attribute rushAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "RUSH_JOB"), this.RushCheckBox.Checked);
             * rushAttr.SetParent(newQuote.Attributes);
             * Base.Attribute reverseAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "LANGUAGES_REVERSED"), this.ReverseCheckBox.Checked);
             * reverseAttr.SetParent(newQuote.Attributes);
             * Base.Attribute cleanAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PRE_TRANS_CLEANING"), this.CleanCheckBox.Checked);
             * cleanAttr.SetParent(newQuote.Attributes);
             */

            //DateTime dTime = new DateTime(2012, 09, 01, 12, 00, 00);
            //String dTime;
            //dTime = defDTime.ToString("yyyy-MM-dd HH:mm tt");

            Base.Attribute dateQuoteStartAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "QUOTE_START_DT"), DateTime.Now);
            dateQuoteStartAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateAssessStartAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "ASSESS_START_DT"), DateTime.Now);
            dateAssessStartAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateQuoteDueeAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "QUOTE_DUE_DT"), DateTime.Now.AddDays(1));
            dateQuoteDueeAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateAsessDueAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "ASSESS_DUE_DT"), DateTime.Now.AddDays(1));
            dateAsessDueAttr.SetParent(newQuote.Attributes);

            /*
             * Base.Attribute dateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PROJECT_DUE_DT"), dTime);
             *  dateAttr.SetParent(newQuote.Attributes);
             * Base.Attribute dateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PROD_DUE_DT"), dTime);
             *  dateAttr.SetParent(newQuote.Attributes);
             */

            svc.Store(newQuote);


            msg.quoteOID = newQuote.OID;
            // Update Quote if first
            ProspectCollection prospects = svc.LoadProspectCollection(Convert.ToInt32("5157"));

            if (prospects.Count > 0)
            {
                Prospect updateProspect = (Prospect)prospects[0];
                if (updateProspect.Quote_IID == -1)
                {
                    updateProspect.Quote_IID = newQuote.Entity_IID;
                    svc.Store(updateProspect);
                }
            }

            BaseExtendable m_project = newQuote;

            return(m_project);
        }
        public BaseExtendable createMTDProject(int contact_iid, string projDesc, TMAMessage msg, IMTDService svc, UserSession us, Guid mtdGUID, int srcLangCID, int[] targetLangCIDs, bool monthlyFlag)
        {
            BaseExtendable newQuote = new BaseExtendable(Code.Find(AppCodes.PROJECT_TARGET_TYPE).CID);

            if (msg.name != null)
            {
                newQuote.Description = msg.name;
            }
            else
            {
                newQuote.Description = projDesc;
            }
            newQuote.OID = svc.NextSequenceNumber(true);
            svc.Store(newQuote);
            ///// Add Attributes
            /////////////////////////////////////////////////////////////////////////////////////

            //           int contact_iid = Convert.ToInt32(ConfigurationSettings.AppSettings["CONTACT_IID"]);

            Contact      contact        = svc.LoadContact(contact_iid);
            CustomerSite site           = svc.LoadCustomerSite(contact.Site_IID);
            int          salesPersonIID = site.Sales_Employee_IID;

            if (salesPersonIID == -1)
            {
                salesPersonIID = us.Current_User.Employee.Employee_IID; // vilma
            }

            Base.Attribute salesAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "SALESPERSON"), salesPersonIID);
            salesAttr.SetParent(newQuote.Attributes);

            Base.Attribute contactAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "CONTACT"), contact_iid);
            contactAttr.SetParent(newQuote.Attributes);
            // msg.status ='approved"
            Base.Attribute statusAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "STATUS"), Code.Find(10033));
            statusAttr.SetParent(newQuote.Attributes);
            // Quoted
            decimal perCt = 10;

            Base.Attribute pmPercentAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PM_PERCENT"), perCt);
            pmPercentAttr.SetParent(newQuote.Attributes);

            decimal internalRate = 35;

            Base.Attribute internalRateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "BASE_INTERNAL_RATE"), internalRate);
            internalRateAttr.SetParent(newQuote.Attributes);                                            // use default from MTD web config

            Base.Attribute sourceAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "SOURCE_LANG"), Code.Find(srcLangCID));
            sourceAttr.SetParent(newQuote.Attributes);
            int targetCID;
            int numLangs = targetLangCIDs.Length;

            for (int i = 0; i < numLangs; i++)
            {
                targetCID = targetLangCIDs[i];
                if (targetCID > 0)
                {
                    Base.Attribute targetLang = newQuote.Attributes.Add(CodeTranslator.Find("CTYPE", "LOC"), Code.Find(targetCID), 0);
                    targetLang.SetParent(newQuote.Attributes);
                }
            }

            /*
             * Base.Attribute budgetAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "BUDGET"), this.BudgetCheckBox.Checked);
             * budgetAttr.SetParent(newQuote.Attributes);
             * Base.Attribute rushAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "RUSH_JOB"), this.RushCheckBox.Checked);
             * rushAttr.SetParent(newQuote.Attributes);
             * Base.Attribute reverseAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "LANGUAGES_REVERSED"), this.ReverseCheckBox.Checked);
             * reverseAttr.SetParent(newQuote.Attributes);
             * Base.Attribute cleanAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PRE_TRANS_CLEANING"), this.CleanCheckBox.Checked);
             * cleanAttr.SetParent(newQuote.Attributes);
             */

            //DateTime dTime = new DateTime(2012, 09, 01, 12, 00, 00);
            //String dTime;
            //dTime = defDTime.ToString("yyyy-MM-dd HH:mm tt");

            Base.Attribute dateQuoteStartAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "QUOTE_START_DT"), DateTime.Now);
            dateQuoteStartAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateAssessStartAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "ASSESS_START_DT"), DateTime.Now);
            dateAssessStartAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateQuoteDueeAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "QUOTE_DUE_DT"), DateTime.Now.AddDays(1));
            dateQuoteDueeAttr.SetParent(newQuote.Attributes);

            Base.Attribute dateAsessDueAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "ASSESS_DUE_DT"), DateTime.Now.AddDays(1));
            dateAsessDueAttr.SetParent(newQuote.Attributes);

            /*
             * Base.Attribute dateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "ASSESS_DUE_DT"), dTime);
             *  dateAttr.SetParent(newQuote.Attributes);
             *
             * Base.Attribute dateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PROJECT_DUE_DT"), dTime);
             *  dateAttr.SetParent(newQuote.Attributes);
             * Base.Attribute dateAttr = newQuote.Attributes.Add(Code.Find("PROJECT_ATTR", "PROD_DUE_DT"), dTime);
             *  dateAttr.SetParent(newQuote.Attributes);
             */

            svc.Store(newQuote);


            msg.quoteOID = newQuote.OID;



            //convert Quote to Project
            string projectNum = svc.NextSequenceNumber(false);

            BaseExtendable m_project = newQuote;

            Code statusCode = Code.Find("PROJECT_STATUS", "LINGUISTIC");

            statusAttr = m_project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "STATUS"));
            if (statusAttr == null)
            {
                statusAttr = m_project.Attributes.Add(CodeTranslator.Find("PROJECT_ATTR", "STATUS"), statusCode);
                statusAttr.SetParent(m_project.Attributes);
            }
            else
            {
                statusAttr.Value = statusCode;
            }
            Base.Attribute projStartDate = m_project.Attributes.Add(Code.Find("PROJECT_ATTR", "PROJECT_START_DT"), DateTime.Now);
            projStartDate.SetParent(m_project.Attributes);

            Base.Attribute prodStartDate = m_project.Attributes.Add(Code.Find("PROJECT_ATTR", "PROD_START_DT"), DateTime.Now);
            prodStartDate.SetParent(m_project.Attributes);


            Base.Attribute monthlyAttr = m_project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "MONTHLY"));
            if (monthlyAttr == null && monthlyFlag == true)
            {
                monthlyAttr = m_project.Attributes.Add(CodeTranslator.Find("PROJECT_ATTR", "MONTHLY"), monthlyFlag);
                monthlyAttr.SetParent(m_project.Attributes);
            }

            m_project.Attributes.Add(CodeTranslator.Find("PROJECT_ATTR", "PROJECTNUM"), projectNum);

            bool itar = false;

            Base.Attribute itarAttr = m_project.Attributes.Find(CodeTranslator.Find("PROJECT_ATTR", "ITAR"));
            if (itarAttr != null)
            {
                itar = ((bool)itarAttr.Value);
                itarAttr.SetParent(m_project.Attributes);
            }

            svc.Store(m_project);
            return(m_project);
        }
Ejemplo n.º 24
0
        private SaleOrderDTO CreateSOHead(Organization org, string soDocTypeCode, Customer itemCust, SOInfo soInfo)
        {
            SaleOrderDTO dtoSOHead = new SaleOrderDTO();
            //单据类型
            long doctypeID = GetProfileValue(soDocTypeCode);//销售订单单据类型
            CommonArchiveDataDTO dtoDocType = new CommonArchiveDataDTO();

            dtoDocType.ID          = doctypeID;
            dtoSOHead.DocumentType = dtoDocType;

            //客户
            CustomerMISCInfo customer = new CustomerMISCInfo();

            customer.Code     = itemCust.Code;
            dtoSOHead.OrderBy = customer;

            //订单日期
            dtoSOHead.BusinessDate = DateTime.Parse(soInfo.BusinessDate);

            Profile profDept = Base.Profile.Profile.Finder.Find("Application.Code = @appCode and Code = @code ", new OqlParam[2] {
                new OqlParam("0503"), new OqlParam("SD051")
            });                                                                                                                                                                   //销售管理-参数设置-默认销售部门
            Profile profEmployee = Base.Profile.Profile.Finder.Find("Application.Code = @appCode and Code = @code ", new OqlParam[2] {
                new OqlParam("0503"), new OqlParam("SD052")
            });                                                                                                                                                                       //销售管理-参数设置-默认销售员

            //部门
            dtoSOHead.SaleDepartment    = new CommonArchiveDataDTO();
            dtoSOHead.SaleDepartment.ID = Convert.ToInt64(profDept.GetProfileValue().ToString());
            //业务员
            dtoSOHead.Seller    = new CommonArchiveDataDTO();
            dtoSOHead.Seller.ID = Convert.ToInt64(profEmployee.GetProfileValue().ToString());

            //立账位置
            dtoSOHead.IsPriceIncludeTax = true;
            CustomerSite         cs  = CustomerSite.Finder.Find("Customer  ='" + itemCust.ID + "'");
            CustomerSiteMISCInfo cdd = new CustomerSiteMISCInfo();

            cdd.CustomerSite = cs;
            //收货位置
            dtoSOHead.ShipToSite      = cdd;
            dtoSOHead.ShipToSite.Code = cdd.Code;
            dtoSOHead.ShipToSite.Name = cdd.Name;
            //立账位置
            dtoSOHead.BillToSite      = cdd;
            dtoSOHead.BillToSite.Code = cdd.Code;
            dtoSOHead.BillToSite.Name = cdd.Name;
            //付款位置
            dtoSOHead.PayerSite      = cdd;
            dtoSOHead.PayerSite.Code = cdd.Code;
            dtoSOHead.PayerSite.Name = cdd.Name;

            //币种
            if (itemCust.TradeCurrency != null)
            {
                dtoSOHead.TC      = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
                dtoSOHead.TC.Code = itemCust.TradeCurrency.Code;
            }

            //优先级
            dtoSOHead.SOPriority = SOPRIEnum.GetFromValue(99);
            //核算组织
            dtoSOHead.AccountOrg      = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
            dtoSOHead.AccountOrg.Code = org.Code;
            //开票组织
            dtoSOHead.InvoiceOrg      = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
            dtoSOHead.InvoiceOrg.Code = org.Code;
            //出货原则
            if (itemCust.ShippmentRule != null)
            {
                dtoSOHead.ShipRule      = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
                dtoSOHead.ShipRule.Code = itemCust.ShippmentRule.Code;
            }
            //立账条件
            if (itemCust.ARConfirmTerm != null)
            {
                dtoSOHead.ConfirmTerm      = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
                dtoSOHead.ConfirmTerm.Code = itemCust.ARConfirmTerm.Code;
            }
            //成交方式
            dtoSOHead.BargainMode = BargainEnum.GetFromValue(-1);
            //运费支付
            dtoSOHead.TransPayMode = UFIDA.U9.CBO.SCM.Enums.FreightPaymentEnum.GetFromValue(-1);
            //扩展段
            dtoSOHead.DescFlexField = new UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments();
            return(dtoSOHead);
        }
Ejemplo n.º 25
0
 public string Insert(CustomerSite entity)
 {
     return(this.repository.Insert(entity));
 }
Ejemplo n.º 26
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        //int comma = ListBox1.Items[x].Value.IndexOf(",");
        //int bar = ListBox1.Items[x].Value.IndexOf("|");
        //int customerid = Convert.ToInt16(ListBox1.Items[x].Value.Substring(0, comma));
        //string MemberUsername = ListBox1.Items[x].Value.Substring(comma + 1, bar - comma - 1);
        //string MemberEmail = ListBox1.Items[x].Value.Substring(bar + 1);

        //customer = DataRepository.CustomerProvider.GetByCustomerId(customerid);
        //customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
        //countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(customer.Country);
        //customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite);
        //teacher = DataRepository.TeacherProvider.GetByTeacherId(customerprofile.Teacher);
        //Guid MemGuid = new Guid(customer.AspnetMembershipUserId.ToString());
        //MembershipUser user = Membership.GetUser(MemGuid);
        try
        {
            int x          = ListBox1.SelectedIndex;
            int customerid = Convert.ToInt16(ListBox1.Items[x].Value);
            customer = DataRepository.CustomerProvider.GetByCustomerId(customerid);
            Guid           MemGuid        = new Guid(customer.AspnetMembershipUserId.ToString());
            MembershipUser user           = Membership.GetUser(MemGuid);
            string         MemberUsername = user.UserName.ToString();
            string         MemberEmail    = user.Email;
            countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(customer.Country);
            try
            {
                customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
                customersite    = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite);
                teacher1        = DataRepository.TeacherProvider.GetByTeacherId(customerprofile.Teacher);
            }
            catch (Exception ex)
            {
                customerprofile = new CustomerProfile();
            }

            if (CheckBox1.Checked)
            {
                CheckBox1.Checked = false;
                CheckBox1.Enabled = false;
                Button2.Enabled   = false;

                if (customer.MembershipExpiration <= DateTime.Today)
                {
                    customer.MembershipExpiration = DateTime.Today.AddYears(1);
                }
                else
                {
                    customer.MembershipExpiration = customer.MembershipExpiration.AddYears(1);
                }
                customer.MembershipRenewal = DateTime.Today;
                customer.IsRenewal         = 1;
                customer.BillFacility      = 1;

                switch (customer.MembershipStatus)
                {
                case 0:
                    customer.MembershipCost = 50;
                    break;

                case 1:
                    customer.MembershipCost = 50;
                    break;

                case 2:
                    customer.MembershipCost = 50;
                    break;

                case 3:
                    customer.MembershipCost = 50;
                    break;

                case 4:
                    customer.MembershipCost = 100;
                    break;

                case 5:
                    customer.MembershipStatus = 2;
                    customer.MembershipCost   = 50;
                    break;

                case 6:
                    customer.MembershipStatus = 3;
                    customer.MembershipCost   = 50;
                    break;

                case 7:
                    customer.MembershipStatus = 4;
                    customer.MembershipCost   = 100;
                    break;

                case 97:
                    customer.MembershipCost = 0;
                    break;

                case 98:
                    customer.MembershipCost = 0;
                    break;

                case 99:
                    customer.MembershipCost = 0;
                    break;

                default:
                    customer.MembershipStatus = 2;
                    customer.MembershipCost   = 50;
                    break;
                }
                DataRepository.CustomerProvider.Update(customer);

                user.IsApproved = true;
                if (user.IsLockedOut)
                {
                    user.UnlockUser();
                }
                Membership.UpdateUser(user);

                Label5.Text  = customer.FirstName;
                Label7.Text  = customer.LastName;
                Label9.Text  = MemberUsername;
                Label11.Text = MemberEmail;
                if (!customer.Address1.ToLower().Equals("none"))
                {
                    Label13.Text = customer.Address1;
                }
                else
                {
                    Label13.Text = "";
                }
                Label15.Text = customer.Address2;
                if (!customer.City.ToLower().Equals("none"))
                {
                    Label17.Text = customer.City;
                }
                else
                {
                    Label17.Text = "";
                }
                if (!customer.State.ToLower().Equals("none"))
                {
                    Label19.Text = customer.State;
                }
                else
                {
                    Label19.Text = "";
                }
                if (!customer.Zip.ToLower().Equals("none"))
                {
                    Label21.Text = customer.Zip;
                }
                else
                {
                    Label21.Text = "";
                }
                if (customer.Address1.ToLower().Equals("none") && customer.Country.Equals(248))
                {
                    Label23.Text = "";
                }
                else
                {
                    Label23.Text = countrylookup.CountryName;
                }
                Label25.Text = customer.PhoneHome;
                Label27.Text = customer.PhoneWork;
                Label29.Text = customer.PhoneMobile;
                Label31.Text = customer.Fax;
                Label33.Text = customersite.SiteName;
                Label35.Text = teacher.FirstName + " " + teacher.LastName;
                Label37.Text = user.CreationDate.ToLongDateString();
                Label39.Text = customer.MembershipExpiration.ToLongDateString();
                switch (customer.MembershipStatus)
                {
                case 0:
                    Label41.Text = "Expired";
                    break;

                case 1:
                    Label41.Text = "Member";
                    break;

                case 2:
                    Label41.Text = "Full Teaching";
                    break;

                case 3:
                    Label41.Text = "Full Fitting";
                    break;

                case 4:
                    Label41.Text = "Full Teaching & Fitting";
                    break;

                case 97:
                    Label41.Text = "Comp Teaching";
                    break;

                case 98:
                    Label41.Text = "Comp Fitting";
                    break;

                case 99:
                    Label41.Text = "Comp Teaching & Fitting";
                    break;

                default:
                    Label41.Text = "Missing";
                    break;
                }

                Label3.ForeColor = System.Drawing.Color.BlueViolet;
                Label3.Text      = "The member's account has been renewed. Your facility will be charged the annual"
                                   + " renewal fee on your next monthly invoice.";

                ListBox1.Items.Clear();
            }
            else
            {
                Label3.ForeColor = System.Drawing.Color.Maroon;
                Label3.Text      = "You must click in the checkbox acknowledging that the renewal fee will be billed"
                                   + " to your facility.";
            }
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
    }
Ejemplo n.º 27
0
        private void CreateSOLines(Organization org, SOInfo soInfo, SaleOrderDTO dtoSO, Customer customer)
        {
            CustomerSite         cs           = CustomerSite.Finder.Find("Customer  ='" + customer.ID + "'");
            CustomerSiteMISCInfo customerSite = new CustomerSiteMISCInfo();

            customerSite.CustomerSite = cs;
            customerSite.Code         = cs.Code;
            customerSite.Name         = cs.Name;

            foreach (var itemLine in soInfo.Lines)
            {
                UFIDA.U9.ISV.SM.SOLineDTO soLine = new UFIDA.U9.ISV.SM.SOLineDTO();
                //料品
                soLine.ItemInfo = new UFIDA.U9.CBO.SCM.Item.ItemInfo();

                ItemMaster beItemMaster = ItemMaster.Finder.Find("Code = @code and Org = @orgID",
                                                                 new OqlParam[2] {
                    new OqlParam(itemLine.ItemMasterCode), new OqlParam(org.ID)
                });
                if (beItemMaster == null)
                {
                    throw new Exception(string.Format("物料编码{0}在U9中不存在", itemLine.ItemMasterCode));
                }

                soLine.ItemInfo.ItemID = beItemMaster;

                //soLine.BomOwner = new UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO();
                //soLine.BomOwner.ID = org.ID;
                //soLine.BomOwner.Code = org.Code;
                //soLine.BomOwner.Name = org.Name;

                //数量
                soLine.ChoiceResult = 0;
                soLine.OrderByQtyTU = itemLine.Qty;
                //扩展字段
                soLine.DescFlexField = new UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments();
                //收款条件
                if (customer.RecervalTerm != null)
                {
                    soLine.RecTerm      = new CommonArchiveDataDTO();
                    soLine.RecTerm.Code = customer.RecervalTerm.Code;
                }
                //立账位置
                if (customer.CustomerSites != null)
                {
                    if (customer.CustomerSites.Count > 0)
                    {
                        soLine.BillToSite                 = customerSite;
                        soLine.BillToSite.Code            = customerSite.Code;
                        soLine.BillToSite.CustomerSiteKey = customerSite.CustomerSiteKey;
                    }
                }

                //定价方式
                soLine.CooperatePriceStyle = -1;
                //免费品类型
                soLine.FreeType = FreeTypeEnum.GetFromValue(-1);
                //免费品原因
                soLine.FreeReason = DonationReasonEnum.GetFromValue(-1);
                //台阶划分依据
                soLine.StepBy = -1;
                //预收环节
                soLine.PreRecObject = -1;
                //原币-额币
                soLine.TCToCCExchRateType = ExchangeRateTypesEnum.GetFromValue(0);
                //来源单据类别
                soLine.SrcDocType = SOSourceTypeEnum.GetFromValue(0);
                //成套收发货标志
                soLine.ShipTogetherFlag = KITShipModeEnum.GetFromValue(-1);
                //数量类型
                soLine.QuantityType = UsageQuantityTypeEnum.GetFromValue(-1);
                //资源成本计费基础
                soLine.ChargeBasis = ChargeBasisEnum.GetFromValue(-1);
                //价格来源
                soLine.PriceSource = PriceSourceEnum.GetFromValue(1);
                //是否消耗信用额度
                soLine.IsEngrossCreditLimit = true;

                //添加销售订单上的计划行
                soLine.SOShiplines = new List <SOShipLineDTO>();
                SOShipLineDTO soship = new SOShipLineDTO();
                soship.ItemInfo          = new UFIDA.U9.CBO.SCM.Item.ItemInfo();
                soship.ItemInfo.ItemID   = beItemMaster;
                soship.ItemInfo.ItemCode = beItemMaster.Code;
                soship.ItemInfo.ItemName = beItemMaster.Name;
                soship.RequireDate       = DateTime.Parse(itemLine.DeliveryDate);
                soship.DescFlexField     = new UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments();

                //区域位置
                soship.ShipToSite = new CustomerSiteMISCInfo();
                soship.ShipToSite.CustomerSite = customerSite.CustomerSite;
                soship.ShipToSite.Code         = customerSite.Code;
                soship.ShipToSite.Name         = customerSite.Name;

                //单价
                soLine.OrderPriceTC = itemLine.TCPrice;
                soLine.SOShiplines.Add(soship);

                dtoSO.SOLines.Add(soLine);
            }
        }
Ejemplo n.º 28
0
    //protected void Button2_Click(object sender, EventArgs e)
    //public void ListBox1_SIC()
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (!ListBox1.SelectedValue.Equals("No Matches"))
        {
            Label3.Text       = "";
            CheckBox1.Enabled = false;
            CheckBox1.Checked = false;
            Button2.Enabled   = false;


            #region [old code]
            //int x = ListBox1.SelectedIndex;
            //int comma = ListBox1.Items[x].Value.IndexOf(",");
            //int bar = ListBox1.Items[x].Value.IndexOf("|");
            //int customerid = Convert.ToInt16(ListBox1.Items[x].Value.Substring(0, comma));
            //string MemberUsername = ListBox1.Items[x].Value.Substring(comma + 1, bar - comma - 1);
            //string MemberEmail = ListBox1.Items[x].Value.Substring(bar + 1);

            //customer = DataRepository.CustomerProvider.GetByCustomerId(customerid);
            //customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
            //countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(customer.Country);
            //customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite);
            //teacher = DataRepository.TeacherProvider.GetByTeacherId(customerprofile.Teacher);
            //Guid MemGuid = new Guid(customer.AspnetMembershipUserId.ToString());
            //MembershipUser user = Membership.GetUser(MemGuid);
            #endregion [old code]

            int x          = ListBox1.SelectedIndex;
            int customerid = Convert.ToInt16(ListBox1.Items[x].Value);
            customer = DataRepository.CustomerProvider.GetByCustomerId(customerid);
            Guid           MemGuid        = new Guid(customer.AspnetMembershipUserId.ToString());
            MembershipUser user           = Membership.GetUser(MemGuid);
            string         MemberUsername = user.UserName.ToString();
            string         MemberEmail    = user.Email;
            countrylookup = DataRepository.CountryLookupProvider.GetByCountryId(customer.Country);
            try
            {
                customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
                customersite    = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(customerprofile.CustomerSite);
                teacher1        = DataRepository.TeacherProvider.GetByTeacherId(customerprofile.Teacher);
            }
            catch (Exception ex)
            {
                customerprofile = new CustomerProfile();
            }


            Label5.Text  = customer.FirstName;
            Label7.Text  = customer.LastName;
            Label9.Text  = MemberUsername;
            Label11.Text = MemberEmail;
            if (!customer.Address1.ToLower().Equals("none"))
            {
                Label13.Text = customer.Address1;
            }
            else
            {
                Label13.Text = "";
            }
            Label15.Text = customer.Address2;
            if (!customer.City.ToLower().Equals("none"))
            {
                Label17.Text = customer.City;
            }
            else
            {
                Label17.Text = "";
            }
            if (!customer.State.ToLower().Equals("none"))
            {
                Label19.Text = customer.State;
            }
            else
            {
                Label19.Text = "";
            }
            if (!customer.Zip.ToLower().Equals("none"))
            {
                Label21.Text = customer.Zip;
            }
            else
            {
                Label21.Text = "";
            }
            if (customer.Address1.ToLower().Equals("none") && customer.Country.Equals(248))
            {
                Label23.Text = "";
            }
            else
            {
                Label23.Text = countrylookup.CountryName;
            }
            Label25.Text = customer.PhoneHome;
            Label27.Text = customer.PhoneWork;
            Label29.Text = customer.PhoneMobile;
            Label31.Text = customer.Fax;
            Label33.Text = customersite.SiteName;
            Label35.Text = teacher.FirstName + " " + teacher.LastName;
            Label37.Text = user.CreationDate.ToLongDateString();
            Label39.Text = customer.MembershipExpiration.ToLongDateString();
            switch (customer.MembershipStatus)
            {
            case 0:
                Label41.Text = "Expired";
                break;

            case 1:
                Label41.Text = "Member";
                break;

            case 2:
                Label41.Text = "Full Teaching";
                break;

            case 3:
                Label41.Text = "Full Fitting";
                break;

            case 4:
                Label41.Text = "Full Teaching & Fitting";
                break;

            case 97:
                Label41.Text = "Comp Teaching";
                break;

            case 98:
                Label41.Text = "Comp Fitting";
                break;

            case 99:
                Label41.Text = "Comp Teaching & Fitting";
                break;

            default:
                Label41.Text = "Missing";
                break;
            }
        }
        if (customer.MembershipExpiration < DateTime.Today.AddYears(1))
        {
            CheckBox1.Enabled = true;
            Button2.Enabled   = true;
        }

        return;
    }
Ejemplo n.º 29
0
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (!ListBox1.SelectedValue.Equals("No Matches"))
        {
            int    x              = ListBox1.SelectedIndex;
            int    comma          = ListBox1.Items[x].Value.IndexOf(",");
            int    bar            = ListBox1.Items[x].Value.IndexOf("|");
            int    customerid     = Convert.ToInt16(ListBox1.Items[x].Value.Substring(0, comma));
            string MemberUsername = ListBox1.Items[x].Value.Substring(comma + 1, bar - comma - 1);
            string MemberEmail    = ListBox1.Items[x].Value.Substring(bar + 1);

            customer        = DataRepository.CustomerProvider.GetByCustomerId(customerid);
            customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0];
            countrylookup   = DataRepository.CountryLookupProvider.GetByCountryId(customer.Country);
            int SelectedFacilitynew = customerprofile.CustomerSite;
            customersite = DataRepository.CustomerSiteProvider.GetByCustomerSiteId(SelectedFacility);
            teacher      = DataRepository.TeacherProvider.GetByTeacherId(customerprofile.Teacher);
            Guid           MemGuid  = new Guid(customer.AspnetMembershipUserId.ToString());
            MembershipUser user     = Membership.GetUser(MemGuid);
            string[]       userrole = Roles.GetRolesForUser(user.UserName.ToString());

            // DropDownList1.SelectedValue = SelectedFacilitynew.ToString();
            //if (userrole.Length > 0)
            //{
            //    DropDownList2.SelectedValue = userrole[0];
            //}
            //else
            //{
            //    DropDownList2.SelectedValue = "Golfers";

            //}

            Label45.Text = customer.FirstName;
            Label7.Text  = customer.LastName;
            Label9.Text  = MemberUsername;
            Label11.Text = MemberEmail;
            if (!customer.Address1.ToLower().Equals("none"))
            {
                Label13.Text = customer.Address1;
            }
            else
            {
                Label13.Text = "";
            }
            Label15.Text = customer.Address2;
            if (!customer.City.ToLower().Equals("none"))
            {
                Label17.Text = customer.City;
            }
            else
            {
                Label17.Text = "";
            }
            if (!customer.State.ToLower().Equals("none"))
            {
                Label19.Text = customer.State;
            }
            else
            {
                Label19.Text = "";
            }
            if (!customer.Zip.ToLower().Equals("none"))
            {
                Label21.Text = customer.Zip;
            }
            else
            {
                Label21.Text = "";
            }
            if (customer.Address1.ToLower().Equals("none") && customer.Country.Equals(248))
            {
                Label23.Text = "";
            }
            else
            {
                Label23.Text = countrylookup.CountryName;
            }
            Label25.Text = customer.PhoneHome;
            Label27.Text = customer.PhoneWork;
            Label29.Text = customer.PhoneMobile;
            Label31.Text = customer.Fax;
            Label33.Text = customersite.SiteName;
            Label35.Text = teacher.FirstName + " " + teacher.LastName;
            Label37.Text = user.CreationDate.ToLongDateString();
            Label39.Text = customer.MembershipExpiration.ToLongDateString();
            switch (customer.MembershipStatus)
            {
            case 0:
                Label41.Text = "Expired";
                break;

            case 1:
                Label41.Text = "Member";
                break;

            case 2:
                Label41.Text = "Full Teaching";
                break;

            case 3:
                Label41.Text = "Full Fitting";
                break;

            case 4:
                Label41.Text = "Full Teaching & Fitting";
                break;

            case 97:
                Label41.Text = "Comp Teaching";
                break;

            case 98:
                Label41.Text = "Comp Fitting";
                break;

            case 99:
                Label41.Text = "Comp Teaching & Fitting";
                break;

            default:
                Label41.Text = "Missing";
                break;
            }
        }
    }
 public static CustomerSite CreateCustomerSite(int customerID, string webAlias, global::System.DateTime modifiedDate)
 {
     CustomerSite customerSite = new CustomerSite();
     customerSite.CustomerID = customerID;
     customerSite.WebAlias = webAlias;
     customerSite.ModifiedDate = modifiedDate;
     return customerSite;
 }
 public void AddToCustomerSites(CustomerSite customerSite)
 {
     base.AddObject("CustomerSites", customerSite);
 }
Ejemplo n.º 32
0
 public string Update(CustomerSite entity)
 {
     return(this.repository.Update(entity));
 }