protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            CommonAdapter ca         = new CommonAdapter();
            int           currencyID = Int32.Parse(e.Row.Cells[4].Text);
            e.Row.Cells[4].Text = ca.getCurrencyByID(currencyID);

            if (e.Row.RowIndex > -1 && this.SelectedItems != null)
            {
                CheckBox cbx = (CheckBox)e.Row.FindControl("cbItem");
                int      i   = e.Row.RowIndex;
                string   id  = string.Format("{0}${1}${2}${3}${4}",
                                             this.GridView1.DataKeys[i].Values[0].ToString(),
                                             this.GridView1.DataKeys[i].Values[1].ToString(),
                                             this.GridView1.DataKeys[i].Values[2].ToString(),
                                             this.GridView1.DataKeys[i].Values[3].ToString(),
                                             this.GridView1.DataKeys[i].Values[4].ToString()
                                             );
                if (SelectedItems.Contains(id))
                {
                    cbx.Checked = true;
                }
                else
                {
                    cbx.Checked = false;
                }
            }
        }
    }
示例#2
0
        public DataSet Query(int startRowIndex, int maximumRows, string connection, string tableName, string selectFields, string where, string orderBy, ref int totalCount)
        {
            QueryCondition qc = new QueryCondition(startRowIndex, maximumRows, selectFields, tableName, orderBy, where);

            //OnBuildQueryCondition(qc);

            CommonAdapter adapter = new CommonAdapter(connection);

            DataSet result = adapter.SplitPageQuery(qc, totalCount <= 0);

            if (result.Tables.Count > 1)
            {
                totalCount = (int)result.Tables[1].Rows[0][0];
            }

            var contextCacheKey = connection + "." + tableName + ".Query";

            ObjectContextCache.Instance[contextCacheKey] = totalCount;

            //当页码超出索引的,返回最大页
            if (result.Tables[0].Rows.Count == 0 && totalCount > 0)
            {
                int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows;

                totalCount = -1;

                result = Query(newStartRowIndex, maximumRows, connection, tableName, selectFields, where, orderBy, ref totalCount);
            }

            return(result);
        }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        CommonAdapter ca = new CommonAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lblCurrency = e.Row.Cells[7].FindControl("lbl_fcurrencyid") as Label;
            if (!string.IsNullOrEmpty(lblCurrency.Text))
            {
                int currencyID = Int32.Parse(lblCurrency.Text);
                lblCurrency.Text = ca.getCurrencyByID(currencyID);
                Label lblAmountFor = e.Row.Cells[3].FindControl("lbl_amountfor") as Label;
                amountforAll += Decimal.Parse(lblAmountFor.Text);
                Label lblReceiveAmountFor = e.Row.Cells[4].FindControl("lbl_fpayamountfor") as Label;
                payamountforAll += Decimal.Parse(lblReceiveAmountFor.Text);
                Label lblUnReceiveAmountFor = e.Row.Cells[5].FindControl("lbl_funpayamountfor") as Label;
                unpayamountforAll += Decimal.Parse(lblUnReceiveAmountFor.Text);
            }
        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            e.Row.Cells[2].Text = "汇总";
            e.Row.Cells[3].Text = amountforAll.ToString();      //采购发票中金额
            e.Row.Cells[4].Text = payamountforAll.ToString();   //已支付金额
            e.Row.Cells[5].Text = unpayamountforAll.ToString(); //未支付金额
            e.Row.Cells[6].Text = checkamountforAll.ToString(); //单据金额
        }
    }
        private void bindControls()
        {
            RoundImageView rImgView = FindViewById <RoundImageView>(Resource.Id.img_avator);

            if (blogger.Avatar.Contains("png") || blogger.Avatar.Contains("jpg") || blogger.Avatar.Contains("gif"))
            {
                imgLoader.DisplayImage(blogger.Avatar, rImgView, displayImageOptions);
            }
            TextView textHomePage = FindViewById <TextView>(Resource.Id.text_homepage);

            textHomePage.Text = blogger.Link.ToString();
            TextView textBloggerApp = FindViewById <TextView>(Resource.Id.text_blogapp);

            textBloggerApp.Text = blogger.BlogApp;
            TextView textPostCount = FindViewById <TextView>(Resource.Id.text_blog_count);

            textPostCount.Text = "博文数:" + blogger.PostCount.ToString();
            TextView textLastPost = FindViewById <TextView>(Resource.Id.text_lastupdate);

            textLastPost.Text    = "最后更新:" + CommonHelper.DateDiff(DateTime.Now, blogger.Updated) + "前";
            comAdaper            = new CommonAdapter <Article>(this, Resource.Layout.blogger_article_list_item, articles);
            comAdaper.OnGetView += comAdapter_OnGetView;
            pListView.Adapter    = comAdaper;
            pListView.ItemClick += pListView_ItemClick;
            ptrl = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
            ptrl.setOnRefreshListener(this);
            ptrl.AutoRefresh();
        }
