Exemple #1
0
    protected void BindData()
    {
        string Sql = "[dbo].[RightsSetList] " + RightsResID + ",'" + ObjectID.Trim() + "'";

        string[] changePassWord = Common.getChangePassWord();
        DataSet  ds             = Resource.SelectData(Sql, changePassWord[0], changePassWord[1], changePassWord[2]);

        dlRights.DataSource = ds.Tables[0];
        dlRights.DataBind();
        if (ds.Tables.Count > 1)
        {
            dlRights1.DataSource = ds.Tables[1];
            dlRights1.DataBind();

            dlRights2.DataSource = ds.Tables[2];
            dlRights2.DataBind();
            if (ds.Tables[3].Rows.Count > 0)
            {
                IsRowRihgt = true;
            }
        }
        ds = Resource.SelectData("select ChildNum 子表配置号 ,ShowTitle 显示标题 ,MasterKeyWord 主表关键字 ,ChildKeyWord 子表关键字 ,RSResID 主表资源ID ,ChildResId 子表资源ID , ChildOrderNo 子表排序号 from MasterTableAssociation where MasterKeyWord in (select Res_Comments from CMS_RESOURCE where IsNull(SHOW_ENABLE,0)=1 and ID=" + CommonMethod.FilterSql(RightsResID) + ")", changePassWord[0], changePassWord[1], changePassWord[2]);
        repChildRes.DataSource = ds.Tables[0];
        repChildRes.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadScript("");
        UserID = CurrentUser.ID;
        if (CurrentUser.DepartmentName != "系统管理员" && CurrentUser.ID != "sysuser")
        {
            Response.Redirect("../../login.aspx", true);
            return;
        }
        if (Request.QueryString["SearchType"] != null)
        {
            SearchType = Request.QueryString["SearchType"].ToString();
        }
        if (Request.QueryString["NodeID"] != null)
        {
            NodeID = Request.QueryString["NodeID"].ToString();
        }

        WebServices.Services Resource = new WebServices.Services();
        ResID = Resource.GetResourceIDByTableName("SysSettings");


        string strSql = "  select RT_TAB1_RESID ResID,'ListConfig' keyWordValue ,RT_TAB2_RESID ChildResID,Res.NAME ChildResName,(D1.CD_DISPNAME+'='+D2.CD_DISPNAME) 主子表关联字段 FROM [CMS_RELATED_TABLE] R " +
                        " Join CMS_RESOURCE  Res on R.RT_TAB2_RESID=Res.ID" +
                        "  join CMS_TABLE_DEFINE D1 on D1.CD_RESID=R.RT_TAB1_RESID and D1.CD_COLNAME=R.RT_TAB1_COLNAME " +
                        "  join CMS_TABLE_DEFINE D2 on D2.CD_RESID=R.RT_TAB2_RESID and D2.CD_COLNAME=R.RT_TAB2_COLNAME  " +
                        "   where RT_TAB1_RESID=" + ResID + " order by RT_SHOWORDER";

        string[]  changePassWord = Common.getChangePassWord();
        DataTable TableList      = Resource.SelectData(strSql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];

        RepTabList.DataSource = TableList;
        RepTabList.DataBind();
    }
