/// <summary>
    /// Sets the data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check module permissions
        bool global = (editedSiteId <= 0);
        if (!ECommerceContext.IsUserAuthorizedToModifySupplier(global))
        {
            if (global)
            {
                RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify");
            }
            else
            {
                RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifySuppliers");
            }
        }

        string errorMessage = new Validator().NotEmpty(txtSupplierDisplayName.Text.Trim(), GetString("supplier_Edit.errorEmptyDisplayName")).Result;

        // Validate email format if not empty
        if (errorMessage == "")
        {
            if ((txtSupplierEmail.Text.Trim() != "") && (!ValidationHelper.IsEmail(txtSupplierEmail.Text.Trim())))
            {
                errorMessage = GetString("supplier_Edit.errorEmailFormat");
            }
        }

        if (errorMessage == "")
        {
            SupplierInfo supplierObj = SupplierInfoProvider.GetSupplierInfo(mSupplierId);

            if (supplierObj == null)
            {
                supplierObj = new SupplierInfo();
                // Assign site ID
                supplierObj.SupplierSiteID = ConfiguredSiteID;
            }

            supplierObj.SupplierFax = txtSupplierFax.Text.Trim();
            supplierObj.SupplierEmail = txtSupplierEmail.Text.Trim();
            supplierObj.SupplierPhone = txtSupplierPhone.Text.Trim();
            supplierObj.SupplierDisplayName = txtSupplierDisplayName.Text.Trim();
            supplierObj.SupplierEnabled = chkSupplierEnabled.Checked;

            // Save changes
            SupplierInfoProvider.SetSupplierInfo(supplierObj);

            URLHelper.Redirect("Supplier_Edit.aspx?supplierid=" + Convert.ToString(supplierObj.SupplierID) + "&saved=1&siteId=" + SiteID);

        }
        else
        {
            lblError.Visible = true;
            lblError.Text = errorMessage;
        }
    }
 public IncomingInvoiceRegisteredEvent(Guid invoiceId, string invoiceNumber, DateTime invoiceDate, decimal amount, decimal taxes, decimal totalPrice, string description, string paymentTerms, string purchaseOrderNumber, Guid supplierId, string supplierName, string streetName, string city, string postalCode, string country, string vatIndex, string nationalIdentificationNumber)
 {
     var supplier = new SupplierInfo(
         city: city,
         supplierName: supplierName,
         country: country,
         supplierId: supplierId,
         nationalIdentificationNumber: nationalIdentificationNumber,
         postalCode: postalCode,
         streetName: streetName,
         vatIndex: vatIndex
     );
     Supplier = supplier;
     InvoiceId = invoiceId;
     InvoiceNumber = invoiceNumber;
     InvoiceDate = invoiceDate;
     Amount = amount;
     Taxes = taxes;
     TotalPrice = totalPrice;
     Description = description;
     PaymentTerms = paymentTerms;
     PurchaseOrderNumber = purchaseOrderNumber;
 }
Beispiel #3
0
 public void InsertSupplier(SupplierInfo SuppInfo)
 {
     suppDao.InsertSupplierInfo(SuppInfo);
 }
Beispiel #4
0
        public ActionResult Registre(Models.UserRegistreViewModel userRegistreViewModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(View());
            }

            #region Server Side Validation
            bool modelStateFail = false;

            if (string.IsNullOrEmpty(userRegistreViewModel.Name))
            {
                this.ModelState.AddModelError("Name", "Name field is required!");
                modelStateFail = true;
            }

            if (string.IsNullOrEmpty(userRegistreViewModel.Login))
            {
                this.ModelState.AddModelError("Login", "Login field is required!");
                modelStateFail = true;
            }

            if (string.IsNullOrEmpty(userRegistreViewModel.Password))
            {
                this.ModelState.AddModelError("Password", "Password field is required!");
                modelStateFail = true;
            }

            if (string.IsNullOrEmpty(userRegistreViewModel.PasswordConfirm))
            {
                this.ModelState.AddModelError("PasswordConfirm", "Confirm password field is required!");
                modelStateFail = true;
            }

            if (string.IsNullOrEmpty(userRegistreViewModel.Email))
            {
                this.ModelState.AddModelError("Email", "Emailfield is required!");
                modelStateFail = true;
            }

            if (string.IsNullOrEmpty(userRegistreViewModel.EmailConfirm))
            {
                this.ModelState.AddModelError("EmailConfirm", "Confirm email field is required!");
                modelStateFail = true;
            }

            if (!userRegistreViewModel.Email.Equals(userRegistreViewModel.EmailConfirm))
            {
                this.ModelState.AddModelError("EmailConfirm", "Confirm email is different!");
                modelStateFail = true;
            }

            if (!userRegistreViewModel.Password.Equals(userRegistreViewModel.PasswordConfirm))
            {
                this.ModelState.AddModelError("PasswordConfirm", "Confirm password is different!");
                modelStateFail = true;
            }


            if (iServiceUser.AlreadyRegistredEmail(userRegistreViewModel.Email))
            {
                this.ModelState.AddModelError("Email", "Email alread registred!");
                modelStateFail = true;
            }

            if (modelStateFail)
            {
                return(View());
            }
            #endregion



            User user = new Model.Users.User()
            {
                Name     = userRegistreViewModel.Name,
                Login    = userRegistreViewModel.Login,
                Email    = userRegistreViewModel.Email,
                Password = userRegistreViewModel.Password,
                UserType = userRegistreViewModel.UserType
            };


            this.iServiceUser.Insert(user);
            this.iUnitOfWorkAsync.SaveChanges();


            IServiceRole serviceRole = DependencyResolver.Current.GetService <ServiceRole>();
            string       roleName    = "";

            if (user.UserType == Model.Enums.UserType.Supplier)
            {
                roleName = "Supplier";
                IServiceSupplierInfo serviceSupplierInfo = DependencyResolver.Current.GetService <ServiceSupplierInfo>();
                SupplierInfo         SupplierInfo        = new SupplierInfo();
                SupplierInfo.User = user;
                serviceSupplierInfo.Insert(SupplierInfo);
            }
            else if (user.UserType == Model.Enums.UserType.Custumer)
            {
                roleName = "Custumer";
                IServiceCustumerInfo seviceCustumerInfo = DependencyResolver.Current.GetService <ServiceCustumerInfo>();
                CustumerInfo         custumerInfo       = new CustumerInfo();
                custumerInfo.User = user;
                seviceCustumerInfo.Insert(custumerInfo);
            }

            serviceRole.AddUserOnRole(roleName, user);

            this.iUnitOfWorkAsync.SaveChanges();


            FormsAuthentication.SetAuthCookie(user.Email, false);

            ModelState.Remove("Password");



            return(RedirectToAction("Edit", "User", new { id = user.ID }));
            //return View();
        }
Beispiel #5
0
 public void DeleteSupplier(SupplierInfo SuppInfo)
 {
     suppDao.DeleteSupplierBySupplierID(SuppInfo);
 }
    /// <summary>
    /// Sets the data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check module permissions
        bool global = (editedSiteId <= 0);
        if (!ECommerceContext.IsUserAuthorizedToModifySupplier(global))
        {
            if (global)
            {
                RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify");
            }
            else
            {
                RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifySuppliers");
            }
        }

        string errorMessage = new Validator().
            NotEmpty(txtSupplierDisplayName.Text.Trim(), GetString("supplier_Edit.errorEmptyDisplayName")).
            IsCodeName(txtSupplierName.Text.Trim(), GetString("general.invalidcodename")).Result;

        // Validate email format if not empty
        if (errorMessage == "")
        {
            if ((txtSupplierEmail.Text.Trim() != "") && (!ValidationHelper.IsEmail(txtSupplierEmail.Text.Trim())))
            {
                errorMessage = GetString("supplier_Edit.errorEmailFormat");
            }
        }

        if (errorMessage == "")
        {
            SupplierInfo supplierObj = null;

            // Supplier code name must be unique
            string siteWhere = (ConfiguredSiteID > 0) ? " AND (SupplierSiteID = " + ConfiguredSiteID + " OR SupplierSiteID IS NULL)" : "";
            DataSet ds = SupplierInfoProvider.GetSuppliers("SupplierName = N'" + SqlHelperClass.GetSafeQueryString(txtSupplierName.Text.Trim(), false) + "'" + siteWhere, null, 1, null);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                supplierObj = new SupplierInfo(ds.Tables[0].Rows[0]);
            }

            if ((supplierObj == null) || (supplierObj.SupplierID == mSupplierId))
            {
                if (supplierObj == null)
                {
                    supplierObj = SupplierInfoProvider.GetSupplierInfo(mSupplierId);
                    if (supplierObj == null)
                    {
                        // Create new supplier
                        supplierObj = new SupplierInfo();
                        supplierObj.SupplierSiteID = ConfiguredSiteID;
                    }
                }

                supplierObj.SupplierFax = txtSupplierFax.Text.Trim();
                supplierObj.SupplierEmail = txtSupplierEmail.Text.Trim();
                supplierObj.SupplierPhone = txtSupplierPhone.Text.Trim();
                supplierObj.SupplierDisplayName = txtSupplierDisplayName.Text.Trim();
                supplierObj.SupplierName = txtSupplierName.Text.Trim();
                supplierObj.SupplierEnabled = chkSupplierEnabled.Checked;

                // Save changes
                SupplierInfoProvider.SetSupplierInfo(supplierObj);

                URLHelper.Redirect("Supplier_Edit.aspx?supplierid=" + Convert.ToString(supplierObj.SupplierID) + "&saved=1&siteId=" + SiteID);
            }
            else
            {
                // Show error message
                ShowError(GetString("com.suppliernameexists"));
            }
        }
        else
        {
            // Show error message
            ShowError(errorMessage);
        }
    }
Beispiel #7
0
 public static bool UpdateSupplier(SupplierInfo supplier)
 {
     return(new SupplierDao().Update(supplier, null));
 }
Beispiel #8
0
 public int InsertSupplier(SupplierInfo supplier, SqlTransaction trans)
 {
     string sql = @"INSERT INTO [Supplier]
                            ([SupplierNO]
                            ,[Name]
                            ,[ZipCode]
                            ,[Address]
                            ,[Tel]
                            ,[Fax]
                            ,[StaffName]
                            ,[Email]
                            ,[InsertDateTime]
                            ,[InsertUser])
                      VALUES
                            (@SupplierNO
                            ,@Name
                            ,@ZipCode
                            ,@Address
                            ,@Tel
                            ,@Fax
                            ,@StaffName
                            ,@Email
                            ,@InsertDateTime
                            ,@InsertUser)";
     SqlParameter[] spvalues = DBTool.GetSqlPm(supplier);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }
Beispiel #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SupplierInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SupplierInfo(");
            strSql.Append("CompanyWebsite,CompanyPhone,CautionMoney,Guarantee,GuaranteeMobile,Balance,LockBalance,TotalBalance,Type,State,SignName,CreateTime,UpdateTime,Remark,extend1,extend2,extend3,extend4,extend5,UserName,UserMobile,UserEmail,UserAdress,UserQQ,UserWechat,CorporateName");
            strSql.Append(") values (");
            strSql.Append("@CompanyWebsite,@CompanyPhone,@CautionMoney,@Guarantee,@GuaranteeMobile,@Balance,@LockBalance,@TotalBalance,@Type,@State,@SignName,@CreateTime,@UpdateTime,@Remark,@extend1,@extend2,@extend3,@extend4,@extend5,@UserName,@UserMobile,@UserEmail,@UserAdress,@UserQQ,@UserWechat,@CorporateName");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyWebsite",  SqlDbType.NVarChar,  200),
                new SqlParameter("@CompanyPhone",    SqlDbType.VarChar,   100),
                new SqlParameter("@CautionMoney",    SqlDbType.VarChar,   200),
                new SqlParameter("@Guarantee",       SqlDbType.NVarChar,   50),
                new SqlParameter("@GuaranteeMobile", SqlDbType.VarChar,   200),
                new SqlParameter("@Balance",         SqlDbType.VarChar,    50),
                new SqlParameter("@LockBalance",     SqlDbType.VarChar,    50),
                new SqlParameter("@TotalBalance",    SqlDbType.VarChar,    50),
                new SqlParameter("@Type",            SqlDbType.TinyInt,     1),
                new SqlParameter("@State",           SqlDbType.TinyInt,     1),
                new SqlParameter("@SignName",        SqlDbType.NVarChar,  100),
                new SqlParameter("@CreateTime",      SqlDbType.DateTime),
                new SqlParameter("@UpdateTime",      SqlDbType.DateTime),
                new SqlParameter("@Remark",          SqlDbType.NVarChar,  500),
                new SqlParameter("@extend1",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend2",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend3",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend4",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend5",         SqlDbType.NVarChar,  200),
                new SqlParameter("@UserName",        SqlDbType.NVarChar,   50),
                new SqlParameter("@UserMobile",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserEmail",       SqlDbType.VarChar,   100),
                new SqlParameter("@UserAdress",      SqlDbType.NVarChar,  500),
                new SqlParameter("@UserQQ",          SqlDbType.VarChar,    50),
                new SqlParameter("@UserWechat",      SqlDbType.VarChar,   200),
                new SqlParameter("@CorporateName",   SqlDbType.NVarChar, 100)
            };

            parameters[0].Value  = model.CompanyWebsite;
            parameters[1].Value  = model.CompanyPhone;
            parameters[2].Value  = model.CautionMoney;
            parameters[3].Value  = model.Guarantee;
            parameters[4].Value  = model.GuaranteeMobile;
            parameters[5].Value  = model.Balance;
            parameters[6].Value  = model.LockBalance;
            parameters[7].Value  = model.TotalBalance;
            parameters[8].Value  = model.Type;
            parameters[9].Value  = model.State;
            parameters[10].Value = model.SignName;
            parameters[11].Value = model.CreateTime;
            parameters[12].Value = model.UpdateTime;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.extend1;
            parameters[15].Value = model.extend2;
            parameters[16].Value = model.extend3;
            parameters[17].Value = model.extend4;
            parameters[18].Value = model.extend5;
            parameters[19].Value = model.UserName;
            parameters[20].Value = model.UserMobile;
            parameters[21].Value = model.UserEmail;
            parameters[22].Value = model.UserAdress;
            parameters[23].Value = model.UserQQ;
            parameters[24].Value = model.UserWechat;
            parameters[25].Value = model.CorporateName;

            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #10
0
 /// <summary>
 /// 修改数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Update(SupplierInfo model)
 {
     return(dal.Update(model));
 }
Beispiel #11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SupplierInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SupplierInfo set ");

            strSql.Append(" CompanyWebsite = @CompanyWebsite , ");
            strSql.Append(" CompanyPhone = @CompanyPhone , ");
            strSql.Append(" CautionMoney = @CautionMoney , ");
            strSql.Append(" Guarantee = @Guarantee , ");
            strSql.Append(" GuaranteeMobile = @GuaranteeMobile , ");
            strSql.Append(" Balance = @Balance , ");
            strSql.Append(" LockBalance = @LockBalance , ");
            strSql.Append(" TotalBalance = @TotalBalance , ");
            strSql.Append(" Type = @Type , ");
            strSql.Append(" State = @State , ");
            strSql.Append(" SignName = @SignName , ");
            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" UpdateTime = @UpdateTime , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" extend1 = @extend1 , ");
            strSql.Append(" extend2 = @extend2 , ");
            strSql.Append(" extend3 = @extend3 , ");
            strSql.Append(" extend4 = @extend4 , ");
            strSql.Append(" extend5 = @extend5 , ");
            strSql.Append(" UserName = @UserName , ");
            strSql.Append(" UserMobile = @UserMobile , ");
            strSql.Append(" UserEmail = @UserEmail , ");
            strSql.Append(" UserAdress = @UserAdress , ");
            strSql.Append(" UserQQ = @UserQQ , ");
            strSql.Append(" UserWechat = @UserWechat , ");
            strSql.Append(" CorporateName = @CorporateName  ");
            strSql.Append(" where SId=@SId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@SId",             SqlDbType.Int,         4),
                new SqlParameter("@CompanyWebsite",  SqlDbType.NVarChar,  200),
                new SqlParameter("@CompanyPhone",    SqlDbType.VarChar,   100),
                new SqlParameter("@CautionMoney",    SqlDbType.VarChar,   200),
                new SqlParameter("@Guarantee",       SqlDbType.NVarChar,   50),
                new SqlParameter("@GuaranteeMobile", SqlDbType.VarChar,   200),
                new SqlParameter("@Balance",         SqlDbType.VarChar,    50),
                new SqlParameter("@LockBalance",     SqlDbType.VarChar,    50),
                new SqlParameter("@TotalBalance",    SqlDbType.VarChar,    50),
                new SqlParameter("@Type",            SqlDbType.TinyInt,     1),
                new SqlParameter("@State",           SqlDbType.TinyInt,     1),
                new SqlParameter("@SignName",        SqlDbType.NVarChar,  100),
                new SqlParameter("@CreateTime",      SqlDbType.DateTime),
                new SqlParameter("@UpdateTime",      SqlDbType.DateTime),
                new SqlParameter("@Remark",          SqlDbType.NVarChar,  500),
                new SqlParameter("@extend1",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend2",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend3",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend4",         SqlDbType.NVarChar,  200),
                new SqlParameter("@extend5",         SqlDbType.NVarChar,  200),
                new SqlParameter("@UserName",        SqlDbType.NVarChar,   50),
                new SqlParameter("@UserMobile",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserEmail",       SqlDbType.VarChar,   100),
                new SqlParameter("@UserAdress",      SqlDbType.NVarChar,  500),
                new SqlParameter("@UserQQ",          SqlDbType.VarChar,    50),
                new SqlParameter("@UserWechat",      SqlDbType.VarChar,   200),
                new SqlParameter("@CorporateName",   SqlDbType.NVarChar, 100)
            };

            parameters[0].Value  = model.SId;
            parameters[1].Value  = model.CompanyWebsite;
            parameters[2].Value  = model.CompanyPhone;
            parameters[3].Value  = model.CautionMoney;
            parameters[4].Value  = model.Guarantee;
            parameters[5].Value  = model.GuaranteeMobile;
            parameters[6].Value  = model.Balance;
            parameters[7].Value  = model.LockBalance;
            parameters[8].Value  = model.TotalBalance;
            parameters[9].Value  = model.Type;
            parameters[10].Value = model.State;
            parameters[11].Value = model.SignName;
            parameters[12].Value = model.CreateTime;
            parameters[13].Value = model.UpdateTime;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.extend1;
            parameters[16].Value = model.extend2;
            parameters[17].Value = model.extend3;
            parameters[18].Value = model.extend4;
            parameters[19].Value = model.extend5;
            parameters[20].Value = model.UserName;
            parameters[21].Value = model.UserMobile;
            parameters[22].Value = model.UserEmail;
            parameters[23].Value = model.UserAdress;
            parameters[24].Value = model.UserQQ;
            parameters[25].Value = model.UserWechat;
            parameters[26].Value = model.CorporateName;
            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SupplierInfo GetModel(int SId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select SId, CompanyWebsite, CompanyPhone, CautionMoney, Guarantee, GuaranteeMobile, Balance, LockBalance, TotalBalance, Type, State, SignName, CreateTime, UpdateTime, Remark, extend1, extend2, extend3, extend4, extend5, UserName, UserMobile, UserEmail, UserAdress, UserQQ, UserWechat, CorporateName  ");
            strSql.Append("  from SupplierInfo ");
            strSql.Append(" where SId=@SId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SId", SqlDbType.Int, 4)
            };
            parameters[0].Value = SId;


            SupplierInfo model = new SupplierInfo();
            DataSet      ds    = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SId"].ToString() != "")
                {
                    model.SId = int.Parse(ds.Tables[0].Rows[0]["SId"].ToString());
                }
                model.CompanyWebsite  = ds.Tables[0].Rows[0]["CompanyWebsite"].ToString();
                model.CompanyPhone    = ds.Tables[0].Rows[0]["CompanyPhone"].ToString();
                model.CautionMoney    = ds.Tables[0].Rows[0]["CautionMoney"].ToString();
                model.Guarantee       = ds.Tables[0].Rows[0]["Guarantee"].ToString();
                model.GuaranteeMobile = ds.Tables[0].Rows[0]["GuaranteeMobile"].ToString();
                model.Balance         = ds.Tables[0].Rows[0]["Balance"].ToString();
                model.LockBalance     = ds.Tables[0].Rows[0]["LockBalance"].ToString();
                model.TotalBalance    = ds.Tables[0].Rows[0]["TotalBalance"].ToString();
                if (ds.Tables[0].Rows[0]["Type"].ToString() != "")
                {
                    model.Type = int.Parse(ds.Tables[0].Rows[0]["Type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["State"].ToString() != "")
                {
                    model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
                }
                model.SignName = ds.Tables[0].Rows[0]["SignName"].ToString();
                if (ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(ds.Tables[0].Rows[0]["UpdateTime"].ToString());
                }
                model.Remark     = ds.Tables[0].Rows[0]["Remark"].ToString();
                model.extend1    = ds.Tables[0].Rows[0]["extend1"].ToString();
                model.extend2    = ds.Tables[0].Rows[0]["extend2"].ToString();
                model.extend3    = ds.Tables[0].Rows[0]["extend3"].ToString();
                model.extend4    = ds.Tables[0].Rows[0]["extend4"].ToString();
                model.extend5    = ds.Tables[0].Rows[0]["extend5"].ToString();
                model.UserName   = ds.Tables[0].Rows[0]["UserName"].ToString();
                model.UserMobile = ds.Tables[0].Rows[0]["UserMobile"].ToString();
                model.UserEmail  = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                model.UserAdress = ds.Tables[0].Rows[0]["UserAdress"].ToString();
                if (ds.Tables[0].Rows[0]["UserQQ"].ToString() != "")
                {
                    model.UserQQ = ds.Tables[0].Rows[0]["UserQQ"].ToString();
                }
                model.UserWechat    = ds.Tables[0].Rows[0]["UserWechat"].ToString();
                model.CorporateName = ds.Tables[0].Rows[0]["CorporateName"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("productId", false), out this.productId))
            {
                base.GotoResourceNotFound();
            }
            this.hidSupName              = (HtmlInputHidden)this.FindControl("hidSupName");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblMarkerPrice          = (FormatedMoneyLabel)this.FindControl("lblMarkerPrice");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.btnaddgouwu             = (AddCartButton)this.FindControl("btnaddgouwu");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.phonePriceQrCode        = (Image)this.FindControl("phonePriceQrCode");
            this.liCode                  = (HtmlGenericControl)this.FindControl("liCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgpdorequest           = (HtmlImage)this.FindControl("imgpdorequest");
            this.imgTakeonstore          = (HtmlImage)this.FindControl("imgTakeonstore");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divOrderPromotions2     = (HtmlGenericControl)this.FindControl("divOrderPromotions2");
            this.divOrderPromotions3     = (HtmlGenericControl)this.FindControl("divOrderPromotions3");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.hidShowCombinationBuy   = (HtmlInputHidden)this.FindControl("hidShowCombinationBuy");
            this.hidCombinationId        = (HtmlInputHidden)this.FindControl("hidCombinationId");
            this.imgMainPic              = (HtmlImage)this.FindControl("imgMainPic");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            HtmlAnchor htmlAnchor = (HtmlAnchor)this.FindControl("aMainName");

            this.lblMainPrice = (Label)this.FindControl("lblMainPrice");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.spdiscount            = (HtmlGenericControl)this.FindControl("spdiscount");
            this.aCountDownUrl.Visible = false;
            this.buyProduct            = (HtmlTableRow)this.FindControl("buyProduct");
            this.serviceProduct        = (HtmlTableRow)this.FindControl("serviceProduct");
            if (this.Page.IsPostBack)
            {
                return;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.spdiscount != null && HiContext.Current.User.UserId > 0)
            {
                MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId);
                this.spdiscount.Visible   = true;
                this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>";
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            if (this.phonePriceQrCode != null)
            {
                string text2 = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text2, false, ImageFormats.Png);
                this.phonePriceQrCode.ImageUrl = text2;
            }
            if (this.liCode != null && HiContext.Current.SiteSettings.OpenAliho == 0 && HiContext.Current.SiteSettings.OpenVstore == 0 && HiContext.Current.SiteSettings.OpenWap == 0 && HiContext.Current.SiteSettings.OpenMobbile == 0)
            {
                this.liCode.Visible = false;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, 0);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SupplierId > 0 && productBrowseInfo.Product.AuditStatus != ProductAuditStatus.Pass)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetailsaudit", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            this.ActivityBusiness();
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            this.btnBuy.Stock  = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.ltlUnit.Text  = productBrowseInfo.Product.Unit;
            this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0c9e;
                }
                decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_0c9e;
                }
            }
            goto IL_0cd8;
IL_0cd9:
            int num2;

            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            this.btnaddgouwu.Stock = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            int supplierId = productBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (!string.IsNullOrEmpty(supplierById.Picture))
                {
                    this.imgBrand.ImageUrl = supplierById.Picture;
                }
                else if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory.BrandId
                        });
                    }
                }
                else
                {
                    this.imgBrand.Visible = false;
                }
                this.litSupplierName.Text = "<a href=\"/SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>";
                this.hidSupName.Value     = supplierById.SupplierName;
            }
            else
            {
                this.litSupplierName.Visible = false;
                if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory2.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory2.BrandId
                        });
                    }
                }
            }
            if (SalesHelper.IsSupportPodrequest() && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgpdorequest.Visible = true;
            }
            if (masterSettings.OpenMultStore)
            {
                if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId))
                {
                    this.imgTakeonstore.Visible = true;
                }
            }
            else if (masterSettings.IsOpenPickeupInStore && productBrowseInfo.Product.SupplierId == 0)
            {
                this.imgTakeonstore.Visible = true;
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible && !this.divPhonePrice.Visible)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
            if (productBrowseInfo.Product.Stock > 0)
            {
                CombinationBuyInfo combinationBuyByMainProductId = CombinationBuyHelper.GetCombinationBuyByMainProductId(this.productId);
                if (combinationBuyByMainProductId != null)
                {
                    List <CombinationBuyandProductUnionInfo> combinationProductListByProductId = CombinationBuyHelper.GetCombinationProductListByProductId(this.productId);
                    CombinationBuyandProductUnionInfo        combinationBuyandProductUnionInfo = combinationProductListByProductId.FirstOrDefault((CombinationBuyandProductUnionInfo c) => c.ProductId == this.productId);
                    if (combinationBuyandProductUnionInfo != null)
                    {
                        HtmlInputHidden htmlInputHidden = this.hidCombinationId;
                        num = combinationBuyandProductUnionInfo.CombinationId;
                        htmlInputHidden.Value = num.ToString();
                        string value2 = string.IsNullOrEmpty(combinationBuyandProductUnionInfo.ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationBuyandProductUnionInfo.ThumbnailUrl100;
                        this.imgMainPic.Attributes["data-url"] = value2;
                        htmlAnchor.InnerText   = combinationBuyandProductUnionInfo.ProductName;
                        this.lblMainPrice.Text = combinationBuyandProductUnionInfo.MinCombinationPrice.F2ToString("f2");
                        this.lblMainPrice.Attributes["salePrice"] = combinationBuyandProductUnionInfo.MinSalePrice.F2ToString("f2");
                    }
                    combinationProductListByProductId.Remove(combinationBuyandProductUnionInfo);
                    if (combinationProductListByProductId != null && combinationProductListByProductId.Count > 0)
                    {
                        for (int i = 0; i < combinationProductListByProductId.Count; i++)
                        {
                            string thumbnailUrl = string.IsNullOrEmpty(combinationProductListByProductId[i].ThumbnailUrl100) ? this.sitesettings.DefaultProductThumbnail3 : combinationProductListByProductId[i].ThumbnailUrl100;
                            combinationProductListByProductId[i].ThumbnailUrl100 = thumbnailUrl;
                            combinationProductListByProductId[i].Index           = i + 1;
                        }
                        themedTemplatedRepeater.DataSource = combinationProductListByProductId;
                        themedTemplatedRepeater.DataBind();
                        this.hidShowCombinationBuy.Value = "1";
                    }
                }
            }
            return;

IL_0cd8:
            num2 = 1;
            goto IL_0cd9;
IL_0c9e:
            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
            {
                num2 = (user.Referral.IsRepeled ? 1 : 0);
                goto IL_0cd9;
            }
            goto IL_0cd8;
        }
 public static async Task <Supplier> SupplierHasAdditionalServiceMoreThan1Price(string bapiConnectionString)
 {
     return(await SupplierInfo.GetSupplierWithCatalogueItemWithMoreThan1Price(CatalogueItemType.AdditionalService, bapiConnectionString));
 }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        rfvDisplayName.ErrorMessage = GetString("supplier_Edit.errorEmptyDisplayName");

        // control initializations
        lblSupplierFax.Text         = GetString("supplier_Edit.SupplierFaxLabel");
        lblSupplierEmail.Text       = GetString("supplier_Edit.SupplierEmailLabel");
        lblSupplierPhone.Text       = GetString("supplier_Edit.SupplierPhoneLabel");
        lblSupplierDisplayName.Text = GetString("supplier_Edit.SupplierDisplayNameLabel");

        btnOk.Text = GetString("General.OK");

        string currentSupplier = GetString("supplier_Edit.NewItemCaption");

        // Get supplier ID from querystring
        mSupplierId  = QueryHelper.GetInteger("supplierid", 0);
        editedSiteId = ConfiguredSiteID;

        if (mSupplierId > 0)
        {
            SupplierInfo supplierObj = SupplierInfoProvider.GetSupplierInfo(mSupplierId);
            EditedObject = supplierObj;

            if (supplierObj != null)
            {
                currentSupplier = supplierObj.SupplierDisplayName;
                // Store site id of edited supplier
                editedSiteId = supplierObj.SupplierSiteID;

                //Check site id of edited supplier
                CheckEditedObjectSiteID(editedSiteId);

                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(supplierObj);

                    // Show that the supplier was created or updated successfully
                    if (QueryHelper.GetBoolean("saved", false))
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("General.ChangesSaved");
                    }
                }
            }
        }

        this.CurrentMaster.Title.HelpTopicName = "newedit_supplier";
        this.CurrentMaster.Title.HelpName      = "helpTopic";

        // Initializes page title breadcrumbs control
        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("supplier_Edit.ItemListLink");
        breadcrumbs[0, 1]     = "~/CMSModules/Ecommerce/Pages/Tools/Suppliers/Supplier_List.aspx?siteId=" + this.SiteID;
        breadcrumbs[0, 2]     = "";
        breadcrumbs[1, 0]     = FormatBreadcrumbObjectName(currentSupplier, editedSiteId);
        breadcrumbs[1, 1]     = "";
        breadcrumbs[1, 2]     = "";
        this.CurrentMaster.Title.Breadcrumbs = breadcrumbs;

        // Set master title
        if (mSupplierId > 0)
        {
            this.CurrentMaster.Title.TitleText  = GetString("com.supplier.edit");
            this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_Supplier/object.png");
        }
        else
        {
            this.CurrentMaster.Title.TitleText  = GetString("supplier_List.NewItemCaption");
            this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Ecommerce_Supplier/new.png");
        }

        AddMenuButtonSelectScript("Suppliers", "");
    }