示例#5
0
    protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        CommonAdapter ca = new CommonAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lblCurrency = e.Row.Cells[7].FindControl("lbl_fcurrencyid") as Label;
            if (!string.IsNullOrEmpty(lblCurrency.Text))
            {
                int currencyID = Int32.Parse(lblCurrency.Text);
                lblCurrency.Text = ca.getCurrencyByID(currencyID);
                Label lblDepositAmountForAll = e.Row.Cells[3].FindControl("lbl_amount_all") as Label;
                if (!string.IsNullOrEmpty(lblDepositAmountForAll.Text))
                {
                    DepositAmountForAll += Decimal.Parse(lblDepositAmountForAll.Text);
                }

                Label lblPayAmountFor = e.Row.Cells[4].FindControl("lbl_fpayamountfor") as Label;
                DepositPayAmountforAll += Decimal.Parse(lblPayAmountFor.Text);
                Label lblUnPayAmountFor = e.Row.Cells[5].FindControl("lbl_funpayamountfor") as Label;
                DepositUnPayAmountforAll += Decimal.Parse(lblUnPayAmountFor.Text);
                TextBox lblDepositCheckAmountFor = e.Row.Cells[6].FindControl("txt_deposit_checkamountfor") as TextBox;
                DepositCheckAmountForAll += Decimal.Parse(lblDepositCheckAmountFor.Text);
            }
        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            e.Row.Cells[2].Text = "汇总";
            e.Row.Cells[3].Text = DepositAmountForAll.ToString();      //采购订单中金额
            e.Row.Cells[4].Text = DepositPayAmountforAll.ToString();   //已支付金额
            e.Row.Cells[5].Text = DepositUnPayAmountforAll.ToString(); //未支付金额
            e.Row.Cells[6].Text = DepositCheckAmountForAll.ToString(); //单据金额
        }
    }
示例#6
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        CommonAdapter ca = new CommonAdapter();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (!string.IsNullOrEmpty(e.Row.Cells[7].Text) && e.Row.Cells[7].Text != "&nbsp;")
            {
                int currencyID = Int32.Parse(e.Row.Cells[7].Text);
                e.Row.Cells[7].Text = ca.getCurrencyByID(currencyID);
                amountforAll       += Decimal.Parse(e.Row.Cells[3].Text);
                payamountforAll    += Decimal.Parse(e.Row.Cells[4].Text);
                unpayamountforAll  += Decimal.Parse(e.Row.Cells[5].Text);
                TextBox tb_fcheckamountfor = e.Row.Cells[6].FindControl("txt_fcheckamountfor") as TextBox;
                checkamountforAll += Decimal.Parse(tb_fcheckamountfor.Text);
            }
        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            e.Row.Cells[2].Text = "汇总";
            e.Row.Cells[3].Text = amountforAll.ToString();      //单据金额
            e.Row.Cells[4].Text = payamountforAll.ToString();   //已支付金额
            e.Row.Cells[5].Text = unpayamountforAll.ToString(); //未支付金额
            e.Row.Cells[6].Text = checkamountforAll.ToString(); //单据金额
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         init();
         txt_recetpt_no.Text = LoadLastReceiptID();
         d_date.Text         = check_date.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         CommonAdapter ca            = new CommonAdapter();
         int           selectedValue = ca.getIDByName(UserInfoAdapter.CurrentUser.Name);
         ddl_preparer.SelectedValue = ddl_checker.SelectedValue = selectedValue.ToString();
     }
     else
     {
         UserInfo user = UserInfoAdapter.CurrentUser;
         if (Session[user.Name] != null)
         {
             ds = (DataSet)Session[user.Name];
             Session[user.Name] = null;
             show(ds, GridView1);
         }
         if (Session[user.Name + "InDec"] != null)
         {
             ds = (DataSet)Session[user.Name + "InDec"];
             Session[user.Name + "InDec"] = null;
             show(ds, GridView2);
             initAmount();
         }
         if (Session[user.Name + "Depos"] != null)
         {
             ds = (DataSet)Session[user.Name + "Depos"];
             Session[user.Name + "Depos"] = null;
             show(ds, GridView3);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            init();
        }
        else
        {
            UserInfo user = UserInfoAdapter.CurrentUser;

            if (Session[user.Name + "POOrder"] != null)
            {
                ds = (DataSet)Session[user.Name + "POOrder"];
                Session[user.Name + "POOrder"] = null;
                show(ds);
            }
        }
        txt_deposit_id.Text = LoadLastDepositId();
        amountAll           = Decimal.Parse(GridView1.FooterRow.Cells[3].Text);
        agent_date.Text     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        CommonAdapter ca            = new CommonAdapter();
        int           selectedValue = ca.getIDByName(UserInfoAdapter.CurrentUser.Name);

        ddl_agenter.SelectedValue = selectedValue.ToString();
    }