Exemple #3
0
    private string GetDataByWGJKHTS()
    {
        WebServices.Services Resource = new WebServices.Services();
        string    str = "";
        DataTable dt  = new DataTable();

        string Condition = Request["Condition"];
        string Seaxs     = Request["Seaxs"];


        string sql = "select C3_401291000526 客户全称 ,C3_551182758185 分配  from CT401290367151 ";

        sql += " WHERE  isnull(C3_551182775673,'1900-01-01') <dateadd(month,-2,GETDATE()) ";
        sql += " and isnull(C3_551182786094,'1900-01-01') <dateadd(month,-6,GETDATE())  ";
        if (Seaxs != "" && Seaxs != null)
        {
            sql += " and C3_401291000526  like '%" + Seaxs + "%'";
        }
        if (Condition != "")
        {
            sql += Condition;
        }
        sql += " order by C3_551182758185 asc,C3_401291000526 asc";
        string[] changePassWord = Common.getChangePassWord();
        dt = Resource.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
        Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
        timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
        str = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter);

        return(str);
    }
    void BindData()
    {
        string strSql = "select T.*,(Case when IsNull(S.ID,0)=0 then CD_DISPNAME else S.ShowColumnName end) CD_ShowName,(Case when IsNull(S.ID,0)=0 then 0 else 1 end) IsBe from (SELECT [CD_ID],[CD_RESID],[CD_COLNAME],[CD_DISPNAME],[CS_SHOW_ORDER],(case CD_Type when 1 then 'nvarchar' when 2 then 'float' when 3 then 'int' when 4 then 'datetime'  when 5 then 'ntext'  when 6 then 'image'  when 7 then 'money' when 8 then 'datetime' when 9 then 'bit' when 10 then 'ntext'  end) DataType FROM [CMS_TABLE_DEFINE] D join  [CMS_TABLE_SHOW] S on D.CD_COLNAME=S.CS_COLNAME and D.CD_RESID=S.CS_RESID where CD_RESID  in (select (case when IsNull(RES_USE_PARENTSHOW,0)=1 then PID else ID end) from CMS_RESOURCE where id=" + RelatedResID.Trim() + ") and CD_Type<>6) T  left join (select ColumnName,ShowColumnName,ID from ResourceColumn where KeyWord='" + RelatedValue.Trim() + "') S on S.ColumnName=T.CD_DISPNAME  order by CS_SHOW_ORDER ";

        string[]  changePassWord = Common.getChangePassWord();
        DataTable dt             = Resource.SelectData(strSql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];

        dlCol.DataSource = dt;
        dlCol.DataBind();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     UserID            = CurrentUser.ID;
     UserName          = CurrentUser.Name;
     keywordParameters = Request.QueryString["key"];
     if (keywordParameters == "XTTS")
     {
         //待办事宜
         string[]  changePassWord = Common.getChangePassWord();
         DataTable sql            = Resource.SelectData(" select id,FLOWNAME 流程,MAINFIELDVALUE 主题,CREATORNAME 来源,CREATETIME 时间,flowinstid 流程RecID,id 流程ID from VIEW_WF_RECEIVEFILES  WHERE EMPCODE='" + UserID + "' ", changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
         DataView  dv_DBSYtable   = sql.DefaultView;
         dv_DBSYtable.Sort = " 时间 Desc";
         DataTable dt2_DBSYtable = dv_DBSYtable.ToTable();
         RepeaterDBLX.DataSource = dt2_DBSYtable;
         RepeaterDBLX.DataBind();
     }
 }
    void BindData()
    {
        long   ResID  = Resource.GetTopParentID(NodeID);
        string strSql = "select T.*,(Case when IsNull(Col.ID,0)=0 then CD_DISPNAME else Col.ShowColumnName end) CD_ShowName,IsNull(Col.OrderNum,0) OrderNum,(Case when IsNull(Col.ID,0)=0 then 0 else 1 end) IsBe  from(SELECT [CD_ID],[CD_RESID] ,[CD_COLNAME],[CD_DISPNAME],(case CD_Type when 1 then 'nvarchar' when 2 then 'float' when 3 then 'int' when 4 then 'datetime'  when 5 then 'ntext'  when 6 then 'image'  when 7 then 'money' when 8 then 'datetime' when 9 then 'bit' when 10 then 'ntext'  end) DataType,CS_SHOW_ORDER FROM [CMS_TABLE_DEFINE] D join  [CMS_TABLE_SHOW] S on D.CD_COLNAME=S.CS_COLNAME and D.CD_RESID=S.CS_RESID where CD_RESID  in (" + ResID + "))T left join (select R.ID,R.ColumnName,R.ShowColumnName,R.OrderNum from SysSettings S join ResourceColumn R on S.ENKeyWord=R.KeyWord where  S.id=" + RecID + ")Col on Col.ColumnName=T.CD_DISPNAME    order by IsBe desc, OrderNum , CS_SHOW_ORDER;" +
                        " select * from (select KeyWord, SearchCol=stuff((select ','+SearchCol from Sys_CXZJLB t where KeyWord=t.KeyWord and KeyWord in (select  ENKeyWord from dbo.SysSettings where id=" + RecID + ") for xml path('')), 1, 1, '') from Sys_CXZJLB  group by KeyWord) tab ";

        string[]  changePassWord = Common.getChangePassWord();
        DataSet   ds             = Resource.SelectData(strSql, changePassWord[0], changePassWord[1], changePassWord[2]);
        DataTable dt             = ds.Tables[0];

        dlCol.DataSource = dt;
        dlCol.DataBind();
        if (ds.Tables[1].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[1].Rows[0];
            SearchCol = DbField.GetStr(ref dr, "SearchCol");
        }
    }
Exemple #7
0
    public static MasterTableAssociation GetChileMasterTableAssociation(string argFatherKey, string argChileKey, string argTZ, string argMasterTableAssociationID)
    {
        MasterTableAssociation child = null;

        WebServices.Services Resource       = new WebServices.Services();
        string[]             changePassWord = Common.getChangePassWord();
        DataTable            vdt            = Resource.SelectData("select * from MasterTableAssociation  where id = '" + argMasterTableAssociationID + "'", changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];

        if (vdt == null && vdt.Rows.Count == 0)
        {
            return(child);
        }

        DataRow vDr = vdt.Rows[0];

        child = new MasterTableAssociation()
        {
            MID                = vDr["id"].ToString(),
            MasterKeyWord      = vDr["MasterKeyWord"].ToString(),
            ChildKeyWord       = vDr["ChildKeyWord"].ToString(),
            ChildOrderNo       = string.IsNullOrEmpty(vDr["ChildOrderNo"].ToString()) ? 10 : Convert.ToInt32(vDr["ChildOrderNo"].ToString()),
            AllowAdd           = Convert.ToBoolean(vDr["AllowAdd"].ToString() == "1"),
            AllowEdit          = Convert.ToBoolean(vDr["AllowEdit"].ToString() == "1"),
            AllowDel           = Convert.ToBoolean(vDr["AllowDel"].ToString() == "1"),
            AllowExport        = Convert.ToBoolean(vDr["AllowExport"].ToString() == "1"),
            TZType             = vDr["TZType"].ToString(),
            LedgerConditions   = vDr["LedgerConditions"].ToString(),
            LedgerChildKey     = vDr["LedgerChildKey"].ToString(),
            RSResID            = vDr["RSResID"].ToString(),
            ChildResId         = vDr["ChildResId"].ToString(),
            DefaultSort        = vDr["DefaultSort"].ToString(),
            InitialQueryStr    = vDr["InitialQueryStr"].ToString(),
            HasLastOperation   = Convert.ToBoolean(vDr["HasLastOperation"].ToString() == "1"),
            HasFirstOperation  = Convert.ToBoolean(vDr["HasFirstOperation"].ToString() == "1"),
            ViewDepartment     = vDr["ViewDepartment"].ToString(),
            NoViewDepartment   = vDr["NoViewDepartment"].ToString(),
            ViewAccount        = vDr["ViewAccount"].ToString(),
            NoViewAccount      = vDr["NoViewAccount"].ToString(),
            ViewBaseTableResid = vDr["ViewBaseTableResid"].ToString()
        };
        return(child);
    }
Exemple #8
0
    private string GetDataByWGJKHTX()
    {
        WebServices.Services Resource = new WebServices.Services();
        string    str = "";
        DataTable dt  = new DataTable();
        string    sql = "select C3_404495328556 客户全称,C3_423050441017 销售   from CT401290331886  WHERE  C3_404495328556 NOT IN ( ";

        sql += " select C3_480524157728 from CT480524075049 WHERE C3_480524183775 BETWEEN '" + DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd") + "' AND GETDATE()) ";
        if (Request["Seaxs"] != null && Request["Seaxs"].ToString() != "")
        {
            sql += " and C3_423050441017 like '%" + Request["Seaxs"].ToString() + "%'";
        }
        sql += " GROUP BY C3_404495328556 ,C3_423050441017  ORDER BY C3_423050441017 ";
        string[] changePassWord = Common.getChangePassWord();
        dt = Resource.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
        Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
        timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
        str = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter);
        return(str);
    }
