Beispiel #1
0
        /// <summary>
        /// 向数据库中插入一条新记录。
        /// </summary>
        /// <param name="Table_CAR_SA">table_car_sa对象</param>
        /// <returns>新插入记录的编号</returns>
        public int add(SAInfo sa)
        {
            // Validate input
            if (sa == null)
            {
                return(0);
            }

            return(saDal.Add(sa));
        }
Beispiel #2
0
        /// <summary>
        /// 向数据表Table_CAR_SA更新一条记录。
        /// </summary>
        /// <param name="oTable_CAR_SAInfo">Table_CAR_SA</param>
        /// <returns>影响的行数</returns>
        public int Update(SAInfo sa)
        {
            // Validate input
            if (sa == null)
            {
                return(0);
            }

            return(saDal.Update(sa));
        }
Beispiel #3
0
        ///<sumary>
        ///	通过主键获取数据对象
        ///</sumary>
        /// <param name="rkey">rkey</param>
        ///<returns>Table_CAR_SA对象</returns>
        public SAInfo GetSAInfoByrkey(int rkey)
        {
            #region SQL
            string sql = @"select top 1 
				isNull(rkey,0) as rkey
				,
				isNull(serialno,'') as serialno
				,
				ent_date
				,
				isNull(ent_user,'') as ent_user
				,
				isNull(car_content,'') as car_content
				,
				close_date
                ,
                isnull(status,0) as status
				
			from Table_CAR_SA where rkey='{0}'"            ;

            #endregion
            ///定义返回对象
            SAInfo sa = null;
            #region 数据库操作
            try
            {
                sa = new SAInfo();


                using (DataTable tb = dbHelper.GetDataSet(string.Format(sql, rkey)))
                {
                    foreach (DataRow row in tb.Rows)
                    {
                        sa.RKEY        = int.Parse(row["rkey"].ToString());
                        sa.SERIALNO    = row["serialNo"].ToString();
                        sa.ENT_DATE    = DateTime.Parse(row["ent_date"].ToString());
                        sa.ENT_USER    = row["ent_user"].ToString();
                        sa.CAR_CONTENT = row["car_content"].ToString();
                        sa.CLOSE_DATE  = DateTime.Parse(row["close_date"].ToString());
                        sa.STATUS      = int.Parse(row["status"].ToString());
                    }
                }
            }
            catch (Exception e)
            {
                //Console.WriteLine(e.Message);
            }
            finally
            {
                dbHelper.CloseConnection();
            }
            #endregion

            return(sa);
        }
Beispiel #4
0
        /// <summary>
        /// 向数据库中插入一条新记录。
        /// </summary>
        /// <param name="Table_CAR_SA">table_car_sa对象</param>
        /// <returns>新插入记录的编号</returns>
        public int Add(SAInfo sa)
        {
            #region /// 调用SQL存储过程进行添加
            string sql = "sp_Table_CAR_SA_Add";
            ///存储过程名
            SqlParameter[] parameters =
            {
                new SqlParameter("@returnID",    SqlDbType.Int),
                ///new SqlParameter("@rkey",SqlDbType.Int,4),
                new SqlParameter("@rkey",        SqlDbType.Float),
                new SqlParameter("@serialNo",    SqlDbType.VarChar,    20),
                new SqlParameter("@ent_date",    SqlDbType.DateTime,    8),
                new SqlParameter("@ent_user",    SqlDbType.VarChar,    50),
                new SqlParameter("@car_content", SqlDbType.VarChar,  8000),
                new SqlParameter("@close_date",  SqlDbType.DateTime,    8),
                new SqlParameter("@status",      SqlDbType.Float)
            };

            parameters[0].Value     = 0;
            parameters[0].Direction = ParameterDirection.InputOutput;
            parameters[1].Direction = ParameterDirection.InputOutput;
            parameters[1].Value     = sa.RKEY;
            parameters[2].Value     = sa.SERIALNO;
            parameters[3].Value     = sa.ENT_DATE;
            parameters[4].Value     = sa.ENT_USER;
            parameters[5].Value     = sa.CAR_CONTENT;
            parameters[6].Value     = sa.CLOSE_DATE;
            parameters[7].Value     = sa.STATUS;

            #endregion

            ///
            int result = 0;

            #region 数据库操作
            try
            {
                dbHelper.ExecuteCommandProc(sql, parameters);
                result  = int.Parse(parameters[0].Value.ToString());
                sa.RKEY = int.Parse(parameters[1].Value.ToString());
            }
            catch (Exception e)
            {
                ///message ID
                result = 2;
            }
            finally
            {
                dbHelper.CloseConnection();
            }
            #endregion

            return(result);
        }
Beispiel #5
0
    /// <summary>
    /// 将信息写入库
    /// </summary>
    private int Writedata(int status)
    {
        SABLL  saBLL = new SABLL(CurrentFactoryID);
        SAInfo sa    = new SAInfo();

        if (did == 0)
        {
            sa.RKEY     = 0;
            sa.SERIALNO = saBLL.GetSerialNo();
        }
        else
        {
            sa = saBLL.getSAInfoByrkey(did);
            if (sa.STATUS == 14)
            {
                string temp = sa.SERIALNO;
                sa          = new SAInfo();
                sa.RKEY     = did;
                sa.SERIALNO = temp;
            }
        }
        #region 赋值
        sa.ENT_DATE    = DateTime.Now;
        sa.ENT_USER    = CurrentUser.UserADAcount;
        sa.CAR_CONTENT = CAR_Content.Text;
        sa.STATUS      = status;
        #endregion
        #region 保存
        int a = 0;
        if (did == 0)
        {
            a = saBLL.add(sa);
        }
        else
        {
            a = saBLL.Update(sa);
        }
        if (a != 0)
        {
            return(-1);
        }
        return(int.Parse(sa.RKEY.ToString()));

        #endregion
    }
Beispiel #6
0
    protected void InitPage(SAInfo info)
    {
        try
        {
            SAListBLL saBll = new SAListBLL(CurrentFactoryID);
            tb_SA = saBll.GetDataSet("select * from CAR_Table_SAList where sn_ptr = " + did.ToString());
            GridView3.DataSource = tb_SA;
            GridView3.DataBind();
            Serial_No.Text   = info.SERIALNO;
            CAR_Content.Text = Server.HtmlDecode(info.CAR_CONTENT);

            CAR_Content.AutoConfigure = CuteEditor.AutoConfigure.None;
            CAR_Content.ActiveTab     = CuteEditor.TabType.View;
            CAR_Content.ShowBottomBar = false;
            CAR_Content.ReadOnly      = true;
        }
        catch { }
        #region 文件路径

        string id = System.Web.HttpContext.Current.User.Identity.Name.Replace("FOUNDERPCB\\", "");

        id = id + @"/" + System.DateTime.Now.Date.ToShortDateString();

        //Response.Write("id" + id);


        //建立用户目录
        string path = Server.MapPath(@"uploads/" + id);

        if (!System.IO.Directory.Exists(path))
        {
            System.IO.Directory.CreateDirectory(path);//在指定路径下新建一个文件夹
        }

        CAR_Content.SetSecurityImageGalleryPath(path);
        CAR_Content.SetSecurityImageGalleryPath(path);
        CAR_Content.SetSecurityMediaGalleryPath(path);
        CAR_Content.SetSecurityFlashGalleryPath(path);
        CAR_Content.SetSecurityFilesGalleryPath(path);

        #endregion
    }
Beispiel #7
0
 public override string ToString()
 {
     if (Type == PDFType.Unknown)
     {
         throw new NotImplementedException();
     }
     return(String.Join(
                " - ",
                (Advanced ? "a" : "") + Type.ToString(),
                Names.ToString(),
                LocInfo.ToString(),
                (Type == PDFType.INPC ?
                 VTNumbers.ToString() : (
                     Type == PDFType.SA ?
                     SAInfo.ToString() :
                     SA2Info.ToString()
                     )
                )
                ));
 }
Beispiel #8
0
        ///<sumary>
        /// 删除
        ///</sumary>
        /// <param name="table_car_sa">对象</param>
        ///<returns>返回INT类型号, 0为操作成功, 非0操作失败.</returns>
        public int Delete(SAInfo sa)
        {
            #region
            string sql = "sp_Table_CAR_SA_Delete";
            //=========================
            SqlParameter[] parameters =
            {
                new SqlParameter("@returnID", SqlDbType.Int),
                new SqlParameter("@RKEY",     SqlDbType.Int, 4)
            };

            parameters[0].Value     = 1;
            parameters[0].Direction = ParameterDirection.InputOutput;
            parameters[2].Value     = sa.RKEY;


            //=========================
            #endregion
            ///
            int result = 0;
            #region
            try
            {
                dbHelper.ExecuteCommandProc(sql, parameters);
                result = int.Parse(parameters[0].Value.ToString());
            }
            catch (Exception e)
            {
                result = 2;
            }
            finally
            {
                dbHelper.CloseConnection();
            }
            #endregion

            return(result);
        }
Beispiel #9
0
        ///<sumary>
        ///	通过SQL语句获取数据对象
        ///</sumary>
        /// <param name="sqlWhere">sqlWhere参数条件</param>
        ///<returns>IList<Table_CAR_SA>数据集合</returns>
        public IList <SAInfo> FindBySql(string sqlWhere)
        {
            #region SQL
            string sql = @"select 
				isNull(rkey,0) as rkey
				,
				isNull(serialno,'') as serialno
				,
				ent_date
				,
				isNull(ent_user,'') as ent_user
				,
				isNull(car_content,'') as car_content
				,
				close_date
                ,
                isnull(status,0) as status
				
			from Table_CAR_SA"            ;
            if (sqlWhere.Length > 0)
            {
                sql = sql + " where " + sqlWhere;
            }
            #endregion

            IList <SAInfo> resultList = new List <SAInfo>();

            #region
            try
            {
                using (DataTable tb = dbHelper.GetDataSet(sql))
                {
                    foreach (DataRow row in tb.Rows)
                    {
                        SAInfo sa = new SAInfo();

                        sa.RKEY = int.Parse(row["rkey"].ToString());

                        sa.SERIALNO    = row["serialNo"].ToString();
                        sa.ENT_DATE    = DateTime.Parse(row["ent_date"].ToString());
                        sa.ENT_USER    = row["ent_user"].ToString();
                        sa.CAR_CONTENT = row["car_content"].ToString();
                        sa.CLOSE_DATE  = DateTime.Parse(row["close_date"].ToString());
                        sa.STATUS      = int.Parse(row["status"].ToString());

                        resultList.Add(sa);
                    }
                }
            }
            catch (Exception e)
            {
                // Console.WriteLine(e.Message);
                throw e;
            }
            finally
            {
                dbHelper.CloseConnection();
            }
            #endregion

            return(resultList);
        }