Пример #1
0
        protected int AddDetail(AssetsCheck AssetsCheck, string AssetsCheckId, UserInfo sysUser, string viewTitle, string updateType)
        {
            string    sql = @"select * from AssetsCheckDetail where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

            dt.TableName = "AssetsCheckDetail";
            DataRow dr = dt.NewRow();

            dr["AssetsCheckId"]      = AssetsCheckId;
            dr["assetsId"]           = AssetsCheck.AssetsId;
            dr["remark"]             = AssetsCheck.Remark;
            dr["departmentId"]       = AssetsCheck.DepartmentId;
            dr["storeSiteId"]        = AssetsCheck.StoreSiteId;
            dr["actualDepartmentId"] = AssetsCheck.ActualDepartmentId;
            dr["actualStoreSiteId"]  = AssetsCheck.ActualStoreSiteId;
            dr["isFinished"]         = AssetsCheck.IsFinished;
            dr["checkResult"]        = AssetsCheck.CheckResultId;
            dr["checkDate"]          = DataConvert.ToDBObject(AssetsCheck.CheckDate);
            dr["actualCheckDate"]    = DataConvert.ToDBObject(AssetsCheck.ActualCheckDate);
            dr["setBooksId"]         = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            if (DataConvert.ToString(AssetsCheck.CreateId) != "")
            {
                if (updateType == "Reapply")
                {
                    dr["approveState"] = "O";
                }
                else
                {
                    dr["approveState"] = AssetsCheck.ApproveState;
                }
                dr["createId"]   = AssetsCheck.CreateId;
                dr["createTime"] = AssetsCheck.CreateTime;
                Update5Field(dt, sysUser.UserId, viewTitle);
            }
            else
            {
                if (updateType == "ApproveAdd")
                {
                    dr["approveState"] = "O";
                }
                Create5Field(dt, sysUser.UserId, viewTitle);
            }
            return(DbUpdate.Update(dt));
        }
Пример #2
0
        protected int UpdateDetail(AssetsCheck AssetsCheck, string AssetsCheckId, UserInfo sysUser, string viewTitle, string updateType)
        {
            string    sql = string.Format(@"select * from AssetsCheckDetail where AssetsCheckId='{0}' and assetsId='{1}' ", AssetsCheckId, AssetsCheck.AssetsId);
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

            dt.TableName = "AssetsCheckDetail";
            if (dt.Rows.Count > 0)
            {
                dt.Rows[0]["actualDepartmentId"] = AssetsCheck.ActualDepartmentId;
                dt.Rows[0]["actualStoreSiteId"]  = AssetsCheck.ActualStoreSiteId;
                dt.Rows[0]["isFinished"]         = AssetsCheck.IsFinished;
                dt.Rows[0]["checkResult"]        = AssetsCheck.CheckResultId;
                dt.Rows[0]["checkDate"]          = DataConvert.ToDBObject(AssetsCheck.CheckDate);
                dt.Rows[0]["actualCheckDate"]    = DataConvert.ToDBObject(AssetsCheck.ActualCheckDate);
            }
            Update5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }