Exemple #1
0
    private void BindUser()
    {
        string conn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;

        using (SqlConnection con = new SqlConnection(conn))
        {
            con.Open();
            if (con.State == ConnectionState.Open)
            {
                SqlCommand cmd = new SqlCommand("select * from [User] WHERE UserID=" + Convert.ToInt32(Session["Target"]) + "", con);

                //SqlParameter param = new SqlParameter();
                //param.ParameterName = "@UserID";
                //param.Value = user2;
                //cmd.Parameters.Add(param);

                //cmd.Parameters.Add(new SqlParameter("@UserID", user2));
                //SqlCommand cmd = new SqlCommand("select * from [User] WHERE UserID = @ID", con);//where userid=3 veya session falan filan
                //cmd.Parameters.Add("@ID", SqlDbType.Int);
                //cmd.Parameters["@ID"].Value = user2;
                using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
                {
                    DataTable dt = new DataTable();
                    sda.Fill(dt);
                    RepUser.DataSource = dt;
                    RepUser.DataBind();
                    //sessionla user bigisi al
                }
            }
        }
    }
        public void EditProfile(ContactViewModel contactModel)
        {
            //int RepId = Convert.ToInt32(UserViewModel.RepresentativeInfoObj.UserID);
            //int repUserId = UserVM.CRMModelProperties.RepID;
            RepUser userProfile = _Context.RepUser.GetSingle(e => e.RepID == UserVM.CRMModelProperties.RepID);

            if (userProfile != null)
            {
                userProfile.Biodata = contactModel.AboutRep;
                userProfile.PhoneCustomerService = contactModel.PhoneCustomerService;
                // userProfile.UserId = repUserId;
                _Context.RepUser.SaveChanges();
            }
        }
        public ContactViewModel getPenworthyContactDetails(int userID)
        {
            ContactViewModel contactVM   = new ContactViewModel();
            QuoteViewService qvs         = new QuoteViewService();
            RepUser          userProfile = new RepUser();
            User             repuser     = new User();
            string           dir         = ConfigurationManager.AppSettings["ContactusImageDirectory"];

            User crtuserdetails = _Context.User.GetSingle(e => e.UserId == userID);

            if (UserVM != null)
            {
                if (UserVM.CRMModelProperties != null && !UserVM.CRMModelProperties.IsRepLoggedIN)
                {
                    // repuser = _Context.User.GetSingle(e => e.CustAutoID == crtuserdetails.CustAutoID);
                    repuser = crtuserdetails.Customer.CustomerRep.RepUser.User;
                }
                else
                {
                    repuser = _Context.User.GetSingle(e => e.UserId == userID);
                }
            }
            else
            {
                repuser = _Context.User.GetSingle(e => e.UserId == userID);
            }
            //int repID = repuser.RepID == null ? repuser.Customer.CustomerRep.RepID :(int) repuser.RepID;
            //int repUserId = _Context.User.GetSingle(e => e.RepID == repID).UserId;
            //userProfile = _Context.RepUser.GetSingle(e => e.RepID == UserVM.CRMModelProperties.RepID);
            if (repuser != null)
            {
                contactVM.RepName              = repuser.FirstName + " " + repuser.LastName;
                contactVM.RepEmail             = repuser.Email;
                contactVM.PhoneCustomerService = repuser.RepUsers.FirstOrDefault().PhoneCustomerService;
                contactVM.PhoneDirect          = repuser.RepUsers.FirstOrDefault().PhoneDirect;
                contactVM.AboutRep             = repuser.RepUsers.FirstOrDefault().Biodata;
                contactVM.RepImage             = dir + repuser.RepUsers.FirstOrDefault().RepID + ".jpg";
                contactVM.Title = repuser.RepUsers.FirstOrDefault().Title;
            }
            contactVM.UserVM = UserVM;
            qvs.UserVM       = UserVM;
            contactVM.UserVM.CurrentQuoteID = qvs.getCustomerSCQuoteID();
            return(contactVM);
        }
Exemple #4
0
        FillCRMProperties(UserViewModel usrModelProp, User usr)
        {
            if (usr.webpages_Roles.FirstOrDefault().RoleId == (int)UserRolesEnum.Repo || usr.webpages_Roles.FirstOrDefault().RoleId == (int)UserRolesEnum.AdminRep)
            {
                User custUser = null;
                if (usrModelProp.CRMModelProperties != null)
                {
                    custUser = InsertUpdateUser(usrModelProp);
                }

                usrModelProp.CRMModelProperties.CustFirstName          = custUser.FirstName;
                usrModelProp.CRMModelProperties.CustLastName           = custUser.LastName;
                usrModelProp.CRMModelProperties.CustEmail              = custUser.Email;
                usrModelProp.CRMModelProperties.CustAutoID             = Convert.ToInt32(custUser.CustAutoID);
                usrModelProp.CRMModelProperties.custName               = custUser.Customer == null ? string.Empty : custUser.Customer.CustomerName;
                usrModelProp.CRMModelProperties.CustNO                 = custUser.Customer.CustomerNO;
                usrModelProp.CRMModelProperties.CustParentName         = custUser.Customer.CustomerName;
                usrModelProp.CRMModelProperties.LoggedINCustomerUserID = custUser.UserId;
                usrModelProp.CRMModelProperties.CRMPersonID            = Convert.ToInt32(custUser.PersonID);
                // usrModelProp.CRMModelProperties.Persphone = usrModelProp.CustomerAccountInfoObj.PhoneNuber;
                usrModelProp.CRMModelProperties.RepEmail         = usr.Email;
                usrModelProp.CRMModelProperties.RepID            = usrModelProp.CRMModelProperties.RepID; //(int)usr.RepUsers.FirstOrDefault().RepID;
                usrModelProp.CRMModelProperties.RepName          = usr.UserName;
                usrModelProp.CRMModelProperties.RepPhoneDirect   = usr.RepUsers.FirstOrDefault().PhoneDirect;
                usrModelProp.CRMModelProperties.RepPhoneCustSrvc = usr.RepUsers.FirstOrDefault().PhoneCustomerService;
                usrModelProp.CRMModelProperties.IsUserActive     = (bool)custUser.ISActive;

                usrModelProp.CRMModelProperties.DivNO = usrModelProp != null && usrModelProp.CRMModelProperties != null ? usrModelProp.CRMModelProperties.DivNO : (int)custUser.Customer.DivisionNo;

                usrModelProp.CRMModelProperties.LoggedINUserID  = usr.UserId;
                usrModelProp.CRMModelProperties.IsRepLoggedIN   = true;
                usrModelProp.CRMModelProperties.IsReqPropFilled = true;
                usrModelProp.CustomerAddressBaseModel           = GetCustomerShipToAddress(usrModelProp.CRMModelProperties.CustAutoID);
            }
            else
            {
                RepUser repUser = null;
                if (usr.Customer.CustomerRep == null)
                {
                    repUser = _context.RepUser.GetSingle(e => e.RepUserID == 25);//Defualt repuerid - 25 - Julie.Plantz
                }
                else
                {
                    repUser = _context.RepUser.GetSingle(e => e.RepUserID == usr.Customer.CustomerRep.RepUserID);
                }
                usrModelProp.CRMModelProperties = new CRMModel();
                usrModelProp.CRMModelProperties.CustFirstName          = usr.FirstName;
                usrModelProp.CRMModelProperties.CustLastName           = usr.LastName;
                usrModelProp.CRMModelProperties.CustEmail              = usr.Email;
                usrModelProp.CRMModelProperties.CustAutoID             = Convert.ToInt32(usr.CustAutoID);
                usrModelProp.CRMModelProperties.CustParentName         = usr.Customer.CustomerName;
                usrModelProp.CRMModelProperties.LoggedINCustomerUserID = usr.UserId;
                usrModelProp.CRMModelProperties.CRMPersonID            = Convert.ToInt32(usr.PersonID);
                usrModelProp.CRMModelProperties.CustNO   = usr.Customer.CustomerNO;
                usrModelProp.CRMModelProperties.custName = usr.Customer == null ? string.Empty : usr.Customer.CustomerName;
                // usrModelProp.CRMModelProperties.Persphone = usrModelProp.CustomerAccountInfoObj.PhoneNuber;
                usrModelProp.CRMModelProperties.RepEmail         = repUser.User.Email;
                usrModelProp.CRMModelProperties.RepID            = (int)repUser.RepID;
                usrModelProp.CRMModelProperties.RepName          = repUser.User.UserName;
                usrModelProp.CRMModelProperties.RepPhoneDirect   = repUser.PhoneDirect;
                usrModelProp.CRMModelProperties.RepPhoneCustSrvc = repUser.PhoneCustomerService;
                usrModelProp.CRMModelProperties.IsUserActive     = (bool)usr.ISActive;

                usrModelProp.CRMModelProperties.DivNO = usrModelProp != null && usrModelProp.CRMModelProperties != null ? usrModelProp.CRMModelProperties.DivNO : (int)usr.Customer.DivisionNo;
                usrModelProp.SCCount = GetSCCountByCustID(Convert.ToInt32(usr.UserId));
                usrModelProp.SCPrice = GetSCPriceByCustID(Convert.ToInt32(usr.UserId));

                usrModelProp.CRMModelProperties.LoggedINUserID  = usr.UserId;
                usrModelProp.CRMModelProperties.IsRepLoggedIN   = false;
                usrModelProp.CRMModelProperties.IsReqPropFilled = true;
                usrModelProp.CustomerAddressBaseModel           = GetCustomerShipToAddress(usrModelProp.CRMModelProperties.CustAutoID);
            }
        }