示例#9
0
    private void setData(string id)
    {
        if (string.IsNullOrEmpty(id))
        {
            return;
        }
        PaymentInDecreaseAdapter ida = new PaymentInDecreaseAdapter();
        DataSet head = ida.getInDecreaseHeadByBillNo(id);

        lbl_customer.Text      = head.Tables[0].Rows[0]["customer"].ToString();
        lbl_indecrease_id.Text = id;
        if (!string.IsNullOrEmpty(head.Tables[0].Rows[0]["currencyID"].ToString()))
        {
            int           currency = Int32.Parse(head.Tables[0].Rows[0]["currencyID"].ToString());
            CommonAdapter ca       = new CommonAdapter();
            lbl_currency.Text = ca.getCurrencyByID(currency);
        }

        lbl_agenter.Text     = head.Tables[0].Rows[0]["agenter"].ToString();
        lbl_agente_date.Text = head.Tables[0].Rows[0]["agent_date"].ToString();

        DataSet list = ida.getInDecreaseInfoByBillNo(id);

        gridviewBind(list);
    }
示例#10
0
    protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
            string type             = e.Row.Cells[3].Text;
            e.Row.Cells[3].Text = raa.getTypeNameByCode(type);
            CommonAdapter ca         = new CommonAdapter();
            int           currencyID = Int32.Parse(e.Row.Cells[6].Text);
            e.Row.Cells[6].Text = ca.getCurrencyByID(currencyID);
            //0-未核销,1-部分核销,2-完全核销
            int check_status = Int32.Parse(e.Row.Cells[14].Text);
            switch (check_status)
            {
            case 1:
                e.Row.Cells[14].Text = "部分核销";
                break;

            case 2:
                e.Row.Cells[14].Text = "完全核销";
                break;

            default:
                e.Row.Cells[14].Text = "未核销";
                break;
            }

            int DepartmentID = Int32.Parse(e.Row.Cells[8].Text);
            e.Row.Cells[8].Text = ca.getDepartmentNameByID(DepartmentID);

            int EmpID = Int32.Parse(e.Row.Cells[9].Text);
            e.Row.Cells[9].Text = ca.getEmpNameByID(EmpID);

            int CheckerID = Int32.Parse(e.Row.Cells[10].Text);
            e.Row.Cells[10].Text = ca.getEmpNameByID(CheckerID);



            string auditstatus = e.Row.Cells[13].Text.ToLower();
            if (auditstatus == "3")
            {
                e.Row.Cells[13].Text = "通过";
                Button btnDelete = e.Row.Cells[0].FindControl("btnDelete") as Button;
                btnDelete.Enabled = false;
            }
            else if (auditstatus == "2")
            {
                e.Row.Cells[13].Text = "不通过";
            }
            else if (auditstatus == "1")
            {
                e.Row.Cells[13].Text = "待审核";
            }
            else
            {
                e.Row.Cells[13].Text = "未提交";
            }
        }
    }
示例#11
0
    private void ddlDataBind()
    {
        CommonAdapter ca = new CommonAdapter();

        DropDownList1.DataSource     = ca.getTaxReturnState();
        DropDownList1.DataTextField  = "name";
        DropDownList1.DataValueField = "code";
        DropDownList1.DataBind();
    }