Exemple #9
0
    private string GetDataByFDDXM()
    {
        WebServices.Services Resource = new WebServices.Services();
        string    str        = "";
        DataTable dt         = new DataTable();
        string    seaBegDate = Request["seaBegDate"];
        string    seaEndDate = Request["seaEndDate"];

        if (seaBegDate != null && seaBegDate != "" && seaEndDate != null && seaEndDate != "")
        {
            string sql = "SELECT   C3_316013848869 督导, COUNT(C3_285435595640) 累计新开项目, SUM(CASE WHEN ISNULL(C3_285435594890,0)=0 THEN 1 ELSE 0 END) 累计未确认项目,";
            sql += " SUM(CASE WHEN ISNULL(C3_285435594890,0)<>0 AND ISNULL(C3_332437985389,0)=0 THEN 1 ELSE 0 END) 累计已确认未开票项目";
            sql += " from CT285435593984 WHERE C3_285435594453 BETWEEN '" + Convert.ToDateTime(seaBegDate).ToString("yyyy-MM-dd") + "' AND '" + Convert.ToDateTime(seaEndDate).ToString("yyyy-MM-dd") + "' GROUP BY C3_316013848869";
            string[] changePassWord = Common.getChangePassWord();
            dt = Resource.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
            str = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter);
        }
        return(str);
    }
Exemple #10
0
    public void Bind()
    {
        string resID = CommonProperty.PortalResourceID;

        WebServices.ResourceInfo[] ResourceInfo = null;
        WebServices.Services       Resource     = new WebServices.Services();
        string[]  changePassWord = Common.getChangePassWord();
        DataTable dt             = Resource.SelectData("select Count(1) from VIEW_WF_RECEIVEFILES  WHERE EMPCODE='" + oUserInfo.ID + "'", changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];

        if (dt.Rows.Count > 0)
        {
            DBSXNum = dt.Rows[0][0].ToString();
        }
        //获取一级导航菜单列表,如果是管理员则显示所有菜单
        if (CurrentUser.DepartmentName.Trim() == CommonProperty.ManageDepartmentName.Trim())
        {
            ResourceInfo = document.GetNextDirectoryList(resID);
        }
        else
        {
            ResourceInfo = document.GetNextPortalTreeRootByResourceIDAndUserID(oUserInfo.ID, resID);
        }

        if (ResourceInfo != null && ResourceInfo.Length > 0)
        {
            //获取第一个菜单ID
            resourceInfoID = ResourceInfo[0].ID;
            //获取第一个菜单Title
            resourceInfoTitle = ResourceInfo[0].Name;

            this.titleRepeater.DataSource = ResourceInfo;
            titleRepeater.DataBind();
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "alert('该用户还没有分配任务权限,请先找管理员分配权限!');window.location.href='../login.aspx'", true);
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //DataTable dt =
        WebServices.Services services       = new WebServices.Services();
        string[]             changePassWord = Common.getChangePassWord();
        DataTable            dt             = services.SelectData("select * from CMS_EMPLOYEE order by Emp_Name", changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string pass = "";
            try
            {
                pass = NetReusables.CmsEncrypt.DecryptPassword(dt.Rows[i]["EMP_PASS"].ToString());
            }
            catch (Exception)
            {
                pass = NetReusables.Encrypt.Decrypt(dt.Rows[i]["EMP_PASS"].ToString()) + "(已更新)";
            }
            dt.Rows[i]["EMP_PASS"] = pass;
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SelectRecords_Model != null)
        {
            SetValueResID     = SelectRecords_Model.SetValueResID;
            SelectfieldValue  = SelectRecords_Model.SelectfieldValue;
            ResID_Key         = SelectRecords_Model.ResID_Key;
            HasLastOperation  = SelectRecords_Model.HasLastOperation;
            HasFirstOperation = SelectRecords_Model.HasFirstOperation;
            QueryKeyField     = SelectRecords_Model.QueryKeyField;
            UserDefinedSql    = SelectRecords_Model.UserDefinedSql;
            keyWordValue      = SelectRecords_Model.keyWordValue;
            ColumnName        = SelectRecords_Model.ColumnName;
            PageSize          = SelectRecords_Model.PageSize <= 0 ? 1 : SelectRecords_Model.PageSize;
            PageNumber        = SelectRecords_Model.PageNumber <= 0 ? 20 : SelectRecords_Model.PageNumber;;
            SearchType        = SelectRecords_Model.SearchType;
            ControlWidth      = SelectRecords_Model.ControlWidth;
            idField           = SelectRecords_Model.idField;
            textField         = SelectRecords_Model.textField;
            SetValueStr       = SelectRecords_Model.SetValueStr;
            ROW_NUMBER_ORDER  = SelectRecords_Model.ROW_NUMBER_ORDER;
            MustWrite         = SelectRecords_Model.MustWrite;
            IsmultiSelect     = SelectRecords_Model.IsmultiSelect;
        }

        if (string.IsNullOrEmpty(keyWordValue))
        {
            return;
        }


        if (sys != null && !string.IsNullOrEmpty(sys.ShowTitle))
        {
            SetValueResID = sys.ResID;
        }

        string strSql = "SELECT [CD_ID],[CD_RESID] ,[CD_COLNAME] 内部字段名,[CD_DISPNAME] 显示字段名,CS_SHOW_ORDER 排序 FROM [CMS_TABLE_DEFINE] D join  [CMS_TABLE_SHOW] S on D.CD_COLNAME=S.CS_COLNAME and D.CD_RESID=S.CS_RESID where CD_RESID='" + UserDefinedSql + "'";;

        if (UserDefinedSql.ToLower().IndexOf("order by") > 0)
        {
            UserDefinedSql.Substring(0, UserDefinedSql.ToLower().IndexOf("order by"));
        }
        if (strSql.ToLower().IndexOf("where") < 0)
        {
            strSql = strSql + " where 1=2";
        }
        else
        {
            strSql = strSql + " and 1=2";
        }
        string[]  changePassWord = Common.getChangePassWord();
        DataTable dt             = Resource.SelectData(strSql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
        string    gridField      = "";

        for (int i = 0; i < dt.Columns.Count; i++)
        {
            QueryKeyField += "," + dt.Columns[i].ColumnName;
            gridField     += "{field: '" + dt.Columns[i].ColumnName + "',title:'" + dt.Columns[i].ColumnName + "',width:100, sortable: true ,align:'center'},";
            panelWidth    += 100;
        }
        //if (panelWidth > 300) panelWidth = 300;
        SelectfieldValue = "[[" + gridField.Substring(0, gridField.Length - 1) + "]]";
        if (QueryKeyField.Trim() != "")
        {
            QueryKeyField = QueryKeyField.Substring(1);
        }

        ResID_Key = SetValueResID + "_" + keyWordValue;
        if (ControlWidth == 0)
        {
            ControlWidth = 150;
        }
    }
    protected string GetDataDBList()
    {
        string Condition  = "";//Request["Condition"].ToString();
        string KeyWord    = Request["keyWordValue"].ToString();
        int    PageSize   = Convert.ToInt32(Request["rows"]);
        int    PageNumber = Convert.ToInt32(Request["page"]);
        string SortField  = "";
        string SortBy     = "";

        if (Request["Condition"] != null)
        {
            Condition = Request["Condition"].ToString();
        }
        if (Request["SortField"] != null)
        {
            SortField = Request["SortField"].ToString();
        }
        if (Request["SortBy"] != null)
        {
            SortBy = Request["SortBy"].ToString();
        }
        string sqlData = "";

        if (KeyWord == "DBSY")//代办
        {
            sqlData = "select id,FLOWNAME 流程,MAINFIELDVALUE 主题,CREATORNAME 来源,CREATETIME 时间,flowinstid 流程RecID,id 流程ID from VIEW_WF_RECEIVEFILES  WHERE EMPCODE='" + UserID + "'";
        }
        if (KeyWord == "WFQDRW")//我发起的任务
        {
            sqlData  = "SELECT a.flowinstid id,a.flowname 流程,a.mainfieldvalue 主题,b.empname 来源,a.CREATETIME 时间,a.flowinstid 流程RecID, ";
            sqlData += "b.id 流程ID FROM VIEW_WF_START a  left join  WF_USERTASK b  on a.usertaskid=b.id and a.EMPCODE=b.EMPCODE  WHERE a.EMPCODE='" + UserID + "'";
        }
        if (KeyWord == "WCLDRW")//我处理的任务
        {
            sqlData  = "SELECT a.ID,a.flowname 流程,a.mainfieldvalue 主题,b.empname 来源,a.CREATETIME 时间,a.flowinstid 流程RecID,b.id 流程ID ";
            sqlData += "FROM VIEW_WF_ASSOCIATE   a  left join WF_USERTASK b  on a.taskid=b.taskid and a.EMPCODE=b.EMPCODE  WHERE a.EMPCODE='" + UserID + "' ";
        }

        string sql     = "select * from (" + sqlData + ") as c  where 1=1 " + Condition;
        string OrderBy = "";//order  by

        if (SortField != "" && SortBy != "")
        {
            OrderBy = " " + SortField + " " + SortBy;
        }
        if (OrderBy == "")
        {
            OrderBy = " id desc ";
        }
        WebServices.Services services = new WebServices.Services();
        DataTable            dt       = GetDataListPage(sql, PageNumber, PageSize, OrderBy).Tables[0];//'services.SelectData(sql).Tables[0];

        Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
        // //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
        timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
        string[] changePassWord = Common.getChangePassWord();
        string   dtCount        = services.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0].Rows.Count.ToString();
        string   str            = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter);

        return("{\"total\":" + dtCount + ",\"rows\":" + str + "}");
    }
