private void SetRelationNoContract()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'NoContract'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPayout.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPayout.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbApportion.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbApportion.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string queryString = "select 'Payment_' + a.PaymentCode as ContractCode, '' as ContractID, '非合同请款' + b.PaymentID as ContractName, c.SubjectCode as CostCode, c.SubjectCode as FullCode, b.SupplyCode as SupplierCode, b.SupplyName as SupplierName, a.ItemMoney as Money, a.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PaymentItem a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b, PayoutItem oi, Voucher v, VoucherDetail vd where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and isnull(b.IsContract, 0) = 0 and a.PaymentItemCode = oi.PaymentItemCode and vd.RelaType = '付款' and vd.RelaCode = oi.PayoutCode and v.VoucherCode = vd.VoucherCode and v.Status in (1, 2)";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 string text4 = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             DataTable tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "NoContract", "ContractMoney");
             foreach (DataRow row in this.tbContract.Rows)
             {
                 string text2 = ConvertRule.ToString(row["ContractCode"]).Replace("Payment_", "");
                 string text3 = ConvertRule.ToString(row["CostCode"]);
                 queryString = "select b.VoucherCode as PayoutCode, b.CheckDate as PayoutDate, a.DebitMoney as Money, 'Payment_' + pi.PaymentCode as ContractCode, a.SubjectCode as CostCode, a.SubjectCode as FullCode, '' as CostBudgetSetCode, '' as PBSType, '' as PBSCode from VoucherDetail a inner join Voucher b on b.VoucherCode = a.VoucherCode       and b.Status in (1, 2), PayoutItem oi, PaymentItem pi where b.ProjectCode = '" + this.ProjectCode + "' and a.RelaType = '付款' and a.RelaCode = oi.PayoutCode and oi.PaymentItemCode = pi.PaymentItemCode and pi.PaymentCode = '" + text2 + "'";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddPayout(tbSrc, "Contract");
                 foreach (DataRow row2 in tbSrc.Rows)
                 {
                     row["ContractPayReal"] = ConvertRule.ToDecimal(row["ContractPayReal"]) + ConvertRule.ToDecimal(row2["Money"]);
                 }
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #2
0
        /// <summary>
        /// 验证用户是否拥有删除权限
        /// </summary>
        /// <returns></returns>
        public bool CheckUserDtl(string NoticCode)
        {
            //string stationcode      = "";
            //string RoleCode         = "";
            string OperationCode = "";

            try
            {
                QueryAgent qa = new QueryAgent();

                DAL.QueryStrategy.RoleOperation sb = new RmsPM.DAL.QueryStrategy.RoleOperation();
                sb.AddStrategy(new Strategy(RoleOperationName.UserCode, user.UserCode));
                //sb.AddStrategy(new Strategy( RoleOperationName.UserCode,"080102"));
                string  sql = sb.BuildMainQueryString();
                DataSet Ds  = qa.ExecSqlForDataSet(sql);
                for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
                {
                    if (Ds.Tables[0].Rows[i]["OperationCode"].ToString() == "080103")
                    {
                        OperationCode += Ds.Tables[0].Rows[i]["OperationCode"].ToString();
                        return(true);
                    }
                }
                qa.Dispose();
                return(false);
            }
            catch (System.Exception EC)
            {
                //System.Console.Write(EC.Message);
                string h = EC.Message;
                return(false);
            }
        }
Exemple #3
0
 public static void DeleteAllSupplier()
 {
     try
     {
         QueryAgent agent = new QueryAgent();
         try
         {
             string  queryString = "select top 1 a.ContractName, b.SupplierName from Contract a, Supplier b where a.SupplierCode = b.SupplierCode";
             DataSet set         = agent.ExecSqlForDataSet(queryString);
             try
             {
                 if (set.Tables[0].Rows.Count > 0)
                 {
                     throw new Exception(string.Format("供应商“{0}”已生成合同,不能删除", ConvertRule.ToString(set.Tables[0].Rows[0]["SupplierName"])));
                 }
             }
             finally
             {
                 set.Dispose();
             }
             agent.ExecuteSql("delete SupplierSubjectSet");
             agent.ExecuteSql("delete Supplier");
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #4
0
        public static DataTable GetStationStyle(string stationID)
        {
            DataTable table2;
            V_DesktopStrategyBuilder builder = new V_DesktopStrategyBuilder();

            builder.AddStrategy(new Strategy(V_DesktopStrategyName.StationID, stationID));
            string     queryString = builder.BuildMainQueryString() + " order by ControlOrder";
            QueryAgent agent       = new QueryAgent();

            try
            {
                DataTable stationConfig = agent.ExecSqlForDataSet(queryString).Tables[0];
                if (stationConfig.Rows.Count <= 0)
                {
                    stationConfig = GetStationConfig("-1", "-2");
                }
                table2 = stationConfig;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                agent.Dispose();
            }
            return(table2);
        }
        /// <summary>
        /// 生汇率数据源
        /// </summary>
        private void ExchangeRateSoure()
        {
            if (this.ViewMoney.Visible)
            {
                return;
            }
            string     path  = Page.Server.MapPath(XMLUrl) + "ExchangeRate.XML";
            QueryAgent aq    = new QueryAgent();
            string     sql   = "Select * from ExchangeRate Where Status in (0,1)";
            DataSet    ds    = aq.ExecSqlForDataSet(sql);
            int        count = ds.Tables[0].Rows.Count;

            for (int i = 0; i < count; i++)
            {
                ds.Tables[0].Rows[i]["RemittanceAverage"] = Convert.ToDecimal(ds.Tables[0].Rows[i]["RemittanceAverage"]) / 100;
            }
            if (ExchangeRateControl_EV.Value == null || ExchangeRateControl_EV.Value == "")
            {
                for (int i = 0; i < count; i++)
                {
                    if (ds.Tables[0].Rows[i]["MoneyType"].ToString() == this.MoneyType)
                    {
                        this.ExchangeRateControl_EV.Value = ds.Tables[0].Rows[i]["RemittanceAverage"].ToString();
                        break;
                    }
                }
            }
            if (MoneyType == "人民币 (RMB)")
            {
                ExchangeRateControl_E.Enabled = false;
            }
            ds.WriteXml(path, XmlWriteMode.IgnoreSchema);
            Page.Response.Write("<xml id=\"ExchangeRate\" src=\"" + XMLUrl + "ExchangeRate.XML\"/>");
        }
Exemple #6
0
        public static DataTable GetSalBudgetBeforePeriodSum(string ProjectCode, int IYear)
        {
            DataTable table2;

            try
            {
                SalBudgetDtlStrategyBuilder builder = new SalBudgetDtlStrategyBuilder();
                builder.AddStrategy(new Strategy(SalBudgetDtlStrategyName.ProjectCode, ProjectCode));
                ArrayList pas = new ArrayList();
                pas.Add("0");
                pas.Add(IYear.ToString());
                builder.AddStrategy(new Strategy(SalBudgetDtlStrategyName.IYearRange, pas));
                builder.AddStrategy(new Strategy(SalBudgetDtlStrategyName.IMonth, "0"));
                string     queryString = builder.BuildQuerySumString();
                QueryAgent agent       = new QueryAgent();
                DataTable  table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                agent.Dispose();
                table2 = table;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
Exemple #7
0
        public static string BuildAccessTypeString(string operationCode, string classCode, string userCode, string codes, string tableName, string keyColumnName, string typeColumnName, string createUserColumnName)
        {
            string     text        = "";
            string     queryString = string.Format(" select accessRange.groupCode,SystemGroup.FullID,RoleLevel from accessRange left join SystemGroup on accessRange.GroupCode=SystemGroup.GroupCode where OperationCode = '{0}' and (( AccessRangeType=0 and relationCode = '{1}' ) or ( AccessRangeType=1 and relationCode in ( {2} ) )  ) ", new object[] { operationCode, userCode, codes });
            QueryAgent agent       = new QueryAgent();
            DataSet    set         = agent.ExecSqlForDataSet(queryString);

            agent.Dispose();
            foreach (DataRow row in set.Tables[0].Rows)
            {
                if (!row.IsNull("FullID"))
                {
                    string text3 = row["FullID"].ToString();
                    int    num   = 0;
                    if (!row.IsNull("RoleLevel"))
                    {
                        num = (int)row["RoleLevel"];
                    }
                    if (num == 0)
                    {
                        text = text + string.Format("or ( dbo.GetSystemGroupFullID({0}.{1}) like '{2}%' ) ", tableName, typeColumnName, text3);
                    }
                    else
                    {
                        text = text + string.Format("or ( dbo.GetSystemGroupFullID({0}.{1}) like '{2}%' and {0}.{3}='{4}'  ) ", new object[] { tableName, typeColumnName, text3, createUserColumnName, userCode });
                    }
                }
            }
            return(text);
        }
Exemple #8
0
        private string GetSortID(string strWBSCode)
        {
            string strSortID = "";

            // 取得本级SortID然后+5
            DAL.QueryStrategy.WBSStrategyBuilder WSB = new RmsPM.DAL.QueryStrategy.WBSStrategyBuilder();
            WSB.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ParentCode, strWBSCode));
            WSB.AddOrder("SortID", false);
            string sql = WSB.BuildMainQueryString();

            QueryAgent QA = new QueryAgent();

            QA.SetTopNumber(1);
            DataSet dsTask = QA.ExecSqlForDataSet(sql);

            QA.Dispose();
            if (dsTask.Tables.Count > 0 && dsTask.Tables[0].Rows.Count > 0)
            {
                long intTmp = BLL.ConvertRule.ToLong(dsTask.Tables[0].Rows[0]["SortID"]) + 1;
                strSortID = "0" + intTmp.ToString();
            }
            else
            {
                EntityData entitySort = WBSDAO.GetV_TaskByCode(strWBSCode);
                strSortID = entitySort.GetString("SortID") + "01";
            }
            return(strSortID);
        }
Exemple #9
0
        public static DataTable GetHasRightFullCodeTable(string strUserCode, string strTaskPersons)
        {
            if (strTaskPersons == "")
            {
                strTaskPersons = "0,1,2,4,9";
            }
            string     queryString = string.Format("select fullcode from task where  wbscode in ( select wbscode from taskperson where type in (" + strTaskPersons + ") and ((roletype='0' and usercode='{0}')  or (roletype='1' and usercode in (select stationcode from userrole where usercode ='{0}')))) order by len(fullcode) desc ", strUserCode);
            QueryAgent agent       = new QueryAgent();
            DataTable  table       = agent.ExecSqlForDataSet(queryString).Tables[0];
            DataTable  table2      = new DataTable();

            table2.Columns.Add("FullCode");
            foreach (DataRow row in table.Rows)
            {
                bool   flag  = false;
                string text2 = row["FullCode"].ToString();
                foreach (DataRow row2 in table2.Rows)
                {
                    string text3 = row2["FullCode"].ToString();
                    if (text2.IndexOf(text3) == 0)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    DataRow row3 = table2.NewRow();
                    row3["FullCode"] = text2;
                    table2.Rows.Add(row3);
                }
            }
            return(table2);
        }
Exemple #10
0
    private void showtree()
    {
        this.TreeView1.Nodes.Clear();
        string     sqlUnit = "Select * from Unit";
        QueryAgent qa      = new QueryAgent();

        tbUnit = qa.ExecSqlForDataSet(sqlUnit).Tables[0];

        if (tbUnit.Select("parentunitcode=''").Length > 0)
        {
            for (int i = 0; i < tbUnit.Select("parentunitcode=''").Length; i++)
            {
                string   TempId   = tbUnit.Select("parentunitcode=''")[i]["UnitCode"].ToString();
                string   TempText = tbUnit.Select("parentunitcode=''")[i]["UnitName"].ToString();
                TreeNode mytree   = new TreeNode();
                mytree.Value = TempId;
                mytree.Text  = TempText;

                mytree.NavigateUrl = "GK_OA_ComBookList.aspx?UnitCode=" + mytree.Value;
                mytree.Target      = "frameMain";

                mytree = My(mytree, TempId);
                this.TreeView1.Nodes.Add(mytree);
            }
        }

        this.TreeView1.Nodes[0].CollapseAll();
        this.TreeView1.Nodes[0].Expand();
    }
Exemple #11
0
        public static DataTable GetSystemReportDtl(string ReportCode, int ShowFlag)
        {
            DataTable table2;

            try
            {
                DataTable  table = null;
                QueryAgent agent = new QueryAgent();
                try
                {
                    string queryString = string.Format("select * from SystemReportDtl where ReportCode = '{0}' and isnull(ShowFlag, 0) = {1} order by SortNo", ReportCode, ShowFlag);
                    table = agent.ExecSqlForDataSet(queryString).Tables[0];
                }
                finally
                {
                    agent.Dispose();
                }
                table2 = table;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
Exemple #12
0
        /// <summary>
        /// 载入数据
        /// </summary>
        private void LoadData()
        {
            string     strIsAll     = "0";
            EntityData entityNotice = RemindDAO.GetNoticeByCode(strNoticeCode);

            if (entityNotice.HasRecord())
            {
                if (entityNotice.GetInt("status").ToString() != "0")
                {
                    if (entityNotice.GetInt("Type") == 99)
                    {
                        trNotice.Visible = false;
                    }
                    this.lblNoticeClass.Text  = Server.HtmlEncode(entityNotice.GetString("NoticeClass"));//新加通知类型(测试正确删除此注释)
                    this.lblTitle.Text        = Server.HtmlEncode(entityNotice.GetString("Title"));
                    this.lbSubmitname.Text    = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("SubmitPerson").ToString()).ToString();
                    this.lblSubmitDate.Text   = entityNotice.GetDateTimeOnlyDate("SubmitDate");
                    this.divContent.InnerHtml = entityNotice.GetString("Content").Replace("\n", "<br>").Replace("\r", "&nbsp;");
                    strIsAll = entityNotice.GetString("IsAll");
                    //待修改
                    this.lbLastUpdate.Text = RmsPM.BLL.SystemRule.GetUserName(entityNotice.GetString("UserCode").ToString()).ToString() + " 于 " + entityNotice.GetDateTimeOnlyDate("UpdateDate") + "修改";
                }
                else
                {
                    Response.Write(JavaScript.ScriptStart);
                    Response.Write("window.alert('通知已删除');");
                    Response.Write("window.close();");
                    Response.Write(JavaScript.ScriptEnd);
                }
            }
            if (strIsAll == "0")
            {
                string strUsers        = "";
                string strUserNames    = "";
                string strStations     = "";
                string strStationNames = "";
                BLL.ResourceRule.GetAccessRange(this.strNoticeCode, "0801", "080104", ref strUsers, ref strUserNames, ref strStations, ref strStationNames);
                this.lblUser.Text = strUserNames + "," + strStationNames;
                this.lblUser.Text = BLL.StringRule.CutRepeat(this.lblUser.Text);
            }
            else
            {
                this.lblUser.Text = "全体人员";
            }

            //记录该用户已经读了该信息
            User       u         = (User)Session["User"];
            string     strSelect = "select * from UserLookedNotice where noticecode='" + strNoticeCode + "' and usercode='" + u.UserCode + "'";
            string     strInsert = "insert into UserLookedNotice (noticecode,usercode) values ('" + strNoticeCode + "','" + u.UserCode + "')";
            string     strDelete = "Delete from UserLookedNotice where  noticecode='" + strNoticeCode + "' and usercode='" + u.UserCode + "'";
            QueryAgent qa        = new QueryAgent();
            DataSet    ds        = qa.ExecSqlForDataSet(strSelect);

            if (ds.Tables[0].Rows.Count <= 0)
            {
                qa.ExecuteSql(strInsert);
            }
            qa.Dispose();
            entityNotice.Dispose();
        }
Exemple #13
0
        public string BuildAccessTypeString(string operationCode, string userCode, string codes, string createUserColumnName)
        {
            string     text = "";
            string     functionStructureParentCode = SystemManageDAO.GetFunctionStructureParentCode(operationCode);
            string     queryString = string.Format(" select accessRange.groupCode,SystemGroup.FullID,RoleLevel from accessRange left join SystemGroup on accessRange.GroupCode=SystemGroup.GroupCode where OperationCode = '{0}' and (( AccessRangeType=0 and relationCode = '{1}' ) or ( AccessRangeType=1 and relationCode in ( {2} ) )  ) ", new object[] { operationCode, userCode, codes });
            QueryAgent agent       = new QueryAgent();
            DataSet    set         = agent.ExecSqlForDataSet(queryString);

            agent.Dispose();
            foreach (DataRow row in set.Tables[0].Rows)
            {
                if (!row.IsNull("FullID"))
                {
                    string text4 = row["FullID"].ToString();
                    int    num   = 0;
                    if (!row.IsNull("RoleLevel"))
                    {
                        num = (int)row["RoleLevel"];
                    }
                    if (num == 0)
                    {
                        text = text + string.Format("or (CaseCode in ( Select a2.CaseCode from  workflowCase a2 where a2.ProcedureCode in(select c1.ProcedureCode from WorkFlowProcedure c1 where isnull(c1.SysType, '') = '') and exists(select 1 from SystemGroup a1 where a1.GroupName in\t(dbo.GetProcedureNameByCaseCode(a2.CaseCode))\tand a1.ParentCode in (select a.GroupCode from SystemGroup a where a.GroupName =dbo.GetProjectNameByCaseCode(a2.CaseCode) and a.classcode='{1}') and a1.FullID like '{0}%'))\t)", text4, functionStructureParentCode);
                    }
                }
            }
            return(text);
        }
Exemple #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (user.HasRight("350301"))
            {
                this.NewButton.Visible = true;
                this.NewButton.Attributes["OnClick"] = "javascript:OpenMiddleWindow('GK_OA_ComBookEdit.aspx?ActType=add','ComBookEdit');";
            }
            else
            {
                this.NewButton.Visible = false;
            }

            string strUnitCode = Request["UnitCode"];
            string strSql      = "";
            if (strUnitCode != "")
            {
                strSql = "Select * from GK_OA_ComBook where UnitCode ='" + strUnitCode + "'";
            }
            else
            {
                strSql = "Select * from GK_OA_ComBook";
            }
            QueryAgent qa     = new QueryAgent();
            DataTable  tbUnit = qa.ExecSqlForDataSet(strSql).Tables[0];
            this.GridView1.DataSource = tbUnit.DefaultView;
            this.GridView1.DataBind();
        }
    }
        private void LoadDataGrid()
        {
            try
            {
                BuildingSubjectSetStrategyBuilder sb = new BuildingSubjectSetStrategyBuilder();
                sb.AddStrategy(new Strategy(BuildingSubjectSetStrategyName.SubjectSetCode, txtSubjectSetCode.Value));

                sb.AddOrder("ProjectName", true);
                sb.AddOrder("BuildingName", true);
                string sql = sb.BuildQueryViewString();

                QueryAgent qa = new QueryAgent();
                DataTable  tb = qa.ExecSqlForDataSet(sql).Tables[0];
                qa.Dispose();

                this.dgList.DataSource = tb;
                this.dgList.DataBind();
                tb.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错:" + ex.Message));
            }
        }
Exemple #16
0
        private void LoadData()
        {
            try
            {
                //temp,天阳要求时间较紧 update by kenny 20070209
                string company = System.Configuration.ConfigurationManager.AppSettings["PMName"].ToLower();
                switch (company)
                {
                case "tianyangoa":
                    this.dgList.Columns[7].Visible = true;
                    break;

                default:
                    this.dgList.Columns[7].Visible = false;
                    break;
                }

                string     sql = (string)this.ViewState["SqlString"];
                QueryAgent qa  = new QueryAgent();
                DataSet    ds  = qa.ExecSqlForDataSet(sql);
                //EntityData entity = qa.FillEntityData( "V_WorkFlowHistory",sql );
                qa.Dispose();
                this.dgList.DataSource = ds;
                this.dgList.DataBind();
                this.GridPagination1.RowsCount = ds.Tables[0].Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }
        }
Exemple #17
0
 private void FillContractChangeCostCode(DataTable tbTemp)
 {
     try
     {
         QueryAgent agent = new QueryAgent();
         foreach (DataRow row in tbTemp.Rows)
         {
             if (ConvertRule.ToString(row["ContractCostCode"]) == "")
             {
                 string    text        = ConvertRule.ToString(row["ContractCode"]);
                 string    text2       = ConvertRule.ToString(row["CostCode"]);
                 string    text3       = ConvertRule.ToString(row["CostBudgetSetCode"]);
                 string    text4       = "";
                 string    queryString = string.Format("select ContractCostCode from ContractCost where ContractCode = '{0}' and CostCode = '{1}' and CostBudgetSetCode = '{2}'", text, text2, text3);
                 DataTable table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 foreach (DataRow row2 in table.Rows)
                 {
                     text4 = text4 + ((text4 == "") ? "" : ",");
                     text4 = text4 + ConvertRule.ToString(row2["ContractCostCode"]);
                 }
                 row["ContractCostCode"] = text4;
             }
         }
         agent.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #18
0
        /// <summary>
        /// 删除所有系统导入的总帐凭证
        /// </summary>
        /// <param name="ProjectCode"></param>
        private static void DeleteAll(string ProjectCode)
        {
            try
            {
                QueryAgent qa = new QueryAgent();
                try
                {
                    //取所有系统导入的总帐凭证(ID为“C”开头)
                    string  sql = string.Format("select VoucherID from voucher where ProjectCode = '{0}' and VoucherID like 'C%'", ProjectCode);
                    DataSet ds  = qa.ExecSqlForDataSet(sql);

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string VoucherID = BLL.ConvertRule.ToString(dr["VoucherID"]);
                        DeleteSingle(ProjectCode, VoucherID);
                    }
                }
                finally
                {
                    qa.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #19
0
        public static int GetPBSUnitFloorCount(string PBSUnitCode)
        {
            int num2;

            try
            {
                int num = 0;
                BuildingStrategyBuilder builder = new BuildingStrategyBuilder();
                builder.AddStrategy(new Strategy(BuildingStrategyName.PBSUnitCode, PBSUnitCode));
                builder.AddOrder("FloorCount", false);
                QueryAgent agent = new QueryAgent();
                agent.SetTopNumber(1);
                string    queryString = builder.BuildMainQueryString();
                DataTable table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                if (table.Rows.Count > 0)
                {
                    num = ConvertRule.ToInt(table.Rows[0]["IFloorCount"]);
                }
                agent.Dispose();
                num2 = num;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num2);
        }
Exemple #20
0
 private void SetPayout()
 {
     try
     {
         this.tbPayout.Rows.Clear();
         this.tbPayout.AcceptChanges();
         this.tbPayoutYm.Rows.Clear();
         this.tbPayoutYm.AcceptChanges();
         QueryAgent agent = new QueryAgent();
         try
         {
             DataRow   row2;
             string    queryString = "select mi.CostCode, c.FullCode, sum(isnull(a.PayoutMoney, 0)) as PayoutMoney from PayoutItem a inner join Payout b on b.PayoutCode = a.PayoutCode, PaymentItem mi left join CBS c on c.CostCode = mi.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = mi.CostBudgetSetCode where a.PaymentItemCode = mi.PaymentItemCode and b.ProjectCode = '" + this.ProjectCode + "' and mi.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and b.Status in (1,2) group by mi.CostCode, c.FullCode";
             DataTable table       = agent.ExecSqlForDataSet(queryString).Tables[0];
             foreach (DataRow row in table.Rows)
             {
                 row2                = this.tbPayout.NewRow();
                 row2["CostCode"]    = row["CostCode"];
                 row2["FullCode"]    = row["FullCode"];
                 row2["PayoutMoney"] = row["PayoutMoney"];
                 this.tbPayout.Rows.Add(row2);
             }
             if ((this.StartYm != "") && (this.EndYm != ""))
             {
                 queryString = "select mi.CostCode, c.FullCode, convert(varchar(6), b.PayoutDate, 112) as PayoutYm, sum(isnull(a.PayoutMoney, 0)) as PayoutMoney from PayoutItem a inner join Payout b on b.PayoutCode = a.PayoutCode, PaymentItem mi left join CBS c on c.CostCode = mi.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = mi.CostBudgetSetCode where a.PaymentItemCode = mi.PaymentItemCode and b.ProjectCode = '" + this.ProjectCode + "' and mi.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and convert(varchar(6), b.PayoutDate, 112) between '" + this.StartYm + "' and '" + this.EndYm + "' and b.Status in (1,2) group by mi.CostCode, c.FullCode, convert(varchar(6), b.PayoutDate, 112)";
                 table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 foreach (DataRow row in table.Rows)
                 {
                     row2                = this.tbPayoutYm.NewRow();
                     row2["CostCode"]    = row["CostCode"];
                     row2["FullCode"]    = row["FullCode"];
                     row2["PayoutYm"]    = row["PayoutYm"];
                     row2["PayoutMoney"] = row["PayoutMoney"];
                     this.tbPayoutYm.Rows.Add(row2);
                 }
             }
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #21
0
        private void LoadData()
        {
            //初始化符合条件的数据列表
            string DocumentName   = "";
            string DocumentPerson = "";
            string StartDate      = "";
            string EndDate        = "";
            string Type           = "";

            if (this.txtDocumentName.Value.Trim() != "")
            {
                DocumentName = this.txtDocumentName.Value.Trim();
            }
            if (this.txtCreatePerson.Value.Trim() != "")
            {
                DocumentPerson = this.txtCreatePerson.Value.Trim();
            }
            Type      = this.SelectType.Value;
            StartDate = this.dtbStartDate.Value;
            EndDate   = this.dtbEndDate.Value;
            try
            {
                RmsPM.DAL.QueryStrategy.DocumentStrategyBuilder CSB = new RmsPM.DAL.QueryStrategy.DocumentStrategyBuilder();

                if (DocumentPerson.Length > 0)
                {
                    CSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.DocumentStrategyName.Author, DocumentPerson));
                }
                if (Type.Length > 0)
                {
                    ArrayList arParam = new ArrayList();
                    arParam.Add("000006");
                    arParam.Add(DocumentName);
                    CSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.DocumentStrategyName.RelationKey, arParam));
                }
                if (StartDate.Length > 0 || EndDate.Length > 0)
                {
                    ArrayList arParam = new ArrayList();
                    arParam.Add(StartDate);
                    arParam.Add(EndDate);
                    CSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.DocumentStrategyName.CreateDateRange, arParam));
                }

                CSB.AddOrder("CreateDate", false);

                string Sql = CSB.BuildMainQueryString();

                QueryAgent QA = new QueryAgent();
                DataSet    ds = QA.ExecSqlForDataSet(Sql);
                QA.Dispose();

                this.dgDocumentList.DataSource = new DataView(ds.Tables[0], "", "", DataViewRowState.CurrentRows);
                this.dgDocumentList.DataBind();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "加载人员列表失败");
            }
        }
Exemple #22
0
 private void SetRelationBalance()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'Balance'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPlan.Select("RecordType = 'Balance'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPlan.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             DataTable tbSrc;
             string    queryString;
             if (this.CostBudgetCode != "")
             {
                 queryString = "select c.FullCode, a.CostCode, 'Balance' as RecordType, 'Balance_' + a.CostCode as ContractCode, '' as ContractID, '预留金额' as ContractName, a.BudgetMoney as Money from CostBudgetDtl a left join CBS c on c.CostCode = a.CostCode where a.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetCode = '" + this.CostBudgetCode + "' and not exists(select * from CBS CBSCount where CBSCount.ParentCode = a.CostCode)";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddRelationContractRow(this.tbContract, tbSrc, "Balance", "ContractMoney");
             }
             if (this.CostBudgetCode != "")
             {
                 queryString = "select c.FullCode, a.CostCode, 'Balance' as RecordType, 'Balance_' + a.CostCode as ContractCode, right('0000' + cast(b.IYear as varchar), 4) + right('00' + cast(b.IMonth as varchar), 2) as PlanYm, b.BudgetMoney as PlanMoney from CostBudgetDtl a left join CBS c on c.CostCode = a.CostCode, CostBudgetMonth b where a.CostBudgetDtlCode = b.CostBudgetDtlCode and a.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetCode = '" + this.CostBudgetCode + "' and right('0000' + cast(b.IYear as varchar), 4) + right('00' + cast(b.IMonth as varchar), 2) between '" + this.StartYm + "' and '" + this.EndYm + "'";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddPlan(tbSrc, "");
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #23
0
        public static DataTable Get_Bidding_SupplierDepartmentIdea(string BiddingPrejudicationCode)
        {
            QueryAgent agent       = new QueryAgent();
            string     queryString = "select * from Bidding_SupplierDepartmentIdea where BiddingPrejudicationCode='" + BiddingPrejudicationCode + "'";
            DataSet    set         = agent.ExecSqlForDataSet(queryString);

            agent.Dispose();
            return(set.Tables[0]);
        }
Exemple #24
0
        public static DataTable Get_LastBiddingPrejudicationByPass(string BiddingPrejudicationCode)
        {
            string     queryString = "select a.DepartmentIdearID,a.BiddingSupplierCode,a.Depart_Build,a.Depart_Project,a.Depart_Agreement,a.Md_Item,a.Md_Project,a.Md_Agreement,a.Director_Project,a.Director_Agreement,a.Director_Finance,a.DepartmentRemark,a.DepartmentRemark1,a.DepartmentRemark2,a.DepartmentRemark3, a.BiddingPrejudicationCode ,b.* from Bidding_SupplierDepartmentIdea a,V_BiddingSupplier b where a.BiddingPrejudicationCode = b.BiddingPrejudicationCode and a.flag='1' and a.BiddingPrejudicationCode ='" + BiddingPrejudicationCode + "' and a.BiddingSupplierCode = b.BiddingSupplierCode";
            QueryAgent agent       = new QueryAgent();
            DataSet    set         = agent.ExecSqlForDataSet(queryString);

            agent.Dispose();
            return(set.Tables[0]);
        }
Exemple #25
0
        private void LoadDataGrid()
        {
            try
            {
                string projectName = this.txtProjectNname.Value;

                int kgYear = 0;

                int jgYear = 0;

                if (this.txtKgYear.Value.Trim().Length > 0)
                {
                    kgYear = int.Parse(this.txtKgYear.Value);
                }
                else


                if (this.txtJgYear.Value.Trim().Length > 0)
                {
                    jgYear = int.Parse(this.txtJgYear.Value);
                }

                RmsPM.DAL.QueryStrategy.ProjectStrategyBuilder ssb = new RmsPM.DAL.QueryStrategy.ProjectStrategyBuilder();
                if (projectName.Length > 0)
                {
                    ssb.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.ProjectStrategyName.ProjectNameLike, projectName));
                }
                if (kgYear > 0)
                {
                    ssb.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.ProjectStrategyName.kgYear, kgYear.ToString()));
                }
                if (jgYear > 0)
                {
                    ssb.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.ProjectStrategyName.jgYear, jgYear.ToString()));
                }

                if (this.SelectStatus.Value != "")
                {
                    ssb.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.ProjectStrategyName.Status, this.SelectStatus.Value));
                }

                ssb.AddOrder("kgDate", false);
                //ssb.AddOrder("Status",true);
                string sql = ssb.BuildMainQueryString();

                Rms.ORMap.QueryAgent qa = new QueryAgent();
                DataSet ds = qa.ExecSqlForDataSet(sql);
                qa.Dispose();

                this.dgList.DataSource = new DataView(ds.Tables[0], "", "", DataViewRowState.CurrentRows);
                this.dgList.DataBind();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "加载项目列表错误。");
            }
        }
