Exemple #1
0
        public BillsType SelectBillsType(int id, IDbConnection conn)
        {
            string sql = @"
            select ID,Code,Name,IsOut,Actived,Remark
            from MD_BillsType where ID=@ID";
            List <SqlParameter> paramList = new List <SqlParameter>();

            paramList.Add(new SqlParameter("@ID", id));
            SqlDataReader reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn);
            BillsType     type   = null;

            while (reader.Read())
            {
                type         = new BillsType();
                type.ID      = reader.GetInt32(0);
                type.Code    = reader.GetString(1);
                type.Name    = reader.GetString(2);
                type.IsOut   = reader.GetBoolean(3);
                type.Actived = reader.GetBoolean(4);
                if (!reader.IsDBNull(5))
                {
                    type.Remark = reader.GetString(5);
                }
            }
            reader.Close();
            return(type);
        }
Exemple #2
0
 /// <summary>
 /// 删除一条票据类型信息
 /// </summary>
 /// <param name="id"></param>
 /// <param name="deleter"></param>
 public void DeleteBillsType(BillsType billsType, string deleter)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IBillsTypeDAO dao = DAOFactory.Instance.CreateBillsTypeDAO();
         dao.DeleteBillsType(billsType.ID, conn);
     }
 }
Exemple #3
0
 /// <summary>
 /// 保存修改过的票据类型信息
 /// </summary>
 /// <param name="type"></param>
 /// <param name="Modifier"></param>
 public void SaveBillsType(BillsType type, string Modifier)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IBillsTypeDAO dao = DAOFactory.Instance.CreateBillsTypeDAO();
         dao.UpdateBillsType(type, conn);
     }
 }
Exemple #4
0
 /// <summary>
 /// 新增一条票据类别
 /// </summary>
 /// <param name="type"></param>
 /// <param name="creator"></param>
 public void CreateBillsType(BillsType type, string creator)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IBillsTypeDAO dao = DAOFactory.Instance.CreateBillsTypeDAO();
         dao.InsertBillsType(type, conn);
     }
 }
Exemple #5
0
 /// <summary>
 /// 用于修改
 /// </summary>
 /// <param name="model"></param>
 public FrmBillsType(BillsType model)
 {
     InitializeComponent();
     this.Text               = string.Format(this.Text, "修改类别");
     this.Model              = model;
     this.txtCode.Text       = model.Code;
     this.txtName.Text       = model.Name;
     this.ckbIsOut.Checked   = model.IsOut;
     this.ckbActived.Checked = model.Actived;
     this.txtRemark.Text     = model.Remark;
 }
 public void EditData(BillsType model)
 {
     model.UserId = CookieHelper.UserId.ToInt32();
     if (model.Id <= 0)
     {
         commonbll.Insert(model);
     }
     else
     {
         commonbll.Update(model);
     }
 }
Exemple #7
0
        public void InsertBillsType(BillsType type, IDbConnection conn, IDbTransaction trans)
        {
            string sql = @"
            Insert into MD_BillsType(Code,Name,IsOut,Actived,Remark) 
            values(@Code,@Name,@IsOut,@Actived,@Remark) ";
            List <SqlParameter> paramList = new List <SqlParameter>();

            paramList.Add(new SqlParameter("@Code", type.Code));
            paramList.Add(new SqlParameter("@Name", type.Name));
            paramList.Add(new SqlParameter("@IsOut", type.IsOut));
            paramList.Add(new SqlParameter("@Actived", type.Actived));
            paramList.Add(new SqlParameter("@Remark", type.Remark));
            DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlTransaction)trans);
        }
Exemple #8
0
        public void UpdateBillsType(BillsType type, IDbConnection conn, IDbTransaction trans)
        {
            string sql = @"
            Update MD_BillsType set 
                Code=@Code,Name=@Name,IsOut=@IsOut,Actived=@Actived,Remark=@Remark
            where ID=@ID";
            List <SqlParameter> paramList = new List <SqlParameter>();

            paramList.Add(new SqlParameter("@Code", type.Code));
            paramList.Add(new SqlParameter("@Name", type.Name));
            paramList.Add(new SqlParameter("@IsOut", type.IsOut));
            paramList.Add(new SqlParameter("@Actived", type.Actived));
            paramList.Add(new SqlParameter("@Remark", type.Remark));
            paramList.Add(new SqlParameter("@ID", type.ID));
            DataAccessUtil.ExecuteNonQuery(sql, paramList, (SqlTransaction)trans);
        }
Exemple #9
0
        private List <BillsType> GetSelectModelList()
        {
            List <BillsType> selectedModelList = new List <BillsType>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)row.Cells[0];
                if (cell.EditedFormattedValue != null && (bool)cell.EditedFormattedValue == true)
                {
                    BillsType selectedModel = (BillsType)row.Tag;
                    selectedModelList.Add(selectedModel);
                }
            }
            if (selectedModelList.Count == 0)
            {
                throw new ApplicationException("请选择要操作的内容。");
            }
            return(selectedModelList);
        }
Exemple #10
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         //Verify
         if (string.IsNullOrEmpty(this.txtCode.Text.Trim()))
         {
             throw new ApplicationException("编码不能为空");
         }
         if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
         {
             throw new ApplicationException("名称不能为空");
         }
         //save
         ModelService modelService = new ModelService();
         if (this.Model == null)//新建
         {
             BillsType model = new BillsType();
             model.Code    = this.txtCode.Text.Trim();
             model.Name    = this.txtName.Text.Trim();
             model.IsOut   = this.ckbIsOut.Checked;
             model.Actived = this.ckbActived.Checked;
             model.Remark  = this.txtRemark.Text.Trim();
             modelService.CreateBillsType(model, PermissionService.GetCurrentUser().Name);
         }
         else//修改
         {
             this.Model.Code    = this.txtCode.Text.Trim();
             this.Model.Name    = this.txtName.Text.Trim();
             this.Model.IsOut   = this.ckbIsOut.Checked;
             this.Model.Actived = this.ckbActived.Checked;
             this.Model.Remark  = this.txtRemark.Text.Trim();
             modelService.SaveBillsType(this.Model, PermissionService.GetCurrentUser().Name);
         }
         //close diaglog
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ErrorHandler.OnError(ex);
     }
 }
Exemple #11
0
        public BillsType GetBillsType(string billsTypeName)
        {
            if (_AllBillsType == null)
            {
                _AllBillsType = GetAllBillsType();
            }
            BillsType billsType = null;

            foreach (BillsType item in _AllBillsType)
            {
                if (item.Name == billsTypeName)
                {
                    billsType = item;
                }
            }
            if (billsType == null)
            {
                throw new ApplicationException("不存在的票据类型");
            }
            return(billsType);
        }
Exemple #12
0
        private List <BillsType> SelectBillsType(string sql, List <SqlParameter> paramList, SqlConnection conn)
        {
            SqlDataReader    reader = DataAccessUtil.ExecuteReader(sql, paramList, (SqlConnection)conn);
            List <BillsType> list   = new List <BillsType>();

            while (reader.Read())
            {
                BillsType type = new BillsType();
                type.ID      = reader.GetInt32(0);
                type.Code    = reader.GetString(1);
                type.Name    = reader.GetString(2);
                type.IsOut   = reader.GetBoolean(3);
                type.Actived = reader.GetBoolean(4);
                if (!reader.IsDBNull(5))
                {
                    type.Remark = reader.GetString(5);
                }
                list.Add(type);
            }
            reader.Close();
            return(list);
        }
Exemple #13
0
 /// <summary>
 /// 根据给定的一些条件来进行票据的模糊查询
 /// </summary>
 /// <param name="fromDate"></param>
 /// <param name="toDate"></param>
 /// <param name="companyCond"></param>
 /// <param name="drugsCond"></param>
 /// <param name="drugsFromCond"></param>
 /// <param name="drugsCategoryCond"></param>
 /// <param name="storeHouseCond"></param>
 /// <param name="billMaker"></param>
 /// <returns></returns>
 public List <Bills> SearchBill(DateTime fromDate, DateTime toDate, string companyCond, string drugsCond, string drugsFromCond, string drugsCategoryCond, string storeHouseCond, User billMaker, string billsID, BillsType billsType)
 {
     using (IDbConnection conn = DAOFactory.Instance.OpenConnection())
     {
         IBillsDAO           dao = DAOFactory.Instance.CreateBillsDAO();
         SearchBillsTemplate sbt = new SearchBillsTemplate();
         sbt.FromDate    = fromDate;
         sbt.ToDate      = toDate;
         sbt.CompanyCond = companyCond;
         sbt.BillMaker   = billMaker.Name;
         List <Bills> billsList = dao.SearchBills(sbt, conn);
         for (int i = billsList.Count - 1; i >= 0; i--)
         {
             Bills bill = billsList[i];
             if (!bill.ID.ToString().Contains(billsID))
             {
                 billsList.Remove(bill);
             }
             if (!billsType.Equals(bill.BillsType))
             {
                 billsList.Remove(bill);
             }
         }
         return(billsList);
     }
 }
 public bool Update(BillsType model)
 {
     return(commonbll.Update(model));
 }
 public bool Insert(BillsType model)
 {
     return(commonbll.Insert(model));
 }