示例#12
0
 private void bindControls()
 {
     comAdaper            = new CommonAdapter <ArticleComment>(this, Resource.Layout.comments_list_item, comments);
     comAdaper.OnGetView += comAdapter_OnGetView;
     pListView.Adapter    = comAdaper;
     ptrl.setOnRefreshListener(this);
     btnSend        = FindViewById <Button>(Resource.Id.btn_send);
     btnSend.Click += btnSend_Click;
     textComments   = FindViewById <EditText>(Resource.Id.text_comment);
 }
    private void ddlCurrencyBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getCurrency();

        ddl_currency.DataTextField  = "FName";
        ddl_currency.DataValueField = "FCurrencyID";
        ddl_currency.DataSource     = ds;
        ddl_currency.DataBind();
    }
示例#14
0
    private void ddlDepartmentBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getDepartment();

        ddl_department.DataTextField  = "FName";
        ddl_department.DataValueField = "FItemID";
        ddl_department.DataSource     = ds;
        ddl_department.DataBind();
    }
    private void ddlAgenterBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getEmp();

        ddl_agenter.DataTextField  = "FName";
        ddl_agenter.DataValueField = "FItemID";
        ddl_agenter.DataSource     = ds;
        ddl_agenter.DataBind();
    }
示例#16
0
    private void delivery_mode_Bind()
    {
        CommonAdapter ca = new CommonAdapter();

        DropDownList1.DataSource     = ca.getDeliveryMode();
        DropDownList1.DataTextField  = "name";
        DropDownList1.DataValueField = "code";
        DropDownList1.DataBind();
        DropDownList1.SelectedIndex = 0;
    }
        private void button2_Click(object sender, EventArgs e)
        {
            var buff = Image.FromFile(openFileDialog1.FileName).GetBuffer();

            using (var adp = new CommonAdapter())
            {
                string fileName = Path.GetFileName(openFileDialog1.FileName);
                adp.spAddImage(fileName, buff, 1);
            }
            productsTableAdapter.AddProduct(dataSet.Products, Convert.ToInt32(comboBoxCategory.SelectedValue), Convert.ToInt32(comboBoxBrand.SelectedValue), Convert.ToInt32(comboBoxModel.SelectedValue), Convert.ToInt32(numericUpDownPrice.Value), 1);
            this.productsTableAdapter.Fill(this.dataSet.Products);
        }
示例#18
0
    private void ddlDataBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getTaxReturnState();
        DataRow       dr = ds.Tables[0].NewRow();

        dr["name"] = "请选择";
        dr["code"] = "";
        ds.Tables[0].Rows.InsertAt(dr, 0);
        DropDownList1.DataSource     = ds;
        DropDownList1.DataTextField  = "name";
        DropDownList1.DataValueField = "code";
        DropDownList1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            CommonAdapter ca         = new CommonAdapter();
            int           currencyID = 1;
            if (!string.IsNullOrEmpty(e.Row.Cells[3].Text) && e.Row.Cells[3].Text != "&nbsp;")
            {
                currencyID = Int32.Parse(e.Row.Cells[3].Text);
            }

            e.Row.Cells[3].Text = ca.getCurrencyByID(currencyID);
        }
    }
示例#20
0
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        int         index = GridView1.SelectedIndex;
        GridViewRow gvr   = GridView1.SelectedRow;

        txt_account_id.Text   = gvr.Cells[3].Text;
        txt_account_name.Text = gvr.Cells[1].Text;
        txt_opening_bank.Text = gvr.Cells[2].Text;
        HiddenField1.Value    = gvr.Cells[3].Text;
        txt_amount.Text       = gvr.Cells[5].Text;
        CommonAdapter ca = new CommonAdapter();

        ddl_currency.SelectedValue = ca.getIDByCurrency(gvr.Cells[4].Text).ToString();
    }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.my_posts);
     InitalComponents();
     SetPageTitle("我的博客");
     comAdaper            = new CommonAdapter <Article>(this, Resource.Layout.blogger_article_list_item, articles);
     comAdaper.OnGetView += comAdapter_OnGetView;
     pListView.Adapter    = comAdaper;
     pListView.ItemClick += pListView_ItemClick;
     ptrl = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
     ptrl.setOnRefreshListener(this);
     ptrl.AutoRefresh();
 }
示例#22
0
 private void btnSetImage_Click(object sender, EventArgs e)
 {
     if (fileDialog.ShowDialog() == DialogResult.OK)
     {
         var buff = Image.FromFile(fileDialog.FileName).GetBuffer();
         using (var adp = new CommonAdapter())
         {
             string fileName = Path.GetFileName(fileDialog.FileName);
             adp.spAddImage(fileName, buff, 1);  //todo add userid
             this.productsTableAdapter.Fill(this.contactHomeDataSet.Products);
             this.vwFilesTableAdapter.Fill(this.contactHomeDataSet.VwFiles);
         }
     }
 }
示例#23
0
    public void DropDownListBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getXuFang();
        DataRow       dr = ds.Tables[0].NewRow();

        dr["company_name"] = "请选择";
        dr["id"]           = 0;
        ds.Tables[0].Rows.InsertAt(dr, 0);
        ddlModel.DataSource     = ds;
        ddlModel.DataTextField  = "company_name";
        ddlModel.DataValueField = "id";

        ddlModel.DataBind();
    }
示例#24
0
    public void ddlGongFangBind()
    {
        CommonAdapter ca = new CommonAdapter();
        DataSet       ds = ca.getCustomers();
        DataRow       dr = ds.Tables[0].NewRow();

        dr["company_name"] = "请选择";
        dr["id"]           = 0;
        ds.Tables[0].Rows.InsertAt(dr, 0);
        ddlGongFang.DataSource     = ds;
        ddlGongFang.DataTextField  = "company_name";
        ddlGongFang.DataValueField = "id";

        ddlGongFang.DataBind();
    }
        private DataView InnerQuery(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            QueryCondition qc = new QueryCondition(startRowIndex,
                maximumRows, "*", this._DefaultTableName, orderBy, where);

            OnBuildQueryCondition(qc);

            CommonAdapter adapter = new CommonAdapter(GetConnectionName());

            DataView result = adapter.SplitPageQuery(qc, ref totalCount);

            ObjectContextCache.Instance[ContextCacheKey] = totalCount;

            return result;
        }
示例#26
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.article_fragment_page, container, false);

            InitalComponents();
            plistView            = view.FindViewById <PullableListView>(Resource.Id.lv_articles);
            comAdaper            = new CommonAdapter <NewInfo>(this.Activity, Resource.Layout.new_list_item, news);
            comAdaper.OnGetView += comAdapter_OnGetView;
            plistView.Adapter    = comAdaper;
            plistView.ItemClick += plistView_ItemClick;
            ptrl = view.FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
            ptrl.setOnRefreshListener(this);
            ptrl.AutoRefresh();
            return(view);
        }
示例#27
0
        private static WfClientUserOperationLogPageQueryResult QueryUserOperationLog(QueryCondition qc, int totalCount)
        {
            CommonAdapter adapter = new CommonAdapter(UserOperationLogAdapter.Instance.ConnectionName);

            UserOperationLogCollection serverLogs = adapter.SplitPageQuery <UserOperationLog, UserOperationLogCollection>(qc, ref totalCount);

            WfClientUserOperationLogCollection clientLogs = WfClientUserOperationLogConverter.Instance.ServerToClient(serverLogs);

            WfClientUserOperationLogPageQueryResult result = new WfClientUserOperationLogPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientLogs);

            return(result);
        }
    private void HeadBind()
    {
        string            account_id = ddl_account.SelectedValue;
        AccountLogAdapter ala        = new AccountLogAdapter();
        DataSet           ds         = ala.getAccount(account_id);
        DataRow           dr         = ds.Tables[0].Rows[0];

        lbl_account_id.Text   = dr["account_id"].ToString();
        lbl_account_name.Text = dr["account_name"].ToString();
        lbl_opening_bank.Text = dr["opening_bank"].ToString();
        CommonAdapter ca         = new CommonAdapter();
        int           currencyID = Int32.Parse(dr["currencyID"].ToString());

        lbl_currency.Text = ca.getCurrencyByID(currencyID);
        lbl_amount.Text   = dr["amount"].ToString();
    }
示例#29
0
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string        currencyId = e.Row.Cells[3].Text;
            CommonAdapter ca         = new CommonAdapter();
            e.Row.Cells[3].Text = ca.getCurrencyByID(Int32.Parse(currencyId));

            HiddenField hnfCheckStatus = e.Row.Cells[0].FindControl("hnf_check_status") as HiddenField;
            int         check_status   = Int32.Parse(hnfCheckStatus.Value);
            if (check_status == 2)
            {
                Button btn_delete = e.Row.Cells[0].FindControl("btnDelete") as Button;
                btn_delete.Enabled = false;
            }
        }
    }
        public WfClientProcessDescriptorInfoPageQueryResult QueryProcessDescriptorInfo(int startRowIndex, int maximumRows, string where, string orderBy, int totalCount)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            if (orderBy.IsNullOrEmpty())
            {
                orderBy = "MODIFY_TIME DESC";
            }

            string selectFields = "PROCESS_KEY, APPLICATION_NAME, PROGRAM_NAME, PROCESS_NAME, ENABLED, CREATE_TIME, CREATOR_ID, CREATOR_NAME, MODIFY_TIME, MODIFIER_ID, MODIFIER_NAME, IMPORT_TIME, IMPORT_USER_ID, IMPORT_USER_NAME";

            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                selectFields,
                ORMapping.GetMappingInfo(typeof(WfProcessDescriptorInfo)).TableName,
                orderBy);

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendTenantCode();

            if (where.IsNotEmpty())
            {
                where += " AND ";
            }

            where += builder.ToSqlString(TSqlBuilder.Instance);

            qc.WhereClause = where;

            CommonAdapter adapter = new CommonAdapter(WfProcessDescriptorInfoAdapter.Instance.ConnectionName);

            WfProcessDescriptorInfoCollection processInfo = adapter.SplitPageQuery <WfProcessDescriptorInfo, WfProcessDescriptorInfoCollection>(qc, ref totalCount);

            WfClientProcessDescriptorInfoCollection clientInfo = new WfClientProcessDescriptorInfoCollection();

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessDescriptorInfoPageQueryResult result = new WfClientProcessDescriptorInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return(result);
        }
示例#31
0
        private static WfClientProcessCurrentInfoPageQueryResult QueryProcessInfo(QueryCondition qc, int totalCount)
        {
            CommonAdapter adapter = new CommonAdapter(WfProcessCurrentInfoAdapter.Instance.ConnectionName);

            WfProcessCurrentInfoCollection processInfo = adapter.SplitPageQuery <WfProcessCurrentInfo, WfProcessCurrentInfoCollection>(qc, ref totalCount);

            WfClientProcessCurrentInfoCollection clientInfo = new WfClientProcessCurrentInfoCollection();

            WfClientProcessCurrentInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessCurrentInfoPageQueryResult result = new WfClientProcessCurrentInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return(result);
        }
        private static WfClientProcessCurrentInfoPageQueryResult QueryProcessInfo(QueryCondition qc, int totalCount)
        {
            CommonAdapter adapter = new CommonAdapter(WfProcessCurrentInfoAdapter.Instance.ConnectionName);

            WfProcessCurrentInfoCollection processInfo = adapter.SplitPageQuery<WfProcessCurrentInfo, WfProcessCurrentInfoCollection>(qc, ref totalCount);

            WfClientProcessCurrentInfoCollection clientInfo = new WfClientProcessCurrentInfoCollection();

            WfClientProcessCurrentInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessCurrentInfoPageQueryResult result = new WfClientProcessCurrentInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return result;
        }
        private static WfClientUserOperationLogPageQueryResult QueryUserOperationLog(QueryCondition qc, int totalCount)
        {
            CommonAdapter adapter = new CommonAdapter(UserOperationLogAdapter.Instance.ConnectionName);

            UserOperationLogCollection serverLogs = adapter.SplitPageQuery<UserOperationLog, UserOperationLogCollection>(qc, ref totalCount);

            WfClientUserOperationLogCollection clientLogs = WfClientUserOperationLogConverter.Instance.ServerToClient(serverLogs);

            WfClientUserOperationLogPageQueryResult result = new WfClientUserOperationLogPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientLogs);

            return result;
        }
        public DataSet Query(int startRowIndex, int maximumRows, string connection, string tableName, string selectFields, string where, string orderBy, ref int totalCount)
        {
            QueryCondition qc = new QueryCondition(startRowIndex, maximumRows, selectFields, tableName, orderBy, where);

            //OnBuildQueryCondition(qc);

            CommonAdapter adapter = new CommonAdapter(connection);

            DataSet result = adapter.SplitPageQuery(qc, totalCount <= 0);

            if (result.Tables.Count > 1)
                totalCount = (int)result.Tables[1].Rows[0][0];

            var contextCacheKey = connection + "." + tableName + ".Query";
            ObjectContextCache.Instance[contextCacheKey] = totalCount;

            //当页码超出索引的,返回最大页
            if (result.Tables[0].Rows.Count == 0 && totalCount > 0)
            {
                int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows;

                totalCount = -1;

                result = Query(newStartRowIndex, maximumRows, connection, tableName, selectFields, where, orderBy, ref totalCount);
            }

            return result;
        }
        public WfClientProcessDescriptorInfoPageQueryResult QueryProcessDescriptorInfo(int startRowIndex, int maximumRows, string where, string orderBy, int totalCount)
        {
            OperationContext.Current.FillContextToOguServiceContext();

            if (orderBy.IsNullOrEmpty())
                orderBy = "MODIFY_TIME DESC";

            string selectFields = "PROCESS_KEY, APPLICATION_NAME, PROGRAM_NAME, PROCESS_NAME, ENABLED, CREATE_TIME, CREATOR_ID, CREATOR_NAME, MODIFY_TIME, MODIFIER_ID, MODIFIER_NAME, IMPORT_TIME, IMPORT_USER_ID, IMPORT_USER_NAME";

            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                selectFields,
                ORMapping.GetMappingInfo(typeof(WfProcessDescriptorInfo)).TableName,
                orderBy);

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendTenantCode();

            if (where.IsNotEmpty())
                where += " AND ";

            where += builder.ToSqlString(TSqlBuilder.Instance);

            qc.WhereClause = where;

            CommonAdapter adapter = new CommonAdapter(WfProcessDescriptorInfoAdapter.Instance.ConnectionName);

            WfProcessDescriptorInfoCollection processInfo = adapter.SplitPageQuery<WfProcessDescriptorInfo, WfProcessDescriptorInfoCollection>(qc, ref totalCount);

            WfClientProcessDescriptorInfoCollection clientInfo = new WfClientProcessDescriptorInfoCollection();

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(processInfo, clientInfo);

            WfClientProcessDescriptorInfoPageQueryResult result = new WfClientProcessDescriptorInfoPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientInfo);

            return result;
        }