Exemple #5
0
 public LoginController(RepUser repUser)
 {
     _repUser = repUser;
 }
Exemple #6
0
        public CartDWPdfModel GetQuotePdfDetails(int quoteid)
        {
            CartDWPdfModel quotePdfVM = new CartDWPdfModel();
            Quote          quote      = _Context.Quote.GetSingle(e => e.QuoteID == quoteid);

            if (quote != null)
            {
                quotePdfVM.QuoteID = quoteid;
                quotePdfVM.IncludeCatalogStatus = quote.IncludeCatalogStatus != null ? (bool)quote.IncludeCatalogStatus : false;
                List <Item> lstItem       = quote.QuoteDetails.Select(e => e.Item).ToList();
                string      taxschuduleID = quote.User.Customer != null ? quote.User.Customer.TaxScheduleID : null;
                if (string.IsNullOrEmpty(taxschuduleID) || taxschuduleID == "NONTAX")
                {
                    quotePdfVM.SalesTax = 0;
                }
                else
                {
                    quotePdfVM.SalesTax = Convert.ToDecimal(_Context.TaxSchedule.GetSingle(e => e.TaxScheduleID == taxschuduleID).TaxRate);
                }

                string statusenumB = Convert.ToString((char)ItemStatusEnum.OnListButNotPreViewable);
                string statusenumD = Convert.ToString((char)ItemStatusEnum.OnListAndPreViewable);
                quotePdfVM.CartListView = quote.QuoteDetails.Where(e => e.Item.Status == statusenumB || e.Item.Status == statusenumD).Select(c => new CartViewModel
                {
                    Title         = c.Item.Title,
                    Author        = c.Item.Author == null ? "" : c.Item.Author.AuthorName,
                    ISBN          = c.Item.ISBN,
                    AR            = c.Item.ARLevel,
                    Lexile        = c.Item.Lexile,
                    ItemPrice     = (double)c.Item.Price,
                    ItemId        = c.Item.ItemID,
                    DwstatusID    = c.DWSelectionID.ToString(),
                    Quantity      = c.Quantity,
                    Series        = c.Item.SeriesAndCharacter1 == null ? "" : c.Item.SeriesAndCharacter1.SCText,
                    QuoteDetailID = c.QuoteDetailID,
                    AcRcLevelText = (c.Item.ARLevel != null && Convert.ToDouble(c.Item.ARLevel) > 0 ? "AR" : "") + (c.Item.ARLevel != null && c.Item.RCLevel != null && Convert.ToDouble(c.Item.ARLevel) > 0 && Convert.ToDouble(c.Item.RCLevel) > 0 ? "," : "") + (c.Item.RCLevel != null && Convert.ToDouble(c.Item.RCLevel) > 0 ? "RC" : ""),
                    Type          = string.Empty
                }).OrderBy(e => e.Title).ToList();

                if ((bool)quotePdfVM.IncludeCatalogStatus == true)
                {
                    List <FlatFileDetailModel> lstCatalogInfo = GetCatalogInfoData(UserVM.CRMModelProperties.CustAutoID, quoteid, "Cart");
                    quotePdfVM.CartListView.AddRange(lstCatalogInfo.Select(c => new CartViewModel
                    {
                        Title          = c.ItemNumber,
                        Author         = string.Empty,
                        ISBN           = string.Empty,
                        AR             = null,
                        Lexile         = string.Empty,
                        ItemId         = c.ItemCode,
                        Quantity       = c.Quantity,
                        ItemPrice      = c.ItemPrice,
                        Price          = c.Price,
                        IncludeCatalog = c.ItemNumber == "Special Bulk Charge" ? false : true,
                        Type           = "Catalog",
                    }).ToList());
                }

                quotePdfVM.QuoteTypeID     = Convert.ToInt32(quote.QuoteTypeID);
                quotePdfVM.RepoAddress     = new CRMModel();
                quotePdfVM.CustomerAddress = new AddressBaseModel();
                quotePdfVM.QuoteID         = quoteid;
                RepUser repoAddress = null;
                if (quote.User.Customer.CustomerRep != null)
                {
                    repoAddress = quote.User.Customer.CustomerRep.RepUser != null ? quote.User.Customer.CustomerRep.RepUser : null;
                }
                else
                {
                    repoAddress = _Context.RepUser.GetSingle(e => e.RepID == 302); //Default Rep
                }
                quotePdfVM.RepoAddress.RepName   = repoAddress.User != null ? repoAddress.User.FirstName + "  " + repoAddress.User.LastName : string.Empty;
                quotePdfVM.RepoAddress.RepEmail  = repoAddress.User != null ? repoAddress.User.Email : string.Empty;
                quotePdfVM.RepoAddress.Persphone = repoAddress != null ? repoAddress.PhoneCustomerService : string.Empty;
                quotePdfVM.PONo     = quote.QuoteSubmitSaveInfo != null ? quote.QuoteSubmitSaveInfo.PoNo : quote.POText;
                quotePdfVM.Comments = quote.QuoteSubmitSaveInfo != null ? quote.QuoteSubmitSaveInfo.QuoteSubmitComments : quote.Comments;
                CustomerAddress customeraddress = quote.User.Customer.CustomerAddress != null ? quote.User.Customer.CustomerAddress : null;
                quotePdfVM.CustomerAddress.CustomerName = quote.User != null ? quote.User.Customer != null ? quote.User.Customer.CustomerName : string.Empty : string.Empty;;
                quotePdfVM.CustomerAddress.CustomerNo   = customeraddress.Customer.CustomerNO != null ? customeraddress.Customer.CustomerNO : string.Empty;
                if (customeraddress != null)
                {
                    quotePdfVM.CustomerAddress.AddressLine1 = customeraddress.AddressLine1 != null ? customeraddress.AddressLine1 : string.Empty;
                    quotePdfVM.CustomerAddress.AddressLine2 = customeraddress.AddressLine2 != null ? customeraddress.AddressLine2 : string.Empty;
                    quotePdfVM.CustomerAddress.AddressLine3 = customeraddress.AddressLine3 != null ? customeraddress.AddressLine3 : string.Empty;
                    quotePdfVM.CustomerAddress.City         = customeraddress.City != null ? customeraddress.City : string.Empty;
                    quotePdfVM.CustomerAddress.CountryCode  = customeraddress.CountryCode != null ? customeraddress.CountryCode : string.Empty;
                    quotePdfVM.CustomerAddress.State        = customeraddress.State != null ? customeraddress.State : string.Empty;
                    quotePdfVM.CustomerAddress.TelephoneNo  = customeraddress.TelephoneNo != null ? customeraddress.TelephoneNo : string.Empty;
                    quotePdfVM.CustomerAddress.ZipCode      = customeraddress.ZipCode != null ? customeraddress.ZipCode : string.Empty;
                    quotePdfVM.CustomerAddress.CustomerName = customeraddress.Customer.CustomerName != null ? customeraddress.Customer.CustomerName : string.Empty;
                    quotePdfVM.CustomerAddress.CustomerNo   = customeraddress.Customer.CustomerNO != null ? customeraddress.Customer.CustomerNO : string.Empty;
                }
            }
            quotePdfVM.UserVM = UserVM;
            quotePdfVM.UserVM.CRMModelProperties.LoggedINCustomerUserID = quote.UserID;
            // quotePdfVM.UserVM.SCCount = quote.QuoteDetails.Sum(e => e.Quantity);

            return(quotePdfVM);
        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     RepUser ds = new RepUser();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "logsDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     RepUser ds = new RepUser();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public virtual int Update(RepUser dataSet) {
     return this.Adapter.Update(dataSet, "logs");
 }
 public virtual int Update(RepUser.logsDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
 public virtual int Fill(RepUser.logsDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }