public static List <Unit> ToList(BLL.Unit v) { List <Unit> list = new List <Unit>(); while (!v.EOF) { Unit t = new Unit(); if (!v.IsColumnNull("ID")) { t.ID = v.ID; } if (!v.IsColumnNull("Name")) { t.Name = v.Unit; } if (!v.IsColumnNull("Description")) { t.Description = v.Description; } //if(!v.IsColumnNull("IsDeleted")) // t.IsDeleted = v.IsDeleted; //if(!v.IsColumnNull("UpdateTime")) // t.UpdateTime = v.UpdateTime; list.Add(t); v.MoveNext(); } return(list); }
private void RptBind(string _strWhere) { this.txtKeywords.Text = this.keywords; BLL.Unit bll = new BLL.Unit(); this.rptList.DataSource = bll.GetList(0, _strWhere, "Id DESC"); this.rptList.DataBind(); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("unit_manage", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.Unit bll = new BLL.Unit(); //批量删除 for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除计量单位成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("unit_list.aspx", "keywords={0}", txtKeywords.Text.Trim())); }
private void ShowInfo(int _id) { BLL.Unit bll = new BLL.Unit(); Model.Unit model = bll.GetModel(_id); txtName.Text = model.Name; txtRemark.Text = model.Remark; }
public static void SaveList(List <HCMIS.Desktop.DirectoryServices.Units> list) { BLL.Unit bv = new BLL.Unit(); foreach (HCMIS.Desktop.DirectoryServices.Units v in list) { // try to load by primary key bv.LoadByPrimaryKey(v.ID.Value); // if the entry doesn't exist, create it if (bv.RowCount == 0) { bv.AddNew(); } // populate the contents of v on the to the database list if (v.ID.HasValue) { bv.ID = v.ID.Value; } if (v.Name != "" && v.Name != null) { bv.Unit = v.Name; } if (v.Description != "" && v.Description != null) { bv.Description = v.Description; } //if( v.IsDeleted.HasValue ) // bv.IsDeleted = v.IsDeleted.Value; //if( v.UpdateTime.HasValue ) // bv.UpdateTime = v.UpdateTime.Value; bv.Save(); } }
public static List <int> GetDeletedIDsAfter(long LastVersion) { BLL.Unit v = new BLL.Unit(); //v.LoadDeletedIDs(LastVersion); List <int> list = new List <int>(); while (!v.EOF) { list.Add((int)v.GetColumn("ID")); v.MoveNext(); } return(list); }
public static void DeleteList(List <int> list) { BLL.Unit bv = new BLL.Unit(); foreach (int v in list) { // try to load by primary key bv.LoadByPrimaryKey(v); // if the entry doesn't exist, create it if (bv.RowCount > 0) { bv.MarkAsDeleted(); bv.Save(); } // populate the contents of v on the to the database list } }
private bool DoAdd() { bool result = false; Model.Unit model = new Model.Unit(); BLL.Unit bll = new BLL.Unit(); model.Name = txtName.Text; model.Remark = txtRemark.Text; if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加计量单位:" + model.Name); //记录日志 result = true; } return(result); }
private bool DoEdit(int _id) { bool result = false; BLL.Unit bll = new BLL.Unit(); Model.Unit model = bll.GetModel(_id); model.Name = txtName.Text; model.Remark = txtRemark.Text; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改计量单位:" + model.Name); //记录日志 result = true; } return(result); }
public static List <Unit> GetUpdatesAfter(long?lastVersion, DateTime?lastUpdateTime) { BLL.Unit v = new BLL.Unit(); if (lastVersion.HasValue && lastVersion.Value != 0) { v.LoadUpdatesAfter(Convert.ToInt32(lastVersion.Value)); } else if (lastUpdateTime.HasValue) { //v.LoadUpdatesAfterByTime(lastUpdateTime.Value); } else { v.LoadAll(); } return(ToList(v)); }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("所属客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.StoreMode storeModeBLL = new BLL.StoreMode(); DataTable storeModeDT = storeModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlStoreMode.Items.Clear(); this.ddlStoreMode.Items.Add(new ListItem("存储方式", "")); foreach (DataRow dr in storeModeDT.Rows) { this.ddlStoreMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.HandlingMode handlingModeBLL = new BLL.HandlingMode(); DataTable handlingModeDT = handlingModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlHandlingMode.Items.Clear(); this.ddlHandlingMode.Items.Add(new ListItem("装卸方式", "")); foreach (DataRow dr in handlingModeDT.Rows) { this.ddlHandlingMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Unit unitBLL = new BLL.Unit(); DataTable unitDT = unitBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlUnit.Items.Clear(); this.ddlUnit.Items.Add(new ListItem("计量单位", "")); foreach (DataRow dr in unitDT.Rows) { this.ddlUnit.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
public static List<Unit> GetAll() { BLL.Unit v = new BLL.Unit(); v.LoadAll(); return ToList(v); }
public static List<Unit> GetUpdatesAfter(long? lastVersion,DateTime? lastUpdateTime) { BLL.Unit v = new BLL.Unit(); if(lastVersion.HasValue && lastVersion.Value != 0) { v.LoadUpdatesAfter( Convert.ToInt32(lastVersion.Value) ); }else if(lastUpdateTime.HasValue) { //v.LoadUpdatesAfterByTime(lastUpdateTime.Value); }else { v.LoadAll(); } return ToList(v); }
public static void SaveList(List<HCMIS.Desktop.DirectoryServices.Units> list) { BLL.Unit bv = new BLL.Unit(); foreach (HCMIS.Desktop.DirectoryServices.Units v in list) { // try to load by primary key bv.LoadByPrimaryKey(v.ID.Value); // if the entry doesn't exist, create it if (bv.RowCount == 0) { bv.AddNew(); } // populate the contents of v on the to the database list if( v.ID.HasValue ) bv.ID = v.ID.Value; if( v.Name != "" && v.Name != null ) bv.Unit = v.Name; if( v.Description != "" && v.Description != null ) bv.Description = v.Description; //if( v.IsDeleted.HasValue ) // bv.IsDeleted = v.IsDeleted.Value; //if( v.UpdateTime.HasValue ) // bv.UpdateTime = v.UpdateTime.Value; bv.Save(); } }
public static List <Unit> GetAll() { BLL.Unit v = new BLL.Unit(); v.LoadAll(); return(ToList(v)); }
public static void DeleteList(List<int> list) { BLL.Unit bv = new BLL.Unit(); foreach (int v in list) { // try to load by primary key bv.LoadByPrimaryKey(v); // if the entry doesn't exist, create it if (bv.RowCount > 0) { bv.MarkAsDeleted(); bv.Save(); } // populate the contents of v on the to the database list } }
public static List<int> GetDeletedIDsAfter(long LastVersion) { BLL.Unit v = new BLL.Unit(); //v.LoadDeletedIDs(LastVersion); List<int> list = new List<int>(); while (!v.EOF) { list.Add((int)v.GetColumn("ID")); v.MoveNext(); } return list; }