Example #1
0
 private void gridView_ValidateCell(object sender, DevExpress.Xpf.Grid.GridCellValidationEventArgs e)
 {
     if (e.Column.FieldName.Equals("FVoucherTplID"))
     {
         ICSaleDisplay    sale   = (ICSaleDisplay)e.Row;
         VoucherTplSimple vchTpl = cboVoucherTpl.GetItemFromValue(e.Value) as VoucherTplSimple;
         if (vchTpl.TransType != sale.FTransType)
         {
             e.ErrorType    = ErrorType.Warning;
             e.ErrorContent = "模板类型错误,请选择对应单据类型的模板!";
             e.IsValid      = false;
         }
     }
 }
        public List <VoucherTplSimple> getAll()
        {
            String  sql = "select * from fsICVoucherTpl";
            DataSet ds  = db.Query(sql);
            List <VoucherTplSimple> lst = new List <VoucherTplSimple>();

            if (!DbHelper.getInstance().IsEmpty(ds))
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    VoucherTplSimple tpl = new VoucherTplSimple();
                    //取表头
                    tpl.InterID   = Convert.ToInt32(row["FInterID"]);
                    tpl.Name      = Convert.ToString(row["FName"]);
                    tpl.TransType = Convert.ToInt32(row["FTplType"]);
                    lst.Add(tpl);
                }
            }
            return(lst);
        }