Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Maticsoft.Model.customer> DataTableToList(DataTable dt)
        {
            List <Maticsoft.Model.customer> modelList = new List <Maticsoft.Model.customer>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Maticsoft.Model.customer model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.customer();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.source       = dt.Rows[n]["source"].ToString();
                    model.customername = dt.Rows[n]["customername"].ToString();
                    model.tel          = dt.Rows[n]["tel"].ToString();
                    model.intention    = dt.Rows[n]["intention"].ToString();
                    model.agent        = dt.Rows[n]["agent"].ToString();
                    model.agenttel     = dt.Rows[n]["agenttel"].ToString();
                    model.zygw         = dt.Rows[n]["zygw"].ToString();
                    model.flag         = dt.Rows[n]["flag"].ToString();
                    if (dt.Rows[n]["createdate"].ToString() != "")
                    {
                        model.createdate = DateTime.Parse(dt.Rows[n]["createdate"].ToString());
                    }
                    model.level = dt.Rows[n]["level"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Rid.Value = string.IsNullOrEmpty(Request["id"]) ? "" : Request["id"];

            if (!string.IsNullOrEmpty(Rid.Value))
            {
                Maticsoft.BLL.customer   bll   = new Maticsoft.BLL.customer();
                Maticsoft.Model.customer model = bll.GetModel(Convert.ToInt32(Rid.Value));


                agent.Text        = model.agent;
                agenttel.Text     = model.agenttel;
                createdate.Text   = (model.createdate).ToString();
                customername.Text = model.customername;
                flag.Text         = model.flag;
                intention.Text    = model.intention;
                level.Text        = model.level;
                source.Text       = model.source;
                tel.Text          = model.tel;
                zygw.Text         = model.zygw;
            }
        }
    }
Пример #3
0
    protected void save_Click(object sender, EventArgs e)
    {
        Maticsoft.BLL.customer   bll   = new Maticsoft.BLL.customer();
        Maticsoft.Model.customer model = new Maticsoft.Model.customer();

        model.agent        = agent.Text;
        model.agenttel     = agenttel.Text;
        model.createdate   = Convert.ToDateTime(createdate.Text);
        model.customername = customername.Text;
        model.flag         = flag.Text;
        model.intention    = intention.Text;
        model.level        = level.Text;
        model.source       = source.Text;
        model.tel          = tel.Text;
        model.zygw         = zygw.Text;



        if (string.IsNullOrEmpty(Rid.Value))
        {
            if (bll.Add(model) > 0)
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(Page, "添加成功", "get_customer.aspx");
            }
            else
            {
                Maticsoft.Common.MessageBox.Show(Page, "添加失败");
            }
        }
        else
        {
            model.id = Convert.ToInt32(Rid.Value);
            if (bll.Update(model))
            {
                Maticsoft.Common.MessageBox.ShowAndRedirect(Page, "更新成功", "get_customer.aspx");
            }
            else
            {
                Maticsoft.Common.MessageBox.Show(Page, "更新失败");
            }
        }
    }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.customer model)
 {
     return(dal.Update(model));
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Maticsoft.Model.customer model)
 {
     return(dal.Add(model));
 }