Пример #1
0
        /// <summary>
        /// 
        /// 编写日期:2010-4-23
        /// 编写人:GWF
        /// </summary>
        /// <param name="GUID"></param>
        public Detail_RP_FILE GetDetail(string GUID)
        {
            Database db = DatabaseFactory.CreateDatabase(CawConnStr);
            string strSql = (db.DbProviderFactory.ToString() != "System.Data.OracleClient.OracleClientFactory") ?
                "SELECT * FROM RP_FILE WHERE  GUID=@GUID " :
                "SELECT * FROM RP_FILE WHERE  GUID=:GUID ";
            DbCommand cmd = db.GetSqlStringCommand(strSql);

            db.AddInParameter(cmd, "GUID", DbType.String, GUID);

            Detail_RP_FILE myDetail = new Detail_RP_FILE();

            using (IDataReader myReader = db.ExecuteReader(cmd))
            {
                if (myReader.Read())
                {
                    if (!Convert.IsDBNull(myReader["GUID"]))
                    {
                        myDetail.GUID = Convert.ToString(myReader["GUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["CMPGUID"]))
                    {
                        myDetail.CMPGUID = Convert.ToString(myReader["CMPGUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["CMPNAME"]))
                    {
                        myDetail.CMPNAME = Convert.ToString(myReader["CMPNAME"]);
                    }
                    if (!Convert.IsDBNull(myReader["REPORTCODE"]))
                    {
                        myDetail.REPORTCODE = Convert.ToString(myReader["REPORTCODE"]);
                    }
                    if (!Convert.IsDBNull(myReader["UPFILETIME"]))
                    {
                        myDetail.UPFILETIME = Convert.ToDateTime(myReader["UPFILETIME"]);
                    }
                    if (!Convert.IsDBNull(myReader["REPORTTYPE"]))
                    {
                        myDetail.REPORTTYPE = Convert.ToString(myReader["REPORTTYPE"]);
                    }
                    if (!Convert.IsDBNull(myReader["FILEGUID"]))
                    {
                        myDetail.FILEGUID = Convert.ToString(myReader["FILEGUID"]);
                    }
                    if (!Convert.IsDBNull(myReader["YEAR"]))
                    {
                        myDetail.YEAR = Convert.ToInt32(myReader["YEAR"]);
                    }
                    if (!Convert.IsDBNull(myReader["MONTHORQUARTER"]))
                    {
                        myDetail.MONTHORQUARTER = Convert.ToInt32(myReader["MONTHORQUARTER"]);
                    }
                }
            }
            return myDetail;
        }
 private void SaveFile()
 {
     Rp_File p = new Rp_File();
     Detail_RP_FILE file = new Detail_RP_FILE();
     file.GUID = ViewState["ReportGuid"].ToString();
     file.CMPGUID = Convert.ToString(Session["ORGID"]);
     file.CMPNAME = Convert.ToString(Session["CompanyName"]);
     file.REPORTCODE = Convert.ToString(Request.QueryString["TableTag"]);
     file.UPFILETIME = DateTime.Now;
     file.FILEGUID = Convert.ToString(ViewState["ReportGuid"]);
     file.REPORTTYPE = this.ddlDate.SelectedValue;
     //file.YEAR=
     //if (txtTableName.Text.Contains("��"))
     //{
     //    file.YEAR =Convert.ToInt32(txtTableName.Text.Substring(txtTableName.Text.IndexOf("��") - 4, 4));
     //}
     //if (txtTableName.Text.Contains("��"))
     //{
     //    file.YEAR = Convert.ToInt32(txtTableName.Text.Substring(txtTableName.Text.IndexOf("��") - 4, 4));
     //}
     file.YEAR =Convert.ToInt32(this.ddlYear.SelectedValue);
     file.MONTHORQUARTER = 888;
     if (this.ddlDate.SelectedValue == "1")
     {
         file.MONTHORQUARTER = Convert.ToInt32(this.ddlMonth.SelectedValue);
     }
     else if (this.ddlDate.SelectedValue == "2")
     {
         file.MONTHORQUARTER = Convert.ToInt32(this.ddlQuarter.SelectedValue);
     }
     p.Insert(file.GUID, file.CMPGUID, file.CMPNAME, file.REPORTCODE, file.UPFILETIME, file.REPORTTYPE, file.FILEGUID, file.YEAR, file.MONTHORQUARTER);
 }