Beispiel #16
0
        public ActionResult CreateSupInfo(SupInfoViewModel SupInfoModel)
        {
            //if (!ModelState.IsValid)
            //{
            //    BuyerSupAcc_Parent p = new BuyerSupAcc_Parent();
            //    p.SupInfoModel = SupInfoModel;
            //    return View("Create", p);
            //}

            //檢查是否有公司可選
            var result = getAllSupInfoNoContactOnlySupInfoToIndexAjax().Data;
            var data   = JsonConvert.SerializeObject(result);

            if (data == "[]")
            {
                try
                {
                    //supInfo
                    var          maxsupThanOID = db.SupplierInfo.Select(x => x.SupplierInfoOID).Max() + 1;
                    string       SupCodestr    = String.Format("S{0:00000}", Convert.ToDouble(maxsupThanOID));
                    SupplierInfo supinfo       = new SupplierInfo();
                    supinfo.SupplierCode      = SupCodestr;
                    supinfo.SupplierName      = SupInfoModel.SupplierName;
                    supinfo.TaxID             = SupInfoModel.TaxID;
                    supinfo.Tel               = SupInfoModel.Tel;
                    supinfo.Email             = SupInfoModel.Email;
                    supinfo.Address           = SupInfoModel.Address;
                    supinfo.SupplierRatingOID = null;

                    db.SupplierInfo.Add(supinfo);
                    var r1 = db.SaveChanges();
                    if (r1 > 0)
                    {
                        //新增公司後回到view
                        TempData["Success"] = $"{supinfo.SupplierName} 更新成功";
                        return(RedirectToAction("Create"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "填寫欄位有錯誤");
                        BuyerSupAcc_Parent p = new BuyerSupAcc_Parent();
                        p.SupInfoModel = SupInfoModel;
                        return(View("Create", p));
                    }
                }
                catch (DbEntityValidationException ex)
                {
                    var entityError      = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                    var getFullMessage   = string.Join("; ", entityError);
                    var exceptionMessage = string.Concat(ex.Message, "errors are: ", getFullMessage);
                    Console.WriteLine(exceptionMessage);
                    if (!ModelState.IsValid)
                    {
                        BuyerSupAcc_Parent p = new BuyerSupAcc_Parent();
                        p.SupInfoModel = SupInfoModel;
                        return(View("Create", p));
                    }
                }
            }
            //新增公司後回到view
            TempData["Success"] = "更新成功";
            return(RedirectToAction("Create"));
        }
Beispiel #17
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("PreSaleId", false), out this.preSaleId))
            {
                base.GotoResourceNotFound();
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);

            if (productPreSaleInfo == null)
            {
                base.GotoResourceNotFound();
            }
            this.productId = productPreSaleInfo.ProductId;
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("/ProductDetails.aspx?productId=" + this.productId);
                return;
            }
            this.hidSupName              = (HtmlInputHidden)this.FindControl("hidSupName");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divOrderPromotions2     = (HtmlGenericControl)this.FindControl("divOrderPromotions2");
            this.divOrderPromotions4     = (HtmlGenericControl)this.FindControl("divOrderPromotions4");
            this.divOrderPromotions3     = (HtmlGenericControl)this.FindControl("divOrderPromotions3");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlPromotionSendGifts   = (Literal)this.FindControl("ltlPromotionSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            this.lblPaymentStartDate    = (Label)this.FindControl("lblPaymentStartDate");
            this.lblPaymentEndDate      = (Label)this.FindControl("lblPaymentEndDate");
            this.lblDelivery            = (Label)this.FindControl("lblDelivery");
            this.lblDepositPercent      = (Label)this.FindControl("lblDepositPercent");
            this.lblDeposit             = (Label)this.FindControl("lblDeposit");
            this.lblFinalPaymentPercent = (Label)this.FindControl("lblFinalPaymentPercent");
            this.lblFinalPayment        = (Label)this.FindControl("lblFinalPayment");
            this.hidEndDate             = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate             = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hidDepositPercent      = (HtmlInputHidden)this.FindControl("hidDepositPercent");
            this.hidDeposit             = (HtmlInputHidden)this.FindControl("hidDeposit");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.aCountDownUrl.Visible = false;
            if (this.Page.IsPostBack)
            {
                return;
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, -1);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            this.ActivityBusiness();
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            HtmlInputHidden htmlInputHidden = this.hidNowDate;
            DateTime        dateTime        = DateTime.Now;

            htmlInputHidden.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            HtmlInputHidden htmlInputHidden2 = this.hidEndDate;

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            Label label = this.lblPaymentStartDate;

            dateTime   = productPreSaleInfo.PaymentStartDate;
            label.Text = dateTime.ToString("yyyy.MM.dd");
            Label label2 = this.lblPaymentEndDate;

            dateTime    = productPreSaleInfo.PaymentEndDate;
            label2.Text = dateTime.ToString("yyyy.MM.dd");
            Label  label3 = this.lblDelivery;
            object text2;

            if (productPreSaleInfo.DeliveryDays <= 0)
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text2    = dateTime.ToString("yyyy.MM.dd") + "前发货";
            }
            else
            {
                text2 = "尾款支付后" + productPreSaleInfo.DeliveryDays + "天发货";
            }
            label3.Text = (string)text2;
            decimal d;

            if (productPreSaleInfo.DepositPercent > 0)
            {
                this.lblDepositPercent.Text      = "定金:" + productPreSaleInfo.DepositPercent + "%";
                this.lblFinalPaymentPercent.Text = "尾款:" + (100 - productPreSaleInfo.DepositPercent) + "%";
                decimal num2 = Math.Round(productBrowseInfo.Product.MinSalePrice * (decimal)productPreSaleInfo.DepositPercent / 100m, 2);
                this.lblDeposit.Text      = "¥" + num2;
                this.lblFinalPayment.Text = "¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - num2, 2);
                HtmlInputHidden htmlInputHidden3 = this.hidDepositPercent;
                num = productPreSaleInfo.DepositPercent;
                htmlInputHidden3.Value = num.ToString();
            }
            else
            {
                this.lblDeposit.Text      = "定金:¥" + productPreSaleInfo.Deposit;
                this.lblFinalPayment.Text = "尾款:¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - productPreSaleInfo.Deposit, 2);
                HtmlInputHidden htmlInputHidden4 = this.hidDeposit;
                d = productPreSaleInfo.Deposit;
                htmlInputHidden4.Value = d.ToString();
            }
            this.btnBuy.Stock  = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.ltlUnit.Text  = productBrowseInfo.Product.Unit;
            this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
                decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct;
                d = default(decimal);
                if (!(subMemberDeduct.GetValueOrDefault() <= d) || !subMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
            }
            goto IL_0d9f;
IL_0da0:
            int num3;

            if (num3 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            if (productBrowseInfo.Product.BrandId.HasValue)
            {
                BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                {
                    this.imgBrand.ImageUrl = brandCategory.Logo;
                    this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                    {
                        brandId = brandCategory.BrandId
                    });
                }
            }
            int supplierId = productBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (!string.IsNullOrEmpty(supplierById.Picture))
                {
                    this.imgBrand.ImageUrl = supplierById.Picture;
                }
                else if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory2.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory2.BrandId
                        });
                    }
                }
                else
                {
                    this.imgBrand.Visible = false;
                }
                this.litSupplierName.Text = supplierById.SupplierName;
                this.hidSupName.Value     = supplierById.SupplierName;
            }
            else
            {
                this.litSupplierName.Visible = false;
                if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory3 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory3 != null && !string.IsNullOrEmpty(brandCategory3.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory3.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory3.BrandId
                        });
                    }
                }
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
            return;

IL_0d9f:
            num3 = 1;
            goto IL_0da0;
IL_0d79:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num3 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0da0;
            }
            goto IL_0d9f;
        }
Beispiel #18
0
 /// <summary>
 /// 添加数据到数据库
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Insert(SupplierInfo model)
 {
     return(dal.Insert(model));
 }
Beispiel #19
0
    public string GetFeedBacks()
    {
        string    nickname      = "";
        string    type_name     = "";
        int       Feedback_Type = 0;
        string    keyword       = tools.CheckStr(Request["keyword"]);
        int       isreply       = tools.CheckInt(Request["isreply"]);
        string    date_start    = tools.CheckStr(Request.QueryString["date_start"]);
        string    date_end      = tools.CheckStr(Request.QueryString["date_end"]);
        QueryInfo Query         = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Site", "=", Public.GetCurrentSite()));

        string listtype = tools.CheckStr(Request.QueryString["listtype"]);

        switch (listtype)
        {
        case "message":
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "=", "1"));
            break;

        case "idea":
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "!=", "1"));
            break;

        case "suggest":
            Query.ParamInfos.Add(new ParamInfo("AND(", "int", "FeedBackInfo.Feedback_Type", "=", "3"));
            Query.ParamInfos.Add(new ParamInfo("OR)", "int", "FeedBackInfo.Feedback_Type", "=", "4"));
            break;

        case "complain":
            Query.ParamInfos.Add(new ParamInfo("AND(", "int", "FeedBackInfo.Feedback_Type", "=", "5"));
            Query.ParamInfos.Add(new ParamInfo("OR)", "int", "FeedBackInfo.Feedback_Type", "=", "6"));
            break;

        default:
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "=", "1"));
            break;
        }
        if (isreply == 1)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Reply_Content", "<>", ""));
        }
        else if (isreply == 2)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Reply_Content", "=", ""));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND(", "str", "FeedBackInfo.Feedback_Name", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR", "str", "FeedBackInfo.Feedback_CompanyName", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR", "str", "FeedBackInfo.Feedback_Tel", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR)", "str", "FeedBackInfo.Feedback_Email", "like", keyword));
        }
        if (date_start != "")
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(d, '" + date_start + "',{FeedBackInfo.Feedback_Addtime})", ">=", "0"));
        }
        if (date_end != "")
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(d, '" + date_end + "',{FeedBackInfo.Feedback_Addtime})", "<=", "0"));
        }
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));

        PageInfo             pageinfo = MyFeedback.GetPageInfo(Query, Public.GetUserPrivilege());
        IList <FeedBackInfo> entitys  = MyFeedback.GetFeedBacks(Query, Public.GetUserPrivilege());

        if (entitys != null)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\"");
            jsonBuilder.Append(":[");
            foreach (FeedBackInfo entity in entitys)
            {
                nickname = "游客";
                MemberInfo member = new MemberInfo();

                if (entity.Feedback_MemberID > 0)
                {
                    member = MyBLL.GetMemberByID(entity.Feedback_MemberID, Public.GetUserPrivilege());
                    if (member != null)
                    {
                        nickname = member.Member_NickName;
                    }
                }

                SupplierInfo supplierinfo = new SupplierInfo();

                if (entity.Feedback_SupplierID > 0)
                {
                    supplierinfo = MySupplier.GetSupplierByID(entity.Feedback_SupplierID, Public.GetUserPrivilege());
                    if (supplierinfo != null)
                    {
                        nickname = supplierinfo.Supplier_Nickname;
                    }
                }

                switch (entity.Feedback_Type)
                {
                //case 1:
                //    type_name = "简单的留言";
                //    break;
                //case 2:
                //    type_name = "对网站的意见";
                //    break;
                //case 3:
                //    type_name = "对公司的建议";
                //    break;
                //case 4:
                //    type_name = "具有合作意向";
                //    break;
                //case 5:
                //    type_name = "产品投诉";
                //    break;
                //case 6:
                //    type_name = "服务投诉";
                //    break;


                case 1:
                    type_name = "网站留言";
                    break;

                case 2:
                    type_name = "商业承兑融资";
                    break;

                case 3:
                    type_name = "应收账款融资";
                    break;

                case 4:
                    type_name = "货押融资";
                    break;

                    //case 3:
                    //    type_name = "对公司的建议";
                    //    break;
                    //case 4:
                    //    type_name = "具有合作意向";
                    //    break;
                    //case 5:
                    //    type_name = "产品投诉";
                    //    break;
                    //case 6:
                    //    type_name = "服务投诉";
                    //break;
                }

                jsonBuilder.Append("{\"id\":" + entity.Feedback_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Feedback_ID);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.Feedback_Name));
                jsonBuilder.Append("\",");

                //jsonBuilder.Append("\"");
                //jsonBuilder.Append(Public.JsonStr(entity.Feedback_CompanyName));
                //jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(type_name));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.Feedback_Tel));
                jsonBuilder.Append("\",");

                if (Feedback_Type == 1)
                {
                    jsonBuilder.Append("\"");
                    jsonBuilder.Append(Public.JsonStr(entity.Feedback_Email));
                    jsonBuilder.Append("\",");
                }
                else
                {
                    jsonBuilder.Append("\"");
                    jsonBuilder.Append(tools.CheckFloat(entity.Feedback_Amount.ToString()));
                    jsonBuilder.Append("\",");
                }


                jsonBuilder.Append("\"");
                if (entity.Feedback_Reply_Content != "")
                {
                    jsonBuilder.Append("已回复");
                }
                else
                {
                    jsonBuilder.Append("未回复");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Feedback_Addtime.ToString("yy-MM-dd"));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append("<img src=\\\"/images/icon_view.gif\\\" alt=\\\"查看\\\" align=\\\"absmiddle\\\"> <a href=\\\"feedback_view.aspx?feedback_id=" + entity.Feedback_ID + "\\\" title=\\\"查看\\\">查看</a> ");

                if (Public.CheckPrivilege("cc567804-3e2e-4c6c-aa22-c9a353508074"))
                {
                    jsonBuilder.Append("<img src=\\\"/images/icon_del.gif\\\" alt=\\\"删除\\\" align=\\\"absmiddle\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('supplier_do.aspx?action=feedbackmove&listtype=" + listtype + "&feedback_id=" + entity.Feedback_ID + "')\\\" title=\\\"删除\\\">删除</a>");


                    //jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"  alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('depot_do.aspx?action=move&depot_id=" + Depot_ID + "')\\\" title=\\\"删除\\\">删除</a>");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("]},");

                supplierinfo = null;
            }
            jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            jsonBuilder.Append("]");
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
        else
        {
            return(null);
        }
    }
		protected override void AttachChildControls()
		{
			SiteSettings masterSettings = SettingsManager.GetMasterSettings();
			if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
			{
				this.ShowWapMessage("错误的商品ID", "Default.aspx");
			}
			if (base.ClientType.Equals(ClientType.VShop))
			{
				FightGroupActivitiyModel fightGroupActivitiyModel = VShopHelper.GetFightGroupActivities(new FightGroupActivitiyQuery
				{
					PageIndex = 1,
					PageSize = 1,
					ProductId = this.productId,
					Status = EnumFightGroupActivitiyStatus.BeingCarried
				}).Models.FirstOrDefault();
				if (fightGroupActivitiyModel != null)
				{
					this.Page.Response.Redirect("FightGroupActivityDetails.aspx?fightGroupActivityId=" + fightGroupActivitiyModel.FightGroupActivityId);
				}
			}
			this.hidSupplier = (HtmlInputHidden)this.FindControl("hidSupplier");
			this.litSupplierName = (Literal)this.FindControl("litSupplierName");
			this.aCountDownUrl = (HyperLink)this.FindControl("aCountDownUrl");
			this.aCountDownUrl.Visible = false;
			this.divCountDownUrl = (HtmlGenericControl)this.FindControl("divCountDownUrl");
			this.hidCanTakeOnStore = (HtmlInputHidden)this.FindControl("hidCanTakeOnStore");
			this.HasActivitiesToJumpUrl();
			this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
			this.rptProductImages = (WapTemplatedRepeater)this.FindControl("rptProductImages");
			this.rptCouponList = (WapTemplatedRepeater)this.FindControl("rptCouponList");
			this.rp_guest = (WapTemplatedRepeater)this.FindControl("rp_guest");
			this.rp_com = (WapTemplatedRepeater)this.FindControl("rp_com");
			this.litProdcutName = (Literal)this.FindControl("litProdcutName");
			this.litSalePrice = (Literal)this.FindControl("litSalePrice");
			this.litMarketPrice = (Literal)this.FindControl("litMarketPrice");
			this.litShortDescription = (Literal)this.FindControl("litShortDescription");
			this.litDescription = (Literal)this.FindControl("litDescription");
			this.ltlcombinamaininfo = (Literal)this.FindControl("ltlcombinamaininfo");
			this.skuSubmitOrder = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
			this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
			this.litSoldCount = (Literal)this.FindControl("litSoldCount");
			this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
			this.litReviewsCount = (Literal)this.FindControl("litReviewsCount");
			this.litHasCollected = (HtmlInputHidden)this.FindControl("litHasCollected");
			this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus");
			this.ltlOrderPromotion = (Literal)this.FindControl("ltlOrderPromotion");
			this.ltlOrderPromotion2 = (Literal)this.FindControl("ltlOrderPromotion2");
			this.ltlProductSendGifts2 = (Literal)this.FindControl("ltlProductSendGifts2");
			this.ltlProductSendGifts = (Literal)this.FindControl("ltlProductSendGifts");
			this.liOrderPromotions = (HtmlGenericControl)this.FindControl("liOrderPromotions");
			this.liOrderPromotions2 = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
			this.liProductSendGifts2 = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
			this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
			this.liOrderPromotions_free = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
			this.divActivities = (HtmlGenericControl)this.FindControl("divActivities");
			this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
			this.ltlOrderPromotion_free = (Literal)this.FindControl("ltlOrderPromotion_free");
			this.liProductSendGifts = (HtmlGenericControl)this.FindControl("liProductSendGifts");
			this.lbUserProductRefer = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
			this.divshiptoregion = (HtmlGenericControl)this.FindControl("divshiptoregion");
			this.divwaplocateaddress = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
			this.productFreight = (ProductFreightLiteral)this.FindControl("productFreight");
			this.promote = (ProductPromote)this.FindControl("ProductPromote");
			this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId");
			this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle");
			this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc");
			this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl");
			this.hdLink = (HtmlInputHidden)this.FindControl("hdLink");
			this.hidCombinaid = (HtmlInputHidden)this.FindControl("hidCombinaid");
			this.divConsultationEmpty = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
			this.ulConsultations = (HtmlGenericControl)this.FindControl("ulConsultations");
			this.divShortDescription = (HtmlGenericControl)this.FindControl("divShortDescription");
			this.hidRegionId = (HtmlInputHidden)this.FindControl("hidRegionId");
			this.divProductReferral = (HtmlGenericControl)this.FindControl("divProductReferral");
			this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId");
			this.hidCouponCount = (HtmlInputHidden)this.FindControl("hidCouponCount");
			this.hidHasStores = (HtmlInputHidden)this.FindControl("hidHasStores");
			this.divPodrequest = (HtmlGenericControl)this.FindControl("divPodrequest");
			this.divGuest = (HtmlGenericControl)this.FindControl("divGuest");
			this.divcombina = (HtmlGenericControl)this.FindControl("divcombina");
			this.hidUnOnSale = (HtmlInputHidden)this.FindControl("hidUnOnSale");
			this.hidUnAudit = (HtmlInputHidden)this.FindControl("hidUnAudit");
			this.divPhonePrice = (HtmlGenericControl)this.FindControl("divPhonePrice");
			this.litPhonePrice = (Literal)this.FindControl("litPhonePrice");
			this.spdiscount = (HtmlGenericControl)this.FindControl("spdiscount");
			this.ulsupplier = (HtmlGenericControl)this.FindControl("ulsupplier");
			this.hdAppId.Value = masterSettings.WeixinAppId;
			HtmlInputHidden htmlInputHidden = this.hidRegionId;
			int num = HiContext.Current.DeliveryScopRegionId;
			htmlInputHidden.Value = num.ToString();
			this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem");
			this.hidCartQuantity = (HtmlInputHidden)this.FindControl("txCartQuantity");
			this.lblStock = (StockLabel)this.FindControl("lblStock");
			this.litUnit = (Literal)this.FindControl("litUnit");
			ProductBrowseInfo wAPProductBrowseInfo = ProductBrowser.GetWAPProductBrowseInfo(this.productId, null, masterSettings.OpenMultStore, 0);
			if (wAPProductBrowseInfo.Product == null || wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
			{
				this.Page.Response.Redirect("ProductDelete.aspx");
				return;
			}
			if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
			{
				base.GotoResourceNotFound("商品已经入库");
			}
			if (wAPProductBrowseInfo.Product.ProductType == 1.GetHashCode())
			{
				HttpContext.Current.Response.Redirect("ServiceProductDetails?productId=" + this.productId);
			}
			if (masterSettings.OpenMultStore)
			{
				if (StoresHelper.ProductInStoreAndIsAboveSelf(this.productId))
				{
					this.hidHasStores.Value = "1";
					this.hidCanTakeOnStore.Value = "1";
				}
			}
			else if (masterSettings.IsOpenPickeupInStore && wAPProductBrowseInfo.Product.SupplierId == 0)
			{
				this.hidCanTakeOnStore.Value = "1";
			}
			if (SalesHelper.IsSupportPodrequest() && wAPProductBrowseInfo.Product.SupplierId == 0)
			{
				this.divPodrequest.Visible = true;
			}
			if (wAPProductBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
			{
				this.hidUnOnSale.Value = "1";
			}
			HtmlInputHidden htmlInputHidden2 = this.hidUnAudit;
			num = (int)wAPProductBrowseInfo.Product.AuditStatus;
			htmlInputHidden2.Value = num.ToString();
			if (this.spdiscount != null && HiContext.Current.User.UserId > 0)
			{
				MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(HiContext.Current.User.GradeId);
				this.spdiscount.Visible = true;
				this.spdiscount.InnerHtml = "<strong class='vip_price'><img src='/templates/pccommon/images/vip_price.png' />" + memberGrade.Name + "价</strong>";
			}
			this.skuSubmitOrder.ProductInfo = wAPProductBrowseInfo.Product;
			this.lbUserProductRefer.product = wAPProductBrowseInfo.Product;
			this.productFreight.ShippingTemplateId = wAPProductBrowseInfo.Product.ShippingTemplateId;
			this.productFreight.Volume = wAPProductBrowseInfo.Product.Weight;
			this.productFreight.Weight = wAPProductBrowseInfo.Product.Weight;
			this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.Title) ? wAPProductBrowseInfo.Product.ProductName : wAPProductBrowseInfo.Product.Title);
			this.hdDesc.Value = Globals.StripAllTags(string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : wAPProductBrowseInfo.Product.ShortDescription);
			string oldValue = "/storage/master/product/images/";
			string newValue = "/storage/master/product/thumbs410/410_";
			string text = wAPProductBrowseInfo.Product.ImageUrl1;
			if (!string.IsNullOrEmpty(text))
			{
				text = text.ToLower().Replace(oldValue, newValue);
			}
			string local = string.IsNullOrEmpty(text) ? SettingsManager.GetMasterSettings().DefaultProductImage : text;
			this.hdImgUrl.Value = Globals.FullPath(local);
			this.hdLink.Value = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
			if (this.hidCartQuantity != null)
			{
				this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
			}
			if (this.hidden_productId != null)
			{
				this.hidden_productId.Value = this.productId.ToString();
			}
			if (this.promote != null)
			{
				this.promote.ProductId = this.productId;
			}
			MemberInfo user = HiContext.Current.User;
			if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue))
			{
				if (!wAPProductBrowseInfo.Product.SubMemberDeduct.HasValue)
				{
					goto IL_0b8c;
				}
				decimal? subMemberDeduct = wAPProductBrowseInfo.Product.SubMemberDeduct;
				if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
				{
					goto IL_0b8c;
				}
			}
			goto IL_0bc6;
			IL_0bc6:
			int num2 = 1;
			goto IL_0bc7;
			IL_0bc7:
			if (num2 != 0)
			{
				this.divProductReferral.Visible = false;
			}
			bool flag = true;
			if (this.rptProductImages != null)
			{
				string locationUrl = "javascript:;";
				if (string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ImageUrl5))
				{
					wAPProductBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
				}
				DataTable skus = ProductBrowser.GetSkus(this.productId);
				List<SlideImage> list = new List<SlideImage>();
				int supplierId = wAPProductBrowseInfo.Product.SupplierId;
				if (supplierId > 0)
				{
					SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
					if (supplierById != null)
					{
						this.hidSupplier.Value = "true";
						this.litSupplierName.Text = "<a href=\"SupplierAbout?SupplierId=" + supplierById.SupplierId + "\">" + supplierById.SupplierName + "</a>";
					}
				}
				else
				{
					this.hidSupplier.Value = "false";
					flag = false;
					this.ulsupplier.Style.Add(HtmlTextWriterStyle.Display, "none");
				}
				list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl1, locationUrl));
				list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl2, locationUrl));
				list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl3, locationUrl));
				list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl4, locationUrl));
				list.Add(new SlideImage(wAPProductBrowseInfo.Product.ImageUrl5, locationUrl));
				this.rptProductImages.DataSource = from item in list
				where !string.IsNullOrWhiteSpace(item.ImageUrl)
				select item;
				this.rptProductImages.DataBind();
			}
			this.litProdcutName.Text = wAPProductBrowseInfo.Product.ProductName;
			this.litSalePrice.Text = ((wAPProductBrowseInfo.Product.MinSalePrice == wAPProductBrowseInfo.Product.MaxSalePrice) ? wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") : (wAPProductBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~" + wAPProductBrowseInfo.Product.MaxSalePrice.F2ToString("f2")));
			if (wAPProductBrowseInfo.Product.MarketPrice.HasValue)
			{
				this.litMarketPrice.SetWhenIsNotNull(wAPProductBrowseInfo.Product.MarketPrice.GetValueOrDefault(decimal.Zero).F2ToString("f2"));
			}
			this.litShortDescription.Text = wAPProductBrowseInfo.Product.ShortDescription;
			this.divShortDescription.Visible = !string.IsNullOrEmpty(wAPProductBrowseInfo.Product.ShortDescription);
			if (this.litDescription != null)
			{
				string text2 = "";
				Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
				if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.MobbileDescription))
				{
					text2 = regex.Replace(wAPProductBrowseInfo.Product.MobbileDescription, "");
				}
				else if (!string.IsNullOrWhiteSpace(wAPProductBrowseInfo.Product.Description))
				{
					text2 = regex.Replace(wAPProductBrowseInfo.Product.Description, "");
				}
				text2 = text2.Replace("src", "data-url");
				text2 = text2.Replace("vurl", "src");
				this.litDescription.Text = text2;
			}
			Literal control = this.litSoldCount;
			num = wAPProductBrowseInfo.Product.ShowSaleCounts;
			control.SetWhenIsNotNull(num.ToString() + wAPProductBrowseInfo.Product.Unit);
			if (this.expandAttr != null)
			{
				this.expandAttr.ProductId = this.productId;
			}
			Literal control2 = this.litConsultationsCount;
			num = wAPProductBrowseInfo.ConsultationCount;
			control2.SetWhenIsNotNull(num.ToString());
			Literal control3 = this.litReviewsCount;
			num = wAPProductBrowseInfo.ReviewCount;
			control3.SetWhenIsNotNull(num.ToString());
			MemberInfo user2 = HiContext.Current.User;
			bool flag2 = false;
			if (user2 != null)
			{
				flag2 = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
			}
			this.litHasCollected.SetWhenIsNotNull(flag2 ? "1" : "0");
			this.BindCouponList();
			PageTitle.AddSiteNameTitle(wAPProductBrowseInfo.Product.ProductName);
			this.BindCombinaBuyInfo();
			this.BindPromotionInfo();
			this.BindGuestProducts();
			DataTable dBConsultations = wAPProductBrowseInfo.DBConsultations;
			for (int i = 0; i < dBConsultations.Rows.Count; i++)
			{
				dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
			}
			this.rptProductConsultations.DataSource = dBConsultations;
			this.rptProductConsultations.DataBind();
			this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
			this.ulConsultations.Visible = !dBConsultations.IsNullOrEmpty();
			string phonePriceByProductId = PromoteHelper.GetPhonePriceByProductId(this.productId);
			if (!string.IsNullOrEmpty(phonePriceByProductId))
			{
				this.divPhonePrice.Visible = true;
				decimal num3 = phonePriceByProductId.Split(',')[0].ToDecimal(0);
				this.litPhonePrice.Text = num3.F2ToString("f2");
				decimal num4 = wAPProductBrowseInfo.Product.MinSalePrice - num3;
				this.litSalePrice.Text = ((num4 > decimal.Zero) ? num4 : decimal.Zero).F2ToString("f2");
				this.lbUserProductRefer.MobileExclusive = num3;
			}
			if (flag || this.liOrderPromotions.Visible || this.liOrderPromotions_free2.Visible || this.liProductSendGifts.Visible || this.rptCouponList.Visible)
			{
				this.divActivities.Visible = true;
			}
			else
			{
				this.divActivities.Visible = false;
			}
			return;
			IL_0b8c:
			if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
			{
				num2 = (user.Referral.IsRepeled ? 1 : 0);
				goto IL_0bc7;
			}
			goto IL_0bc6;
		}
 public int InsertSupplier(SupplierInfo supplier)
 {
     SqlConnection conn;
     int count = 0;
     using (conn = SqlHelper.CreateConntion())
     {
         conn.Open();
         SqlTransaction trans = conn.BeginTransaction();
         try
         {
             count = DAL.InsertSupplier(supplier, trans);
             trans.Commit();
         }
         catch (Exception)
         {
             trans.Rollback();
         }
         conn.Close();
     }
     return count;
 }
Beispiel #22
0
 public int UpdateSupplier(SupplierInfo stuff, SqlTransaction trans)
 {
     string sql = @"UPDATE [Supplier]
                        SET [id] = @id
                           ,[SupplierNO] = @SupplierNO
                           ,[Name] = @Name
                           ,[ZipCode] = @ZipCode
                           ,[Address] = @Address
                           ,[Tel] = @Tel
                           ,[Fax] = @Fax
                           ,[StaffName] = @StaffName
                           ,[Email] = @Email
                           ,[UpdateDateTime] = @UpdateDateTime
                           ,[UpdateUser] = @UpdateUser
                      WHERE id=@id";
     SqlParameter[] spvalues = DBTool.GetSqlPm(stuff);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }
    /// <summary>
    /// Gets and bulk updates suppliers. Called when the "Get and bulk update suppliers" button is pressed.
    /// Expects the CreateSupplier method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateSuppliers()
    {
        // Prepare the parameters
        string where = "SupplierName LIKE N'MyNewSupplier%'";
        where = SqlHelperClass.AddWhereCondition(where, "SupplierSiteID = " + CMSContext.CurrentSiteID, "AND");

        // Get the data
        DataSet suppliers = SupplierInfoProvider.GetSuppliers(where, null);
        if (!DataHelper.DataSourceIsEmpty(suppliers))
        {
            // Loop through the individual items
            foreach (DataRow supplierDr in suppliers.Tables[0].Rows)
            {
                // Create object from DataRow
                SupplierInfo modifySupplier = new SupplierInfo(supplierDr);

                // Update the properties
                modifySupplier.SupplierDisplayName = modifySupplier.SupplierDisplayName.ToUpper();

                // Update the supplier
                SupplierInfoProvider.SetSupplierInfo(modifySupplier);
            }

            return true;
        }

        return false;
    }
Beispiel #24
0
    public void FeedBackFin_Export()
    {
        //string listtype = tools.CheckStr(Request.QueryString["listtype"]);
        string feedback_id = tools.CheckStr(Request.QueryString["feedback_id"]);

        if (feedback_id == "")
        {
            Public.Msg("error", "错误信息", "请选择要导出的信息", false, "{back}");
            return;
        }
        string type_name = "";

        if (tools.Left(feedback_id, 1) == ",")
        {
            feedback_id = feedback_id.Remove(0, 1);
        }

        QueryInfo Query = new QueryInfo();

        //MemberInfo memberinfo = null;
        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_ID", "in", feedback_id));
        Query.OrderInfos.Add(new OrderInfo("FeedBackInfo.Feedback_ID", "DESC"));
        IList <FeedBackInfo> entitys = MyFeedback.GetFeedBacks(Query, Public.GetUserPrivilege());

        if (entitys == null)
        {
            return;
        }

        DataTable  dt     = new DataTable("excel");
        DataRow    dr     = null;
        DataColumn column = null;


        string[] dtcol = { "编号", "昵称", "留言类型", "电话", "金额", "状态", "时间", "留言内容", "回复时间", "回复内容" };

        //if (listtype!="1")
        //{
        //  string[]   dtcol1 = { "编号", "昵称", "留言类型", "电话", "Email", "状态", "时间", "留言内容", "回复时间", "回复内容" };
        //}



        //}
        //else
        //{
        //   dtcol = { "编号", "昵称", "留言类型", "电话", "金额", "状态", "时间", "留言内容", "回复时间", "回复内容" };
        //}

        foreach (string col in dtcol)
        {
            try { dt.Columns.Add(col); }
            catch { dt.Columns.Add(col + ","); }
        }
        dtcol = null;

        foreach (FeedBackInfo entity in entitys)
        {
            switch (entity.Feedback_Type)
            {
            //case 1:
            //    type_name = "简单的留言";
            //    break;
            //case 2:
            //    type_name = "对网站的意见";
            //    break;
            //case 3:
            //    type_name = "对公司的建议";
            //    break;
            //case 4:
            //    type_name = "具有合作意向";
            //    break;
            //case 5:
            //    type_name = "产品投诉";
            //    break;
            //case 6:
            //    type_name = "服务投诉";
            //    break;
            case 1:
                type_name = "网站留言";
                break;

            case 2:
                type_name = "商业承兑融资";
                break;

            case 3:
                type_name = "应收账款融资";
                break;

            case 4:
                type_name = "货押融资";
                break;
            }
            dr    = dt.NewRow();
            dr[0] = entity.Feedback_ID;


            //memberinfo = MyBLL.GetMemberByID(entity.Feedback_MemberID,Public.GetUserPrivilege());
            //if (memberinfo != null)
            //{
            //    dr[1] = memberinfo.Member_NickName;
            //}
            //else
            //{
            //    dr[1] = "游客";
            //}

            SupplierInfo supplierinfo = MySupplier.GetSupplierByID(entity.Feedback_SupplierID, Public.GetUserPrivilege());

            if (supplierinfo != null)
            {
                dr[1] = supplierinfo.Supplier_Nickname;
            }
            else
            {
                dr[1] = "游客";
            }

            dr[2] = type_name;
            dr[3] = entity.Feedback_Tel;
            dr[4] = entity.Feedback_Amount;

            if (entity.Feedback_Reply_Content != "")
            {
                dr[5] = "已回复";
            }
            else
            {
                dr[5] = "未回复";
            }
            dr[6] = entity.Feedback_Addtime;
            dr[7] = entity.Feedback_Content;
            dr[8] = entity.Feedback_Reply_Addtime;
            dr[9] = entity.Feedback_Reply_Content;
            dt.Rows.Add(dr);
            dr = null;
        }

        Public.toExcel(dt);
    }
Beispiel #25
0
 public void UpdateSupplier(SupplierInfo SuppInfo)
 {
     suppDao.UpdateSupplierBySupplierID(SuppInfo);
 }
    /// <summary>
    /// Creates supplier. Called when the "Create supplier" button is pressed.
    /// </summary>
    private bool CreateSupplier()
    {
        // Create new supplier object
        SupplierInfo newSupplier = new SupplierInfo();

        // Set the properties
        newSupplier.SupplierDisplayName = "My new supplier";
        newSupplier.SupplierName = "MyNewSupplier";
        newSupplier.SupplierEmail = "*****@*****.**";
        newSupplier.SupplierSiteID = CMSContext.CurrentSiteID;
        newSupplier.SupplierPhone = "";
        newSupplier.SupplierFax = "";
        newSupplier.SupplierEnabled = true;

        // Create the supplier
        SupplierInfoProvider.SetSupplierInfo(newSupplier);

        return true;
    }
        public string GetSuplierName(string id)
        {
            SupplierInfo supplier = Core.Container.Instance.Resolve <IServiceSupplierInfo>().GetEntity(int.Parse(id));

            return(supplier != null ? supplier.SupplierName : "");
        }
    /// <summary>
    /// Load data of editing supplier.
    /// </summary>
    /// <param name="supplierObj">Supplier object</param>
    protected void LoadData(SupplierInfo supplierObj)
    {
        EditedObject = supplierObj;

        txtSupplierFax.Text = supplierObj.SupplierFax;
        txtSupplierEmail.Text = supplierObj.SupplierEmail;
        txtSupplierPhone.Text = supplierObj.SupplierPhone;
        txtSupplierDisplayName.Text = supplierObj.SupplierDisplayName;
        txtSupplierName.Text = supplierObj.SupplierName;
        chkSupplierEnabled.Checked = supplierObj.SupplierEnabled;
    }
        /// <summary>
        /// 导出厂商下定单
        /// </summary>
        /// <param name="suppilerID">厂商编号</param>
        /// <returns></returns>
        private string GetAllTableHtmlForSupplier()
        {
            //获取合同信息
            ContractInfo contractInfo = Core.Container.Instance.Resolve <IServiceContractInfo>().GetEntity(OrderID);
            //获取厂商信息
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList.Add(Expression.Eq("ContractID", OrderID));
            qryList.Add(Expression.Eq("CostType", 1));
            Order[] orderList = new Order[1];
            Order   orderli   = new Order("ID", true);

            orderList[0] = orderli;
            IList <ContractCostInfo> costInfoList = Core.Container.Instance.Resolve <IServiceContractCostInfo>().GetAllByKeys(qryList, orderList);

            StringBuilder sb = new StringBuilder();

            sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");

            #region - 拼凑主订单导出结果 -
            sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");


            foreach (ContractCostInfo cost in costInfoList)
            {
                //获取厂商信息
                SupplierInfo supplierInfo = Core.Container.Instance.Resolve <IServiceSupplierInfo>().GetEntity(cost.SuppilerID);
                //获取订单明细
                qryList = new List <ICriterion>();
                qryList.Add(Expression.Eq("ContractInfo.ID", OrderID));
                qryList.Add(Expression.Eq("SupplyID", cost.SuppilerID));
                orderList    = new Order[1];
                orderli      = new Order("ID", true);
                orderList[0] = orderli;
                IList <ContractDoorInfo> list = Core.Container.Instance.Resolve <IServiceContractDoorInfo>().GetAllByKeys(qryList, orderList);


                #region - 拼凑导出的列名 -
                //单据头
                sb.Append("<tr>");
                sb.AppendFormat("<td colspan=\"14\" style=\"font-size :x-large; text-align:center;\">{0}</td>", "重庆喜莱克家具有限公司(家喜林门)生产订单");
                sb.Append("</tr>");
                //订单信息
                sb.Append("<tr>");
                sb.AppendFormat("<td colspan=\"2\">{0}</td>", "订单号");
                sb.AppendFormat("<td colspan=\"3\">{0}</td>", contractInfo.ContractNO);
                sb.AppendFormat("<td colspan=\"1\">{0}</td>", "供货单位");
                sb.AppendFormat("<td colspan=\"3\">{0}</td>", ConfigHelper.StoreName);
                sb.AppendFormat("<td>{0}</td>", "联系电话");
                sb.AppendFormat("<td colspan=\"4\">{0}</td>", ConfigHelper.ContractPhone);
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.AppendFormat("<td colspan=\"2\">{0}</td>", "客户地址");
                sb.AppendFormat("<td colspan=\"3\">{0}</td>", contractInfo.ProjectName);
                sb.AppendFormat("<td>{0}</td>", "联系电话");
                sb.AppendFormat("<td colspan=\"4\">{0}</td>", contractInfo.ContactPhone);
                sb.AppendFormat("<td>{0}</td>", "生产厂商");
                sb.AppendFormat("<td colspan=\"3\">{0}</td>", supplierInfo.SupplierName);
                sb.Append("</tr>");
                //明细表头
                sb.Append("<tr>");
                sb.AppendFormat("<td>{0}</td>", "序号");
                sb.AppendFormat("<td>{0}</td>", "位置");
                sb.AppendFormat("<td>{0}</td>", "高(mm)");
                sb.AppendFormat("<td>{0}</td>", "宽(mm)");
                sb.AppendFormat("<td>{0}</td>", "厚(mm)");
                sb.AppendFormat("<td>{0}</td>", "线条");
                sb.AppendFormat("<td>{0}</td>", "材质");
                sb.AppendFormat("<td>{0}</td>", "颜色");
                sb.AppendFormat("<td>{0}</td>", "款式");
                sb.AppendFormat("<td>{0}</td>", "商品名称");
                sb.AppendFormat("<td>{0}</td>", "玻璃款式");
                sb.AppendFormat("<td>{0}</td>", "开启方向");
                sb.AppendFormat("<td>{0}</td>", "数量");
                sb.AppendFormat("<td>{0}</td>", "备注");
                sb.Append("</tr>");

                #endregion

                #region - 拼凑导出的数据行 -
                int recordIndex1 = 1;
                foreach (ContractDoorInfo row in list)
                {
                    sb.Append("<tr>");
                    sb.AppendFormat("<td>{0}</td>", recordIndex1);
                    sb.AppendFormat("<td>{0}</td>", row.GoodsLocation);
                    sb.AppendFormat("<td>{0}</td>", row.GHeight);
                    sb.AppendFormat("<td>{0}</td>", row.GWide);
                    sb.AppendFormat("<td>{0}</td>", row.GThickness);
                    sb.AppendFormat("<td>{0}</td>", row.LineName);
                    sb.AppendFormat("<td>{0}</td>", row.TypeName);
                    sb.AppendFormat("<td>{0}</td>", row.DoorColor);
                    sb.AppendFormat("<td>{0}</td>", row.ModelName);
                    sb.AppendFormat("<td>{0}</td>", row.GoodsName);
                    sb.AppendFormat("<td>{0}</td>", row.GlassRemark);
                    sb.AppendFormat("<td>{0}</td>", row.DoorDirection);
                    sb.AppendFormat("<td>{0}</td>", row.OrderNumber);
                    sb.AppendFormat("<td>{0}</td>", row.Remark);
                    sb.Append("</tr>");
                    recordIndex1++;
                }
                #endregion

                //单据尾
                sb.Append("<tr>");
                sb.AppendFormat("<td colspan=\"14\">店铺名称:{0} 联系电话:{1} 地址:{2}</td>"
                                , ConfigHelper.StoreName
                                , ConfigHelper.ContractPhone
                                , ConfigHelper.Address);
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td colspan=\"14\"></td>");
                sb.Append("</tr>");
            }

            sb.Append("</table>");

            #endregion

            return(sb.ToString());
        }
 public ActionResult SameTypeResult()
 {
     try
     {
         int cpage = 1;
         int pgCount = 0;
         if (!string.IsNullOrWhiteSpace(Request.QueryString["page"]))
         {
             cpage = int.Parse(Request.QueryString["page"]);
         }
         string type = Request.QueryString["tp"];
         List<SupplierInfo> sp = new List<SupplierInfo>();
         IEnumerable<商品> goods = 商品管理.查询商品(0, 0, Query<商品>.Where(m => m.商品信息.精确型号 == type && m.审核数据.审核状态 == 审核状态.审核通过)).OrderBy(m => m.销售信息.价格);
         foreach (var item in goods)
         {
             if (item.商品信息 != null)
             {
                 SupplierInfo s = new SupplierInfo();
                 s.Id = item.商品信息.所属供应商.用户ID;
                 s.Price = item.销售信息.价格.ToString("0.00");
                 if (item.商品信息.所属供应商.用户数据 != null)
                 {
                     s.Sname = item.商品信息.所属供应商.用户数据.企业基本信息.企业名称;
                 }
                 else
                 {
                     s.Sname = "信息未完善的供应商";
                 }
                 sp.Add(s);
             }
         }
         pgCount = sp.Count / 5;
         if (sp.Count % 5 > 0)
         {
             pgCount++;
         }
         sp = sp.Skip((cpage - 1) * 5).Take(5).ToList();
         JsonResult json = new JsonResult() { Data = new { supplier = sp, pCount = pgCount } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
     catch
     {
         JsonResult json = new JsonResult() { Data = new { supplier = new List<SupplierInfo>(), pCount = 0 } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
 }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-3"))
                {
                    Act = HTTPRequest.GetString("Act");

                    if (Act == "Edit")
                    {
                        StoresID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);

                        si = tbSupplierInfo.GetSupplierInfoModel(StoresID);
                    }
                    if (ispost)
                    {
                        sName    = Utils.ChkSQL(HTTPRequest.GetString("sName"));
                        sCode    = Utils.ChkSQL(HTTPRequest.GetString("sCode"));
                        sAddress = Utils.ChkSQL(HTTPRequest.GetString("sAddress"));
                        sTel     = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                        sLinkMan = Utils.ChkSQL(HTTPRequest.GetString("sLinkMan"));
                        sLicense = Utils.ChkSQL(HTTPRequest.GetString("sLicense"));

                        sDoDay          = Utils.StrToInt(HTTPRequest.GetString("sDoDay"), 0);
                        SupplierClassID = Utils.StrToInt(HTTPRequest.GetString("SupplierClassID"), 0);
                        sDoDayMoney     = decimal.Parse(HTTPRequest.GetString("sDoDayMoney").Trim() != "" ? HTTPRequest.GetString("sDoDayMoney") : "0");

                        si.sName = sName;

                        si.sAddress        = sAddress;
                        si.sTel            = sTel;
                        si.sLinkMan        = sLinkMan;
                        si.sDoDay          = sDoDay;
                        si.sDoDayMoney     = sDoDayMoney;
                        si.SupplierClassID = SupplierClassID;
                        si.sLicense        = sLicense;

                        if (Act == "Add")
                        {
                            if (!tbSupplierInfo.ExistsSupplierInfo(sName))
                            {
                                si.sCode = (sCode.Trim() != "") ? sCode : tbSupplierInfo.GetNewSupplierNum();
                                si.sName = sName;
                                //si.sCode = sCode;

                                si.sAppendTime = sAppendTime;

                                if (tbSupplierInfo.AddSupplierInfo(si) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增供应商." + si.sName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                AddErrLine("供货商:" + sName + ",已存在,请更换!");
                                AddScript("window.setTimeout('history.back(1);',2000);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            bool nOK = false;
                            if (si.sName != sName)
                            {
                                if (!tbSupplierInfo.ExistsSupplierInfo(sName))
                                {
                                    nOK = true;
                                }
                                else
                                {
                                    nOK = false;
                                    AddErrLine("供货商:" + sName + ",已存在,请更换!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }
                            sCode = (sCode.Trim() != "") ? sCode : tbSupplierInfo.GetNewSupplierNum();
                            if (si.sCode != sCode)
                            {
                                if (!tbSupplierInfo.ExistsSupplierInfoCode(sCode))
                                {
                                    nOK = true;
                                }
                                else
                                {
                                    nOK = false;
                                    AddErrLine("供货商 编码:" + sCode + ",已存在,请更换!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }
                            if (nOK)
                            {
                                try
                                {
                                    si.sName = sName;
                                    si.sCode = sCode;

                                    tbSupplierInfo.UpdateSupplierInfo(si);
                                    Logs.AddEventLog(this.userid, "修改供应商." + si.sName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                                }
                            }
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        SupplierClass = DataClass.GetSupplierClassInfoToHTML();
                        if (Act == "Add")
                        {
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbSupplierInfo.DeleteSupplierInfo(HTTPRequest.GetString("sid"));
                                Logs.AddEventLog(this.userid, "删除供应商." + HTTPRequest.GetString("sid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }