示例#1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (paraname.Text.Trim() != null && paraname.Text.Trim() != "" &&
             paravalue.Text.Trim() != null && paravalue.Text.Trim() != "" &&
             setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "")
         {
             MSProductParaDAL ParaDal = new MSProductParaDAL();
             if (ParaDal.ExistMSPPara(paraname.Text, setpvalue.Value))
             {
                 MessageBox.Show(this, "该参数已经存在!");
             }
             else
             {
                 MSProductPara paraModel = new MSProductPara();
                 paraModel.PID     = setpvalue.Value;
                 paraModel.ParName = paraname.Text;
                 //paraModel.ParValue = paravalue.Text;
                 paraModel.ParState = 0;
                 paraModel.ID       = Guid.NewGuid().ToString("N").ToUpper();
                 if (ParaDal.AddMSPPara(paraModel))
                 {
                     MessageBox.Show(this, "操作成功!");
                 }
                 else
                 {
                     MessageBox.Show(this, "操作失败!");
                 }
             }
         }
         else
         {
             MessageBox.Show(this, "请选择相应产品或参数值!");
         }
     }
     else
     {
         return;
     }
 }
示例#2
0
        /// <summary>
        /// 添加属性列表
        /// </summary>
        bool AddProductModel()
        {
            string isnull = ""; bool result = false;

            if (Request["m"] != null && Request["m"] != "")
            {
                try
                {
                    mcount = Convert.ToInt32(Common.Common.NoHtml(Request["m"]));
                }
                catch (Exception)
                {
                }
            }
            if (mcount > 0)
            {
                MSProductParaDAL paraDal = new MSProductParaDAL();
                for (int i = 0; i < mcount; i++)
                {
                    string m_model = string.Empty;
                    string m_price = string.Empty;
                    string m_stock = string.Empty; int stock = 0;
                    #region --------------------获取model值---------------------
                    try
                    {
                        m_model = HttpContext.Current.Request.Form.Get("model" + i).ToString();
                    }
                    catch (Exception)
                    {
                        m_model = isnull;
                    }
                    try
                    {
                        m_price = HttpContext.Current.Request.Form.Get("mprice" + i).ToString();
                    }
                    catch (Exception)
                    {
                        m_price = isnull;
                    }
                    try
                    {
                        m_stock = HttpContext.Current.Request.Form.Get("mstock" + i).ToString();
                    }
                    catch (Exception)
                    {
                        m_stock = isnull;
                    }
                    if (m_stock != null && m_stock != "")
                    {
                        try
                        {
                            stock = Convert.ToInt32(m_stock);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    #endregion
                    MSProductPara paraModel = new MSProductPara();
                    paraModel.ParName = m_model;
                    paraModel.Price   = Convert.ToDecimal(m_price);
                    paraModel.Stock   = Convert.ToInt32(stock);
                    paraModel.ID      = Guid.NewGuid().ToString("N").ToUpper();
                    paraModel.PID     = pid;
                    if (paraDal.AddMSPPara(paraModel))
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }