/// <summary>
        /// 根据Faid查询到一条BGFixAssetPurchase记录
        /// </summary>
        /// <param name="faid">FAID</param>
        /// <returns>BGFixAssetPurchase</returns>
        public static BG_FixAssetPurchase GetFAPByFaid(int faid)
        {
            BG_FixAssetPurchase fap = new BG_FixAssetPurchase();
            string sqlStr           = "select * from BG_FixAssetPurchase where FAID={0}";

            sqlStr = string.Format(sqlStr, faid);
            try
            {
                SqlDataReader dr = DBUnity.ExecuteReader(CommandType.Text, sqlStr, null);
                while (dr.Read())
                {
                    fap.FAID       = common.IntSafeConvert(dr["FAID"]);
                    fap.BudID      = common.IntSafeConvert(dr["BudID"]);
                    fap.FAName     = dr["FAName"].ToString();
                    fap.FAModel    = dr["FAModel"].ToString();
                    fap.FABrand    = dr["FABrand"].ToString();
                    fap.FAPrice    = ParseUtil.ToDecimal(dr["FAPrice"].ToString(), 0);
                    fap.FANum      = common.IntSafeConvert(dr["FANum"]);
                    fap.FAMon      = ParseUtil.ToDecimal(dr["FAMon"].ToString(), 0);
                    fap.FAIsGovPur = dr["FAIsGovPur"].ToString();
                    fap.FAConfig   = dr["FAConfig"].ToString();
                    fap.FARemark   = dr["FARemark"].ToString();
                    fap.FATime     = ParseUtil.ToDateTime(dr["FATime"].ToString(), DateTime.Now);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                fap = null;
                Log.WriteLog(ex.Message, "BGFixAssetPurchaseService--GetFAPByFaid");
            }
            return(fap);
        }
        /// <summary>
        /// 添加固定资产采购情况
        /// </summary>
        /// <param name="bfp"></param>
        /// <returns>bool</returns>
        public static bool AddFix(BG_FixAssetPurchase bfp)
        {
            bool flag = false;

            try
            {
                string         sqlStr = @"insert into BG_FixAssetPurchase(FAName,FAModel,FABrand,FAPrice,FANum,FAMon,FAIsGovPur,FAConfig,FARemark,FATime,BudID) values 
                  (@FAName,@FAModel,@FABrand,@FAPrice,@FANum,@FAMon, @FAIsGovPur,@FAConfig,@FARemark,@FATime,@BudID)";
                SqlParameter[] pars   = new SqlParameter[] {
                    new SqlParameter("@FAName", bfp.FAName),
                    new SqlParameter("@FAModel", bfp.FAModel),
                    new SqlParameter("@FABrand", bfp.FABrand),
                    new SqlParameter("@FAPrice", bfp.FAPrice),
                    new SqlParameter("@FANum", bfp.FANum),
                    new SqlParameter("@FAMon", bfp.FAMon),
                    new SqlParameter("@FAIsGovPur", bfp.FAIsGovPur),
                    new SqlParameter("@FAConfig", bfp.FAConfig),
                    new SqlParameter("@FARemark", bfp.FARemark),
                    new SqlParameter("@BudID", bfp.BudID),
                    new SqlParameter("@FATime", bfp.FATime)
                };
                flag = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, pars) > 0;
            }
            catch (Exception ex)
            {
                flag = false;
                Log.WriteLog(ex.Message, "BGFixAssetPurchaseService--AddFix");
            }
            return(flag);
        }
示例#3
0
        public static BG_FixAssetPurchase AddBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
        {
            string sql =
                "INSERT BG_FixAssetPurchase (BudID, FAName, FAModel, FABrand, FAPrice, FANum, FAMon, FAIsGovPur, FAConfig, FARemark, FATime)" +
                "VALUES (@BudID, @FAName, @FAModel, @FABrand, @FAPrice, @FANum, @FAMon, @FAIsGovPur, @FAConfig, @FARemark, @FATime)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@BudID", bG_FixAssetPurchase.BudID),
                    new SqlParameter("@FAName", bG_FixAssetPurchase.FAName),
                    new SqlParameter("@FAModel", bG_FixAssetPurchase.FAModel),
                    new SqlParameter("@FABrand", bG_FixAssetPurchase.FABrand),
                    new SqlParameter("@FAPrice", bG_FixAssetPurchase.FAPrice),
                    new SqlParameter("@FANum", bG_FixAssetPurchase.FANum),
                    new SqlParameter("@FAMon", bG_FixAssetPurchase.FAMon),
                    new SqlParameter("@FAIsGovPur", bG_FixAssetPurchase.FAIsGovPur),
                    new SqlParameter("@FAConfig", bG_FixAssetPurchase.FAConfig),
                    new SqlParameter("@FARemark", bG_FixAssetPurchase.FARemark),
                    new SqlParameter("@FATime", bG_FixAssetPurchase.FATime)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int    newId = Convert.ToInt32(IdStr);
                return(GetBG_FixAssetPurchaseByFAID(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        /// <summary>
        /// 修改一条固定资产
        /// </summary>
        /// <param name="fa"></param>
        /// <returns>bool</returns>
        public static bool UpdFix(BG_FixAssetPurchase bfp)
        {
            bool falg = false;

            try
            {
                string         sqlStr = @"update BG_FixAssetPurchase set FAMon=@FAMon,FAName=@FAName,FAModel=@FAModel,
        FABrand=@FABrand,FAPrice=@FAPrice,FAIsGovPur=@FAIsGovPur,FARemark=@FARemark,FAConfig=@FAConfig,FANum=@FANum where FAID=@FAID";
                SqlParameter[] pars   = new SqlParameter[] {
                    new SqlParameter("@FAName", bfp.FAName),
                    new SqlParameter("@FAModel", bfp.FAModel),
                    new SqlParameter("@FABrand", bfp.FABrand),
                    new SqlParameter("@FAPrice", bfp.FAPrice),
                    new SqlParameter("@FANum", bfp.FANum),
                    new SqlParameter("@FAMon", bfp.FAMon),
                    new SqlParameter("@FAIsGovPur", bfp.FAIsGovPur),
                    new SqlParameter("@FAConfig", bfp.FAConfig),
                    new SqlParameter("@FARemark", bfp.FARemark),
                    //new SqlParameter("@BudID",bfp.BudID),
                    //new SqlParameter("@FATime",bfp.FATime),
                    new SqlParameter("@FAID", bfp.FAID)
                };
                falg = DBUnity.ExecuteNonQuery(CommandType.Text, sqlStr, pars) > 0;
            }
            catch (Exception ex)
            {
                falg = false;
                Log.WriteLog(ex.Message, "BGFixAssetPurchaseService--UpdFix");
            }
            return(falg);
        }
示例#5
0
        public static bool ModifyBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
        {
            string sql =
                "UPDATE BG_FixAssetPurchase " +
                "SET " +
                "BudID = @BudID, " +
                "FAName = @FAName, " +
                "FAModel = @FAModel, " +
                "FABrand = @FABrand, " +
                "FAPrice = @FAPrice, " +
                "FANum = @FANum, " +
                "FAMon = @FAMon, " +
                "FAIsGovPur = @FAIsGovPur, " +
                "FAConfig = @FAConfig, " +
                "FARemark = @FARemark, " +
                "FATime = @FATime " +
                "WHERE FAID = @FAID";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@FAID", bG_FixAssetPurchase.FAID),
                    new SqlParameter("@BudID", bG_FixAssetPurchase.BudID),
                    new SqlParameter("@FAName", bG_FixAssetPurchase.FAName),
                    new SqlParameter("@FAModel", bG_FixAssetPurchase.FAModel),
                    new SqlParameter("@FABrand", bG_FixAssetPurchase.FABrand),
                    new SqlParameter("@FAPrice", bG_FixAssetPurchase.FAPrice),
                    new SqlParameter("@FANum", bG_FixAssetPurchase.FANum),
                    new SqlParameter("@FAMon", bG_FixAssetPurchase.FAMon),
                    new SqlParameter("@FAIsGovPur", bG_FixAssetPurchase.FAIsGovPur),
                    new SqlParameter("@FAConfig", bG_FixAssetPurchase.FAConfig),
                    new SqlParameter("@FARemark", bG_FixAssetPurchase.FARemark),
                    new SqlParameter("@FATime", bG_FixAssetPurchase.FATime)
                };

                int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para);
                if (t > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
    public void FixBind(int faid)
    {
        BG_FixAssetPurchase fap = BGFixAssetPurchaseManager.GetFAPByFaid(faid);

        if (fap != null)
        {
            txtSort.Text              = fap.FAName;
            txtModel.Text             = fap.FAModel;
            txtBrand.Text             = fap.FABrand;
            txtNum.Text               = fap.FANum.ToString();
            txtTime.Text              = fap.FATime.ToString("yyyy-MM-dd");
            txtPrice.Text             = fap.FAPrice.ToString();
            txtConfig.Text            = fap.FAConfig;
            txtRemark.Text            = fap.FARemark;
            ddlIsGovper.SelectedValue = fap.FAIsGovPur.ToString();
            txtMon.Text               = fap.FAMon.ToString();
            HidBudid.Value            = fap.BudID.ToString();
        }
    }
示例#7
0
        public static BG_FixAssetPurchase GetBG_FixAssetPurchaseByFAID(int fAID)
        {
            string sql = "SELECT * FROM BG_FixAssetPurchase WHERE FAID = @FAID";

            try
            {
                SqlParameter para = new SqlParameter("@FAID", fAID);
                DataTable    dt   = DBUnity.AdapterToTab(sql, para);

                if (dt.Rows.Count > 0)
                {
                    BG_FixAssetPurchase bG_FixAssetPurchase = new BG_FixAssetPurchase();

                    bG_FixAssetPurchase.FAID       = dt.Rows[0]["FAID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["FAID"];
                    bG_FixAssetPurchase.BudID      = dt.Rows[0]["BudID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["BudID"];
                    bG_FixAssetPurchase.FAName     = dt.Rows[0]["FAName"] == DBNull.Value ? "" : (string)dt.Rows[0]["FAName"];
                    bG_FixAssetPurchase.FAModel    = dt.Rows[0]["FAModel"] == DBNull.Value ? "" : (string)dt.Rows[0]["FAModel"];
                    bG_FixAssetPurchase.FABrand    = dt.Rows[0]["FABrand"] == DBNull.Value ? "" : (string)dt.Rows[0]["FABrand"];
                    bG_FixAssetPurchase.FAPrice    = dt.Rows[0]["FAPrice"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["FAPrice"];
                    bG_FixAssetPurchase.FANum      = dt.Rows[0]["FANum"] == DBNull.Value ? 0 : (int)dt.Rows[0]["FANum"];
                    bG_FixAssetPurchase.FAMon      = dt.Rows[0]["FAMon"] == DBNull.Value ? 0 : (decimal)dt.Rows[0]["FAMon"];
                    bG_FixAssetPurchase.FAIsGovPur = dt.Rows[0]["FAIsGovPur"] == DBNull.Value ? "" : (string)dt.Rows[0]["FAIsGovPur"];
                    bG_FixAssetPurchase.FAConfig   = dt.Rows[0]["FAConfig"] == DBNull.Value ? "" : (string)dt.Rows[0]["FAConfig"];
                    bG_FixAssetPurchase.FARemark   = dt.Rows[0]["FARemark"] == DBNull.Value ? "" : (string)dt.Rows[0]["FARemark"];
                    bG_FixAssetPurchase.FATime     = dt.Rows[0]["FATime"] == DBNull.Value ? DateTime.MinValue : (DateTime)dt.Rows[0]["FATime"];

                    return(bG_FixAssetPurchase);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
    protected void btnUpd_Click(object sender, EventArgs e)
    {
        BG_FixAssetPurchase bap = BGFixAssetPurchaseManager.GetFAPByFaid(faid);

        bap.FAName     = txtSort.Text.Trim();
        bap.FAModel    = txtModel.Text.Trim();
        bap.FABrand    = txtBrand.Text.Trim();
        bap.FAPrice    = decimal.Parse(txtPrice.Text.Trim());
        bap.FANum      = int.Parse(txtNum.Text.Trim());
        bap.FAMon      = ParseUtil.ToDecimal(HidTotal.Value, 0);
        bap.FAIsGovPur = ddlIsGovper.SelectedValue;
        bap.FAConfig   = txtConfig.Text.Trim();
        bap.FARemark   = txtRemark.Text.Trim();
        if (BGFixAssetPurchaseManager.UpdFix(bap))
        {
            lblShowResult.Text = "* 修改员工信息成功";
        }
        else
        {
            lblShowResult.Text = "* 操作失败、请重试";
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        BG_FixAssetPurchase bp = new BG_FixAssetPurchase();

        bp.FAName     = txtSort.Text.Trim();
        bp.FAModel    = txtModel.Text.Trim();
        bp.FABrand    = txtBrand.Text.Trim();
        bp.FAPrice    = decimal.Parse(txtPrice.Text.Trim());
        bp.FANum      = int.Parse(txtNum.Text.Trim());
        bp.FAMon      = ParseUtil.ToDecimal(HidTotal.Value, 0);
        bp.FAIsGovPur = ddlIsGovper.SelectedValue;
        bp.FAConfig   = txtConfig.Text.Trim();
        bp.FARemark   = txtRemark.Text.Trim();
        bp.FATime     = DateTime.Parse(txtTime.Text.Trim());
        bp.BudID      = common.IntSafeConvert(HidBudid.Value);
        if (BGFixAssetPurchaseManager.AddFix(bp))
        {
            lbResult.Text = "申请添加成功";
        }
        else
        {
            lbResult.Text = "添加失败,请重新添加";
        }
    }
 public static bool ModifyBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
 {
     return(BG_FixAssetPurchaseService.ModifyBG_FixAssetPurchase(bG_FixAssetPurchase));
 }
 public static bool DeleteBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
 {
     return(BG_FixAssetPurchaseService.DeleteBG_FixAssetPurchase(bG_FixAssetPurchase));
 }
 public static BG_FixAssetPurchase AddBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
 {
     return(BG_FixAssetPurchaseService.AddBG_FixAssetPurchase(bG_FixAssetPurchase));
 }
示例#13
0
 /// <summary>
 /// 修改一条固定资产
 /// </summary>
 /// <param name="fa"></param>
 /// <returns>bool</returns>
 public static bool UpdFix(BG_FixAssetPurchase fa)
 {
     return(BGFixAssetPurchaseService.UpdFix(fa));
 }
示例#14
0
 /// <summary>
 /// 添加固定资产采购情况
 /// </summary>
 /// <param name="bfp"></param>
 /// <returns>bool</returns>
 public static bool AddFix(BG_FixAssetPurchase bfp)
 {
     return(BGFixAssetPurchaseService.AddFix(bfp));
 }
示例#15
0
 public static bool DeleteBG_FixAssetPurchase(BG_FixAssetPurchase bG_FixAssetPurchase)
 {
     return(DeleteBG_FixAssetPurchaseByFAID(bG_FixAssetPurchase.FAID));
 }