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

            if (rowsCount > 0)
            {
                LPWeb.Model.CompanyTaskPick model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.CompanyTaskPick();
                    if (dt.Rows[n]["TaskNameID"].ToString() != "")
                    {
                        model.TaskNameID = int.Parse(dt.Rows[n]["TaskNameID"].ToString());
                    }
                    model.TaskName = dt.Rows[n]["TaskName"].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;
                        }
                    }

                    model.SequenceNumber = int.Parse(dt.Rows[n]["SequenceNumber"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        var companyTaskPick = new LPWeb.Model.CompanyTaskPick();


        string TaskName = this.txtTaskName.Text.Trim();

        if (bllTaskPickList.Exists(TaskName))
        {
            PageCommon.WriteJsEnd(this, "The task name is already taken.", PageCommon.Js_RefreshSelf);

            return;
        }

        int SequenceNumber = int.Parse(this.txtSequenceNumber.Text.Trim());

        if (bllTaskPickList.ExistsSequenceNumber(SequenceNumber))
        {
            PageCommon.WriteJsEnd(this, "The task name is already taken.", PageCommon.Js_RefreshSelf);

            return;
        }



        var status = false;


        companyTaskPick.TaskName       = TaskName;
        companyTaskPick.Enabled        = true;
        companyTaskPick.SequenceNumber = SequenceNumber;
        try
        {
            bllTaskPickList.Add(companyTaskPick);
            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, "Added successfully.", PageCommon.Js_RefreshSelf);
        }
        else
        {
            //todo:display faild message
            PageCommon.WriteJsEnd(this, "Failed to add the task.", PageCommon.Js_RefreshSelf);
        }
    }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LPWeb.Model.CompanyTaskPick model)
 {
     return(dal.Update(model));
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(LPWeb.Model.CompanyTaskPick model)
 {
     return(dal.Add(model));
 }