Exemple #14
0
    private string GetDataByXSMBDCJD()
    {
        WebServices.Services Resource = new WebServices.Services();
        string    str        = "";
        DataTable dt         = new DataTable();
        string    seaBegDate = Request["seaBegDate"];
        string    seaEndDate = Request["seaEndDate"];

        if (seaBegDate != null && seaBegDate != "" && seaEndDate != null && seaEndDate != "")
        {
            string sql = "select C3_403033098027 销售  ,SUM(C3_403033088714 ) 开票金额  from CT401290382901 ";
            sql += " WHERE  C3_403033107511 BETWEEN '" + Convert.ToDateTime(seaBegDate).ToString("yyyy-MM-dd") + "' AND '" + Convert.ToDateTime(seaEndDate).ToString("yyyy-MM-dd") + "' GROUP BY C3_403033098027; ";
            sql += " select  C3_403033098027 销售   ,SUM(C3_401795702260 ) 项目收款额 from  CT401290354058 ";
            sql += " inner join CT401290382901 on C3_403271229261= C3_403193114292  ";
            sql += " WHERE C3_475688833284 BETWEEN '" + Convert.ToDateTime(seaBegDate).ToString("yyyy-MM-dd") + "' AND '" + Convert.ToDateTime(seaEndDate).ToString("yyyy-MM-dd") + "' group by C3_403033098027;  ";
            sql += " select C3_403033098027 销售  ,SUM(C3_403033088714 ) 开票金额  from CT401290382901 ";
            sql += " WHERE  C3_403033107511 BETWEEN '" + Convert.ToDateTime(seaBegDate).AddYears(-1).ToString("yyyy-MM-dd") + "' AND '" + Convert.ToDateTime(seaEndDate).AddYears(-1).ToString("yyyy-MM-dd") + "' GROUP BY C3_403033098027; ";
            sql += " select  C3_403033098027 销售   ,SUM(C3_401795702260 ) 项目收款额 from  CT401290354058 ";
            sql += " inner join CT401290382901 on C3_403271229261= C3_403193114292  ";
            sql += " WHERE C3_475688833284 BETWEEN '" + Convert.ToDateTime(seaBegDate).AddYears(-1).ToString("yyyy-MM-dd") + "' AND '" + Convert.ToDateTime(seaEndDate).AddYears(-1).ToString("yyyy-MM-dd") + "' group by C3_403033098027;  ";
            string[] changePassWord = Common.getChangePassWord();
            DataSet  ds             = Resource.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]);
            dt.Columns.Add("销售");
            dt.Columns.Add("当期开票金额");
            dt.Columns.Add("当期回款金额");
            dt.Columns.Add("上期开票金额");
            dt.Columns.Add("上期回款金额");
            dt.Columns.Add("开票金额同比增长率");
            dt.Columns.Add("回款金额同比增长率");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                dt.Rows.Add();
                dt.Rows[dt.Rows.Count - 1]["销售"]     = ds.Tables[0].Rows[i]["销售"].ToString();
                dt.Rows[dt.Rows.Count - 1]["当期开票金额"] = ds.Tables[0].Rows[i]["开票金额"].ToString();
            }
            for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
            {
                int isHave = 0;
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j]["销售"].ToString() == ds.Tables[1].Rows[i]["销售"].ToString())
                    {
                        dt.Rows[j]["当期回款金额"] = ds.Tables[1].Rows[i]["项目收款额"].ToString();
                        isHave = 1;
                    }
                }
                if (isHave == 0)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["销售"]     = ds.Tables[1].Rows[i]["销售"].ToString();
                    dt.Rows[dt.Rows.Count - 1]["当期回款金额"] = ds.Tables[1].Rows[i]["项目收款额"].ToString();
                }
            }
            for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
            {
                int isHave = 0;
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j]["销售"].ToString() == ds.Tables[2].Rows[i]["销售"].ToString())
                    {
                        dt.Rows[j]["上期开票金额"] = ds.Tables[2].Rows[i]["开票金额"].ToString();
                        isHave = 1;
                    }
                }
                if (isHave == 0)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["销售"]     = ds.Tables[2].Rows[i]["销售"].ToString();
                    dt.Rows[dt.Rows.Count - 1]["上期开票金额"] = ds.Tables[2].Rows[i]["开票金额"].ToString();
                }
            }
            for (int i = 0; i < ds.Tables[3].Rows.Count; i++)
            {
                int isHave = 0;
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    if (dt.Rows[j]["销售"].ToString() == ds.Tables[3].Rows[i]["销售"].ToString())
                    {
                        dt.Rows[j]["上期回款金额"] = ds.Tables[3].Rows[i]["项目收款额"].ToString();
                        isHave = 1;
                    }
                }
                if (isHave == 0)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["销售"]     = ds.Tables[3].Rows[i]["销售"].ToString();
                    dt.Rows[dt.Rows.Count - 1]["上期回款金额"] = ds.Tables[3].Rows[i]["项目收款额"].ToString();
                }
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["上期开票金额"].ToString() != "" && dt.Rows[i]["当期开票金额"].ToString() != "" && dt.Rows[i]["上期开票金额"].ToString() != "0")
                {
                    dt.Rows[i]["开票金额同比增长率"] = Math.Round((Convert.ToDouble(dt.Rows[i]["当期开票金额"].ToString()) / Convert.ToDouble(dt.Rows[i]["上期开票金额"].ToString()) - 1) * 10000) / 100 + "%";
                }
                if (dt.Rows[i]["当期回款金额"].ToString() != "" && dt.Rows[i]["上期回款金额"].ToString() != "" && dt.Rows[i]["上期回款金额"].ToString() != "0")
                {
                    dt.Rows[i]["回款金额同比增长率"] = Math.Round((Convert.ToDouble(dt.Rows[i]["当期回款金额"].ToString()) / Convert.ToDouble(dt.Rows[i]["上期回款金额"].ToString()) - 1) * 10000) / 100 + "%";
                }
            }
            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd";
            str = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter);
        }
        return(str);
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        RedirectVerify();
        WebServices.Services Resource = new WebServices.Services();
        string UserID = CurrentUser.ID;
        string ucode  = CurrentUser.Password;
        //读取web.config文件,得到Post提交地址
        //string BPMPostUrl = System.Configuration.ConfigurationManager.AppSettings["BPMPostUrl"].ToString();

        ////读取web.config文件,得到Process地址
        //string BPMProcessUrl = System.Configuration.ConfigurationManager.AppSettings["BPMProcessUrl"].ToString();
        ////读取web.config文件,得到Read地址
        //string BPMReadUrl = System.Configuration.ConfigurationManager.AppSettings["BPMReadUrl"].ToString();
        ////读取web.config文件,得到易正流程中心地址
        //string BPMCenter = System.Configuration.ConfigurationManager.AppSettings["BPMCenter"].ToString();
        //读取web.config文件,得到CMS中心地址
        //string cmsweb = System.Configuration.ConfigurationManager.AppSettings["cmsweb"].ToString();
        string type            = "post";
        string WorkFlowWebPath = "";
        string ParentFlowRowID = "";
        string RowID           = "";
        string WorkflowInstId  = "";
        string WorklistItemId  = "";
        string _ParentValue    = "";
        string ParentRowId     = "";
        string Para            = "";

        if (Request["cookiedate"] != null)
        {
            if (!string.IsNullOrEmpty(Request["cookiedate"].ToString()))
            {
                _ParentValue = "&ParentValue=" + Request["cookiedate"].ToString();
            }
        }

        if (Request["Type"] != null)
        {
            type = Request["Type"].ToString().ToLower();
        }

        if (Request["Para"] != null)
        {
            Para = Request.QueryString["Para"];
        }

        if (Request.QueryString["ParentFlowRowID"] != null)
        {
            ParentFlowRowID = Request.QueryString["ParentFlowRowID"].ToString().ToLower();
        }
        if (Request.QueryString["RowID"] != null)
        {
            RowID = Request.QueryString["RowID"].ToString().ToLower();
        }
        if (Request.QueryString["WorklistItemId"] != null)
        {
            WorklistItemId = Request.QueryString["WorklistItemId"].ToString().ToLower();//483624242700
        }
        if (Request.QueryString["WorkflowInstId"] != null)
        {
            WorkflowInstId = Request.QueryString["WorkflowInstId"].ToString().ToLower();//483624240010
        }
        if (Request["RecID"] != null)
        {
            ParentRowId = Request["RecID"].ToString().Trim();
        }
        if (type == "create")
        {
            WorkFlowWebPath = "/webflow/process/director.aspx?action=" + type + "&WorkflowId=" + ParentFlowRowID + _ParentValue + "&ParentRowId=" + RowID + "&Para=" + Para;
        }
        else if (type == "transtract")
        {
            WorkFlowWebPath = "/webflow/process/director.aspx?action=" + type + "&WorkflowInstId=" + WorkflowInstId + "&WorklistItemId=" + WorklistItemId;
        }
        else if (type == "xmxxck")
        {
            if (ParentRowId != null || ParentRowId != "")
            {
                string    sql            = "select top 1 wf.id WorkflowInstId from WF_INSTANCE WF left join ct482433275742 ct ON WF.RecordID=ct.id WHERE ParentRowId='" + ParentRowId + "'";
                string[]  changePassWord = Common.getChangePassWord();
                DataTable dt             = Resource.SelectData(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    WorkflowInstId = dt.Rows[0]["WorkflowInstId"].ToString();
                }
            }
            if (WorkflowInstId != null)
            {
                string    SQLS           = " select top 1 b.id WorklistItemId  from WF_TASK a  left join WF_USERTASK b on a.nodeid=b.nodeid and a.id=b.taskid  where a.WF_INSTANCE_ID='" + WorkflowInstId + "' and a.TASKSTATUS='0' order by b.createtime desc";
                string[]  changePassWord = Common.getChangePassWord();
                DataTable TABLES         = Resource.SelectData(SQLS, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
                if (TABLES.Rows.Count > 0)
                {
                    WorklistItemId = TABLES.Rows[0]["WorklistItemId"].ToString();
                }
            }
            WorkFlowWebPath = "/webflow/process/director.aspx?action=transtract&WorkflowInstId=" + WorkflowInstId + "&WorklistItemId=" + WorklistItemId;
        }
        else if (type.ToLower() == "form")
        {
            string[]  changePassWord = Common.getChangePassWord();
            DataTable dt             = Resource.SelectData(" select top 1 b.id WorklistItemId  from WF_TASK a  left join WF_USERTASK b on a.nodeid=b.nodeid and a.id=b.taskid  where  wf_instance_id='" + WorkflowInstId + "' order by b.createtime desc", changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0];
            if (dt.Rows.Count > 0)
            {
                WorklistItemId  = dt.Rows[0]["WorklistItemId"].ToString();
                WorkFlowWebPath = "/webflow/process/director.aspx?action=transtract&WorkflowInstId=" + WorkflowInstId + "&WorklistItemId=" + WorklistItemId + "&ParentRowId=" + RowID;
            }
        }
        else if (type.ToLower() == "wfqdrw")
        {
            WorkFlowWebPath = "/webflow/process/director.aspx?action=view&WorklistItemId=" + WorklistItemId;
        }
        else if (type.ToLower() == "bxsq")
        {
            WorkFlowWebPath = "/webflow/ExtensionForms/报销申请/index.aspx?action=create&WorkflowId=193841883015";
        }
        else if (type.ToLower() == "qksq")
        {
            WorkFlowWebPath = "/webflow/ExtensionForms/请款申请/index.aspx?action=create&WorkflowId=194376055201";
        }
        else
        {
            WorkFlowWebPath = "/webflow/process/director.aspx?action=" + type + "&WorkflowInstId=" + WorkflowInstId + "&WorklistItemId=" + WorklistItemId + "&ParentRowId=" + RowID;
        }

        Response.Redirect("workflow_directservice.aspx?strURL=" + Server.UrlEncode(WorkFlowWebPath));
    }