示例#36
0
        /// <summary>
        /// 表单分页查询
        /// </summary>
        /// <param name="startRowIndex"></param>
        /// <param name="maximumRows"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public AppCommonInfoCollection GetFormQueryWithCount(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            if (string.IsNullOrEmpty(where))
                where = "1 = 1";

            if (string.IsNullOrEmpty(orderBy))
                orderBy = "CREATE_TIME DESC";

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false)
            {
                ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(string.Empty);

                string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance));

                where = string.Format("{0} AND ACI.RESOURCE_ID IN ({1})", where, resourceIDList);
            }

            //LDM 加上ACI.PROGRAM_NAME as [PROGRAM_NAME1],
            //兼容远洋地产的查询(表单工作程序里没有对 APPLICATIONFORM_INFO 表插入数据行)
            string strSelect = @" ACI.APPLICATION_NAME,ACI.[PROGRAM_NAME] as [PROGRAM_NAME_MCS],ACI.RESOURCE_ID,ACI.[SUBJECT],ACI.[EMERGENCY]," +
                               "  ACI.URL,ACI.CREATOR_ID, ACI.CREATOR_NAME,ACI.CREATE_TIME,ACI.DRAFT_DEPARTMENT_NAME";

            string strfrom = @" WF.APPLICATIONS_COMMON_INFO as ACI (nolock)";
           

            QueryCondition qc = new QueryCondition(
                       startRowIndex,
                       maximumRows,
                       strSelect,
                       strfrom,
                       orderBy,
                       where
                       );
            CommonAdapter commonAdapter = new CommonAdapter(ConnectionDefine.SearchConnectionName);
            DataSet ds = commonAdapter.SplitPageQuery(qc, totalCount < 0);

            AppCommonInfoCollection FormQueryEntitys = new AppCommonInfoCollection();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                AppCommonInfo entity = new AppCommonInfo();

                ORMapping.DataRowToObject(row, entity);
                FormQueryEntitys.Add(entity);
            }

            if (ds.Tables.Count > 1)
                totalCount = (int)ds.Tables[1].Rows[0][0];

            HttpContext.Current.Items["UserFormQueryEntityCount"] = totalCount;

            //当页码超出索引的,返回最大页
            if (FormQueryEntitys.Count == 0 && totalCount > 0)
            {
                int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows;

                totalCount = -1;

                FormQueryEntitys = GetFormQueryWithCount(newStartRowIndex, maximumRows, where, orderBy, ref totalCount);
            }

            return FormQueryEntitys;
        }