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

            if (rowsCount > 0)
            {
                LPWeb.Model.ArchiveLeadStatus model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.ArchiveLeadStatus();
                    if (dt.Rows[n]["LeadStatusId"].ToString() != "")
                    {
                        model.LeadStatusId = int.Parse(dt.Rows[n]["LeadStatusId"].ToString());
                    }
                    model.LeadStatusName = dt.Rows[n]["LeadStatusName"].ToString();
                    if (dt.Rows[n]["Enabled"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Enabled"].ToString() == "1") || (dt.Rows[n]["Enabled"].ToString().ToLower() == "true"))
                        {
                            model.Enabled = true;
                        }
                        else
                        {
                            model.Enabled = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        var    archiveLeadStatus = new LPWeb.Model.ArchiveLeadStatus();
        string leadStatusName    = this.txtLeadSource.Text.Trim();
        var    status            = false;

        if (!string.IsNullOrEmpty(leadStatusName))
        {
            archiveLeadStatus.LeadStatusName = leadStatusName;
            archiveLeadStatus.Enabled        = true;
            try
            {
                bllArchiveLeadStatus.Add(archiveLeadStatus);
                status = true;
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
            }

            if (status == true)
            {
                //reload the grid data
                FillDataGrid(string.Empty);
                //todo:display successfuly message
                PageCommon.WriteJsEnd(this, "Lead Status added successfully.", PageCommon.Js_RefreshSelf);
            }
            else
            {
                //todo:display faild message
                PageCommon.WriteJsEnd(this, "Failed to add the Lead Status.", PageCommon.Js_RefreshSelf);
            }
        }
        else
        {
            //todo:display the field can not be empty
            PageCommon.WriteJsEnd(this, "Lead Status cannot be empty.", PageCommon.Js_RefreshSelf);
        }
    }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LPWeb.Model.ArchiveLeadStatus model)
 {
     return(dal.Update(model));
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LPWeb.Model.ArchiveLeadStatus model)
 {
     return(dal.Add(model));
 }