/// <summary> /// Saves this instance. /// </summary> /// <returns></returns> private bool Save() { bool status = false; try { if (isNew) { bllCompanyGeneral.Add(modCompanyGeneral); } else { //Get old group id (Rocky - 2011-1-30) LPWeb.BLL.Groups groupMgr = new LPWeb.BLL.Groups(); LPWeb.Model.Groups model = groupMgr.GetCompanyGroup(); this.iOldGroupID = model.GroupId; bllCompanyGeneral.Update(modCompanyGeneral); } status = true; } catch (Exception exception) { status = false; LPLog.LogMessage(exception.Message); } return status; }
/// <summary> /// 获得数据列表 /// </summary> public List<LPWeb.Model.Groups> DataTableToList(DataTable dt) { List<LPWeb.Model.Groups> modelList = new List<LPWeb.Model.Groups>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LPWeb.Model.Groups model; for (int n = 0; n < rowsCount; n++) { model = new LPWeb.Model.Groups(); if (dt.Rows[n]["GroupId"].ToString() != "") { model.GroupId = int.Parse(dt.Rows[n]["GroupId"].ToString()); } model.GroupName = dt.Rows[n]["GroupName"].ToString(); model.OrganizationType = dt.Rows[n]["OrganizationType"].ToString(); if (dt.Rows[n]["OrganizationId"].ToString() != "") { model.OrganizationId = int.Parse(dt.Rows[n]["OrganizationId"].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; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LPWeb.Model.Groups model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LPWeb.Model.Groups model) { return dal.Add(model); }