Exemple #26
0
        private void LoadData()
        {
            string     sql = (string)this.ViewState["SqlString"];
            QueryAgent qa  = new QueryAgent();
            DataSet    ds  = qa.ExecSqlForDataSet(sql);

            qa.Dispose();
            this.dgList.DataSource = ds;
            this.dgList.DataBind();
        }
Exemple #27
0
        private void LoadDataGrid()
        {
            try
            {
                CostBudgetSetStrategyBuilder sb = new CostBudgetSetStrategyBuilder();
                sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.ProjectCode, txtProjectCode.Value));

                switch (this.txtType.Value.ToLower())
                {
                case "notarget":
                    //未做目标费用的
                    sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.NoTarget));
                    break;

                case "nobudget":
                    //未做预算的
                    sb.AddStrategy(new Strategy(CostBudgetSetStrategyName.NoBudget));
                    break;
                }

                //权限
                ArrayList arA = new ArrayList();
                arA.Add(user.UserCode);
                arA.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.CostBudgetSetStrategyName.AccessRange, arA));

                //排序
                string sortsql = BLL.GridSort.GetSortSQL(ViewState);
                if (sortsql == "")
                {
                    //缺省排序
                    sb.AddOrder("CostBudgetSetName", true);
                }

                string sql = sb.BuildQueryViewString();

                if (sortsql != "")
                {
                    //点列标题排序
                    sql = sql + " order by " + sortsql;
                }

                Rms.ORMap.QueryAgent qa = new QueryAgent();
                DataTable            tb = qa.ExecSqlForDataSet(sql).Tables[0];
                qa.Dispose();

                this.dgList.DataSource = tb;
                this.dgList.DataBind();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "加载字典选择列表错误。");
                Response.Write(Rms.Web.JavaScript.Alert(true, "加载字典选择列表错误。"));
            }
        }
Exemple #28
0
        private void LoadUnderWay()
        {
            WBSStrategyBuilder asb = new WBSStrategyBuilder();
            ArrayList          arA = new ArrayList();

            arA.Add("070107");
            arA.Add(user.UserCode);
            asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.AccessRange, arA));
            asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.Status, "1"));
            asb.AddOrder(" PlannedStartDate ", false);
            string     sql = asb.BuildQueryDeskTopString();
            QueryAgent QA  = new QueryAgent();

            QA.SetTopNumber(this.intListUnderwayNum);
            DataSet dsUnderWay = QA.ExecSqlForDataSet(sql);

            QA.Dispose();
            DataTable dt = dsUnderWay.Tables[0];

            dt.Columns.Add("Img", System.Type.GetType("System.String"));
            dt.Columns.Add("StatusName", System.Type.GetType("System.String"));
            dt.Columns.Add("Master", System.Type.GetType("System.String"));
            EntityData entityUser = new EntityData("TaskPerson");

            if (dt.Rows.Count > 0)
            {
                //点更多时,查看第1条所在项目
                this.imgOpenMoreUnderWayTask.Attributes["ProjectCode"] = dt.Rows[0]["ProjectCode"].ToString();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["ImportantLevel"].ToString() == "1")
                    {
                        dt.Rows[i]["Img"] = "<img src=\"images/icon_important.gif\" width=\"17\" height=\"18\">";
                    }
                    dt.Rows[i]["StatusName"] = BLL.ComSource.GetTaskStatusName(dt.Rows[i]["Status"].ToString());
                    entityUser = WBSDAO.GetTaskPersonByWBSCode(dt.Rows[i]["WBSCode"].ToString());
                    string strTUser = "";// 取得当前任务负责人
                    for (int j = 0; j < entityUser.CurrentTable.Rows.Count; j++)
                    {
                        if (entityUser.CurrentTable.Rows[j]["Type"].ToString() == "2") // 负责
                        {
                            strTUser += (strTUser == "") ? "" : ",";
                            strTUser += BLL.SystemRule.GetUserName(entityUser.CurrentTable.Rows[j]["UserCode"].ToString());
                        }
                    }                   //strTUser.Substring(0,strTUser.Length-1)
                    dt.Rows[i]["Master"] = (strTUser.Length > 0) ? strTUser.Substring(0, strTUser.Length - 1) : "";
                }
            }

            this.rpUnderWay.DataSource = dsUnderWay;
            this.rpUnderWay.DataBind();
            dsUnderWay.Dispose();
        }
Exemple #29
0
 private void SetRelationBidding()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'Bidding'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPlan.Select("RecordType = 'Bidding'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPlan.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string    queryString = "select c.FullCode, 'Bidding' as RecordType, 'Bidding_' + b.BiddingCode + '#' + b.BiddingDtlCode as ContractCode, '' as ContractID, a.title + '(' + b.title + ')' as ContractName, b.* from Bidding a , BiddingDtl b left join CBS c on c.CostCode = b.CostCode where a.ProjectCode = '" + this.ProjectCode + "' and b.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and isnull(a.state, 0) = 0 and a.BiddingCode = b.BiddingCode";
             DataTable tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "Bidding", "ContractMoney");
             queryString = "select c.FullCode, 'Bidding' as RecordType, 'Bidding_' + b.BiddingCode + '#' + a.BiddingDtlCode as ContractCode, a.CostCode, convert(varchar(6), p.PlanningPayDate, 112) as PlanYm, sum(isnull(p.Money, 0)) as PlanMoney from BiddingDtl a left join CBS c on c.CostCode = a.CostCode, Bidding b, BiddingDtlPlan p where a.BiddingCode = b.BiddingCode and a.BiddingDtlCode = p.BiddingDtlCode and b.ProjectCode = '" + this.ProjectCode + "' and a.CostBudgetSetCode = '" + this.CostBudgetSetCode + "' and convert(varchar(6), p.PlanningPayDate, 112) between '" + this.StartYm + "' and '" + this.EndYm + "' group by c.FullCode, a.CostCode, 'Bidding_' + b.BiddingCode + '#' + a.BiddingDtlCode, convert(varchar(6), p.PlanningPayDate, 112)";
             tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddPlan(tbSrc, "");
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #30
0
 /// <summary>
 /// 取费用项的操作列表
 /// </summary>
 /// <param name="code"></param>
 /// <returns></returns>
 public DataSet GetCBSOperationEntityData(string code)
 {
     try
     {
         string sql = String.Format("select distinct( accessRange.OperationCode )  from cbs,accessRange where cbs.costCode = '{0}' and substring ( operationCode , 1,2)='04' and substring(FullCode,1,len( dbo.GetCBSFullCode(AccessRange.ResourceCode )))=dbo.GetCBSFullCode(AccessRange.ResourceCode ) and (  (( AccessRangeType=0 and relationCode = '{1}' ) or ( AccessRangeType=1 and relationCode in ( {2} ) ))   )"
                                    , code, this.UserCode, this.BuildStationCodes());
         QueryAgent qa = new QueryAgent();
         DataSet    ds = qa.ExecSqlForDataSet(sql);
         qa.Dispose();
         return(ds);
     }
     catch (Exception ex)
     { throw ex; }
 }