Ejemplo n.º 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() != "")
         {
             MSProductParaDAL ParaDal   = new MSProductParaDAL();
             MSProductPara    paraModel = new MSProductPara();
             paraModel.ParName  = paraname.Text;
             paraModel.ParState = 0;
             paraModel.ID       = strID;
             //paraModel.ParValue = paravalue.Text;
             if (ParaDal.UpdateMSPPara(paraModel))
             {
                 MessageBox.Show(this, "操作成功!");
             }
             else
             {
                 MessageBox.Show(this, "操作失败!");
             }
         }
         else
         {
             MessageBox.Show(this, "请输入相应名称或参数值!");
         }
     }
     else
     {
         return;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改属性列表
        /// </summary>
        bool EditeProductModel()
        {
            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;
                    string editepara = string.Empty;
                    #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)
                        {
                        }
                    }
                    try
                    {
                        editepara = HttpContext.Current.Request.Form.Get("editepara" + i).ToString();
                    }
                    catch (Exception)
                    {
                        editepara = isnull;
                    }
                    #endregion
                    MSProductPara paraModel = new MSProductPara();
                    paraModel.ParName = m_model;
                    paraModel.Price   = Convert.ToDecimal(m_price);
                    paraModel.Stock   = Convert.ToInt32(stock);
                    paraModel.PID     = pid;
                    if (editepara != null && editepara != "")
                    {
                        paraModel.ID = editepara;
                        if (paraDal.UpdateMSPPara(paraModel))
                        {
                            result = true;
                        }
                    }
                    else
                    {
                        paraModel.ID = Guid.NewGuid().ToString("N").ToUpper();
                        if (paraDal.AddMSPPara(paraModel))
                        {
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }