Example #1
0
        public override int Update(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            EntryModel myModel = model as EntryModel;

            if (myModel.IsUpdateAgain == "true")
            {
                Dictionary <string, object> paras1 = new Dictionary <string, object>();
                paras1.Add("fiscalPeriodId", myModel.FiscalPeriodId);
                paras1.Add("fiscalYearId", myModel.FiscalYearId);
                string    sql1 = @"select * from MonthRecord where fiscalYearId=@fiscalYearId and fiscalPeriodId=@fiscalPeriodId ";
                DataTable dt1  = AppMember.DbHelper.GetDataSet(sql1, paras1, DbUpdate.cmd).Tables[0];
                dt1.TableName = "MonthRecord";
                foreach (DataRow dr in dt1.Rows)
                {
                    dr.Delete();
                }
                DbUpdate.Update(dt1);
            }
            string    sql = @"select * from MonthRecord where 1<>1";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];

            dt.TableName = "MonthRecord";
            SetRecord(myModel, dt, sysUser);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            return(1);
        }
Example #2
0
        protected int OverrideRefTable(string tableName, string pkField, string pkValue, UserInfo sysUser, string viewTitle, string approveState, bool isEndNode = false)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add(pkField, pkValue);
            string    sql = @"select * from " + tableName + " where " + pkField + "=@" + pkField;
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dt.TableName = tableName;
            if (approveState != "R")
            {
                if (isEndNode)
                {
                    dt.Rows[0]["approveState"] = "E";
                }
                else
                {
                    dt.Rows[0]["approveState"] = "I";
                }
            }
            else
            {
                dt.Rows[0]["approveState"] = "R";
            }
            Update5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }
        protected int AddDetail(string pkValue, string nodeId, string nodeType, string nodeText, string refField, string barcodeType, string barWidth, int x, int y, int width, int height)
        {
            string    sql = @"select * from BarcodeStyleDetail where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

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

            dr["barcodeStyleId"] = pkValue;
            dr["nodeId"]         = nodeId;
            dr["nodeType"]       = nodeType;
            dr["nodeText"]       = nodeText;
            dr["refField"]       = refField;
            dr["barcodeType"]    = barcodeType;
            if (DataConvert.ToString(barWidth) != "")
            {
                dr["barWidth"] = DataConvert.ToInt32(barWidth);
            }
            dr["x"]      = x;
            dr["y"]      = y;
            dr["width"]  = width;
            dr["height"] = height;
            dt.Rows.Add(dr);
            return(DbUpdate.Update(dt));
        }
Example #4
0
        private void SetChildDepartment(string departmentId, string departmentPath, UserInfo sysUser, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("departmentId", departmentId);
            string    sql = @"select * from AppDepartment where departmentId<>@departmentId and departmentPath like '%'+@departmentId+'%'";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                string   departmentIdCur      = DataConvert.ToString(dr["departmentId"]);
                string   departmentPathCur    = DataConvert.ToString(dr["departmentPath"]);
                string[] departmentPathCurArr = Regex.Split(departmentPathCur, departmentId);
                string   departmentPathNew    = departmentPath + departmentPathCurArr[1];
                dr["departmentPath"] = departmentPathNew;

                string[] dpps = departmentPathNew.Split(',');
                for (int i = dpps.Length - 1; i >= 0; i--)
                {
                    Dictionary <string, object> paras2 = new Dictionary <string, object>();
                    paras2.Add("departmentId", dpps[i]);
                    string    sql2      = @"select departmentId,isCompany,companyId from AppDepartment where departmentId=@departmentId";
                    DataTable dtCompany = AppMember.DbHelper.GetDataSet(sql2, paras2).Tables[0];
                    if (DataConvert.ToString(dtCompany.Rows[0]["isCompany"]) == "Y")
                    {
                        dr["companyId"] = DataConvert.ToString(dtCompany.Rows[0]["departmentId"]);
                        break;
                    }
                }
            }
            dt.TableName = "AppDepartment";
            Update5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
        }
        protected int UpdateAssets(string assetsId, string departmentId, string storeSiteId, string keeper, string usePeople, string sysUser, string viewTitle, string assetsState)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("assetsId", assetsId);
            string    sql      = @"select * from Assets where assetsId=@assetsId";
            DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dtAssets.TableName = "Assets";
            if (DataConvert.ToString(departmentId) != "")
            {
                dtAssets.Rows[0]["departmentId"] = DataConvert.ToDBObject(departmentId);
            }
            if (DataConvert.ToString(storeSiteId) != "")
            {
                dtAssets.Rows[0]["storeSiteId"] = DataConvert.ToDBObject(storeSiteId);
            }
            if (DataConvert.ToString(keeper) != "")
            {
                dtAssets.Rows[0]["keeper"] = DataConvert.ToDBObject(keeper);
            }
            if (DataConvert.ToString(usePeople) != "")
            {
                dtAssets.Rows[0]["usePeople"] = DataConvert.ToDBObject(usePeople);
            }
            if (DataConvert.ToString(assetsState) != "")
            {
                dtAssets.Rows[0]["assetsState"] = assetsState;
            }
            //else
            //    dtAssets.Rows[0]["assetsState"] = "A";
            Update5Field(dtAssets, sysUser, viewTitle);
            return(DbUpdate.Update(dtAssets));
        }
Example #6
0
        protected override int Modified(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle, string formMode)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("AssetsCheckId", pkValue);
            string    sql = @"select * from AssetsCheck where AssetsCheckId=@AssetsCheckId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dt.TableName = "AssetsCheck";
            string     AssetsCheckId = DataConvert.ToString(dt.Rows[0]["AssetsCheckId"]);
            EntryModel myModel       = model as EntryModel;

            dt.Rows[0]["assetsCheckNo"]   = myModel.AssetsCheckNo;
            dt.Rows[0]["assetsCheckName"] = myModel.AssetsCheckName;
            dt.Rows[0]["checkPeople"]     = myModel.CheckPeople;
            string updateType = "Modified";

            if (formMode == "reapply")
            {
                dt.Rows[0]["approveState"] = "O";
                updateType = "Reapply";
            }
            Update5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            if (formMode == "rename")
            {
                return(1);
            }

            //DeleteDetail(pkValue, sysUser, viewTitle);
            List <AssetsCheck> gridData = JsonHelper.JSONStringToList <AssetsCheck>(DataConvert.ToString(myModel.EntryGridString));

            if (gridData.Count < 1)
            {
                throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]);
            }
            foreach (AssetsCheck AssetsCheck in gridData)
            {
                AssetsCheck.CheckDate = DataConvert.ToString(myModel.CheckDate);
                UpdateDetail(AssetsCheck, pkValue, sysUser, viewTitle, updateType);
                if (formMode == "reapply")
                {
                    UpdateChecking(AssetsCheck.AssetsId, "I", sysUser.UserId, viewTitle, AssetsCheck.ActualStoreSiteId);
                }
                if (formMode == "actual")
                {
                    UpdateChecking(AssetsCheck.AssetsId, "N", sysUser.UserId, viewTitle, AssetsCheck.ActualStoreSiteId);
                    if (AssetsCheck.CheckResultId == "L")
                    {
                        UpdateAssetsState(AssetsCheck.AssetsId, "L", sysUser.UserId, viewTitle);
                    }
                }
            }
            if (formMode == "reapply")
            {
                InitFirstApproveTask("AssetsCheck", "AssetsCheckId", AssetsCheckId, viewTitle, formMode, sysUser.UserId);
            }

            return(1);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pdbId1"></param>
        /// <param name="domainInterfaceId1"></param>
        /// <param name="pdbId2"></param>
        /// <param name="domainInterfaceId2"></param>
        /// <param name="identity"></param>
        private void UpdateDomainInterfaceCompIdentity(string pdbId1, int domainInterfaceId1, string pdbId2, int domainInterfaceId2, double identity)
        {
            string updateString = string.Format("Update PfamDomainInterfaceComp Set Identity = {0} Where PdbID1 = '{1}' AND DomainInterfaceID1 = {2} AND " +
                                                " PdbID2 = '{3}' AND DomainInterfaceID2 = {4};", identity, pdbId1, domainInterfaceId1, pdbId2, domainInterfaceId2);

            protcidUpdate.Update(updateString);
        }
Example #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pdbId"></param>
        /// <param name="domainInterfaceId"></param>
        /// <param name="surfaceArea"></param>
        private void UpdateDomainInterfaceSaInDb(string pdbId, int domainInterfaceId, double surfaceArea)
        {
            string updateString = string.Format("Update {0} Set SurfaceArea = {1} Where PdbID = '{2}' AND DomainInterfaceID = {3};",
                                                domainInterfaceTableName, surfaceArea, pdbId, domainInterfaceId);

            dbUpdate.Update(ProtCidSettings.protcidDbConnection, updateString);
        }
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from BarcodeStyle where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

            dt.TableName = "BarcodeStyle";
            DataRow    dr      = dt.NewRow();
            EntryModel myModel = model as EntryModel;

            dr["barcodeStyleName"] = myModel.BarcodeStyleName;
            dr["remark"]           = myModel.Remark;
            dr["isDefaultStyle"]   = myModel.IsDefaultStyle ? "Y" : "N";
            string pk = IdGenerator.GetMaxId(dt.TableName);

            dr["barcodeStyleId"] = pk;
            string barcodeStyleJson = myModel.StyleJson.ToString();
            string sync             = myModel.Sync.ToString();

            SaveDetail(ref barcodeStyleJson, pk, sync);
            dr["stylejson"] = barcodeStyleJson;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            return(1);
        }
Example #10
0
 protected override int Modified(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle, string formMode)
 {
     Dictionary<string, object> paras = new Dictionary<string, object>();
     paras.Add("AssetsSplitId", pkValue);
     string sql = @"select * from AssetsSplit where AssetsSplitId=@AssetsSplitId";
     DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];
     dt.TableName = "AssetsSplit";
     string AssetsSplitId = DataConvert.ToString(dt.Rows[0]["AssetsSplitId"]);
     EntryModel myModel = model as EntryModel;
     dt.Rows[0]["assetsSplitNo"] = myModel.AssetsSplitNo;
     dt.Rows[0]["assetsSplitName"] = myModel.AssetsSplitName;
     string updateType = "Modified";
     if (formMode == "reapply")
     {
         dt.Rows[0]["approveState"] = "O";
         updateType = "Reapply";
     }
     Update5Field(dt, sysUser.UserId, viewTitle);
     DbUpdate.Update(dt);
     DeleteDetail(pkValue,sysUser,viewTitle);
     List<AssetsSplit> gridData = JsonHelper.JSONStringToList<AssetsSplit>(DataConvert.ToString(myModel.EntryGridString));
     foreach (AssetsSplit AssetsSplit in gridData)
     {
         AddDetail(AssetsSplit, pkValue, sysUser, viewTitle, updateType);
     }
     if (formMode == "reapply")
         InitFirstApproveTask("AssetsSplit", "AssetsSplitId", AssetsSplitId, viewTitle, formMode, sysUser.UserId);
     return 1;
 }
        public int UpdateByPrintTools(string labelType, string _LabelId, string _LabelName, string XmlString, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("labelType", labelType);
            paras.Add("LabelId", _LabelId);
            string    sql = @"select * from AppLabelStyle where labelType=@labelType and LabelId=@LabelId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "AppLabelStyle";
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["styleName"] = _LabelName;
                    dr["xmlString"] = XmlString;
                }
                Update5Field(dt, "", viewTitle);
            }
            else
            {
                DataRow dr = dt.NewRow();
                dr["styleId"]   = IdGenerator.GetMaxId(dt.TableName);
                dr["LabelId"]   = _LabelId;
                dr["styleName"] = _LabelName;
                dr["xmlString"] = XmlString;
                dr["labelType"] = labelType;
                dt.Rows.Add(dr);
                Create5Field(dt, "", viewTitle);
            }
            return(DbUpdate.Update(dt));
        }
        protected int AddDetail(AssetsPurchase assetsPurchase, string assetsPurchaseId, UserInfo sysUser, string viewTitle, string updateType)
        {
            string    sql = @"select * from AssetsPurchaseDetail where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql).Tables[0];

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

            //string assetsPurchaseDetailId = IdGenerator.GetMaxId(dt.TableName);
            //dr["assetsPurchaseDetailId"] = assetsPurchaseDetailId;
            dr["assetsPurchaseDetailId"] = assetsPurchase.assetsPurchaseDetailId;
            dr["assetsPurchaseId"]       = assetsPurchaseId;
            dr["assetsName"]             = assetsPurchase.assetsName;
            dr["departmentId"]           = assetsPurchase.departmentId;
            dr["storeSiteId"]            = assetsPurchase.storeSiteId;
            dr["usePeople"]    = assetsPurchase.usePeople;
            dr["keeper"]       = assetsPurchase.keeper;
            dr["assetsValue"]  = DataConvert.ToDBObject(assetsPurchase.assetsValue);
            dr["hasFixed"]     = "N";
            dr["remark"]       = assetsPurchase.remark;
            dr["supplierName"] = assetsPurchase.supplierName;
            dr["purchaseNum"]  = assetsPurchase.purchaseNum;
            dr["setBooksId"]   = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }
        public int UpdateDefaultStyle(string labelType, string _LabelId, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("labelType", labelType);
            string    sql = @"select * from AppLabelStyle where labelType=@labelType ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "AppLabelStyle";
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (DataConvert.ToString(dr["LabelId"]) == _LabelId)
                    {
                        dr["isDefault"] = 1;
                    }
                    else
                    {
                        dr["isDefault"] = 0;
                    }
                }
                Update5Field(dt, "", viewTitle);
            }
            return(DbUpdate.Update(dt));
        }
Example #14
0
 protected int AddDetail(AssetsSplit AssetsSplit, string AssetsSplitId, UserInfo sysUser, string viewTitle, string updateType)
 {
     string sql = @"select * from AssetsSplitDetail where 1<>1 ";
     DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0];
     dt.TableName = "AssetsSplitDetail";
     DataRow dr = dt.NewRow();
     dr["AssetsSplitId"] = AssetsSplitId;
     dr["newAssetsId"] = AssetsSplit.AssetsId;
     dr["assetsNo"] = AssetsSplit.AssetsNo;
     dr["assetsName"] = AssetsSplit.AssetsName;
     dr["assetsValue"] = AssetsSplit.AssetsValue;
     dr["remark"] = AssetsSplit.Remark;
     dr["originalAssetsId"] = AssetsSplit.OriginalAssetsId;
     dr["setBooksId"] = sysUser.MySetBooks.SetBooksId;
     dt.Rows.Add(dr);
     if (DataConvert.ToString(AssetsSplit.CreateId) != "")
     {
         if (updateType == "Reapply")
             dr["approveState"] = "O";
         else
             dr["approveState"] = AssetsSplit.ApproveState;
         dr["createId"] = AssetsSplit.CreateId;
         dr["createTime"] = AssetsSplit.CreateTime;
         Update5Field(dt, sysUser.UserId, viewTitle);
     }
     else
     {
         if (updateType == "ApproveAdd")
             dr["approveState"] = "O";
         Create5Field(dt, sysUser.UserId, viewTitle);
     }
     return DbUpdate.Update(dt);
 }
Example #15
0
        protected int AddNewAssets(AssetsMerge assetsMerge, UserInfo sysUser, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("assetsId", assetsMerge.OriginalAssetsId);
            string    sql      = @"select * from Assets where assetsId=@assetsId ";
            DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dtAssets.TableName = "Assets";
            DataRow drNew = dtAssets.NewRow();

            for (int i = 0; i < dtAssets.Columns.Count; i++)
            {
                drNew[i] = dtAssets.Rows[0][i];
            }
            double assetsValueOri    = DataConvert.ToDouble(dtAssets.Rows[0]["assetsValue"]);
            double assetsNetValueOri = DataConvert.ToDouble(dtAssets.Rows[0]["assetsNetValue"]);

            drNew["assetsId"]       = assetsMerge.AssetsId;
            drNew["assetsNo"]       = assetsMerge.AssetsNo;
            drNew["assetsName"]     = assetsMerge.AssetsName;
            drNew["assetsValue"]    = assetsMerge.AssetsValue;
            drNew["assetsNetValue"] = assetsValueOri == 0 ? 0 : DataConvert.ToDouble(assetsMerge.AssetsValue) * assetsNetValueOri / assetsValueOri;
            drNew["remark"]         = assetsMerge.Remark;
            drNew["assetsState"]    = "A";
            drNew["setBooksId"]     = sysUser.MySetBooks.SetBooksId;
            drNew["addDate"]        = IdGenerator.GetServerDate();
            drNew["smDate"]         = DBNull.Value;
            dtAssets.Rows.Add(drNew);
            Create5Field(dtAssets, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dtAssets));
        }
        protected virtual int UpdateAssetsState(List <string> assetsIdList, string assetsState, string sysUser, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();
            string sql = @"select * from Assets where assetsId in (";

            if (assetsIdList.Count > 2100)
            {
                throw new Exception();
            }
            for (int i = 0; i < assetsIdList.Count; i++)
            {
                sql += "@assetsId" + i.ToString() + ",";
                paras.Add("assetsId" + i.ToString(), assetsIdList[i]);
            }
            sql  = sql.Substring(0, sql.Length - 1);
            sql += ")";
            DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dtAssets.TableName = "Assets";
            DateTime smDate = IdGenerator.GetServerDate();

            foreach (DataRow dr in dtAssets.Rows)
            {
                dr["assetsState"] = assetsState;
                if (assetsState == "S" || assetsState == "M" || assetsState == "L")
                {
                    dr["smDate"] = smDate;
                }
            }
            Update5Field(dtAssets, sysUser, viewTitle);
            return(DbUpdate.Update(dtAssets));
        }
Example #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pdbId"></param>
 /// <param name="interfaceId"></param>
 /// <param name="symmetryJindex"></param>
 private void UpdateSymmetryJaccardIndex(string pdbId, int interfaceId, double symmetryJindex)
 {
     if (symmetryJindex > -1)
     {
         string updateString = string.Format("Update CrystEntryInterfaces Set SymmetryIndex = {0} Where PdbID = '{1}' AND InterfaceID = {2};", symmetryJindex, pdbId, interfaceId);
         protcidUpdate.Update(updateString);
     }
 }
Example #18
0
        protected int UpdateDepreciationTrack(EntryModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql                = @"select FiscalYear.fiscalYearName,FiscalPeriod.fiscalPeriodName ,FiscalPeriod.fiscalYearId, FiscalPeriod.fiscalPeriodId 
                    from FiscalPeriod,FiscalYear
                     where FiscalYear.fiscalYearId=FiscalPeriod.fiscalYearId
                    order by  FiscalYear.fiscalYearName,FiscalPeriod.fiscalPeriodName";
            DataTable dtFiscalPeriod     = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];
            string    fiscalYearIdNext   = null;
            string    fiscalPeriodIdNext = null;

            for (int i = 0; i < dtFiscalPeriod.Rows.Count; i++)
            {
                if (DataConvert.ToString(dtFiscalPeriod.Rows[i]["fiscalYearId"]) == model.FiscalYearId &&
                    DataConvert.ToString(dtFiscalPeriod.Rows[i]["fiscalPeriodId"]) == model.FiscalPeriodId)
                {
                    if ((i + 1) < dtFiscalPeriod.Rows.Count)
                    {
                        fiscalYearIdNext   = DataConvert.ToString(dtFiscalPeriod.Rows[i + 1]["fiscalYearId"]);
                        fiscalPeriodIdNext = DataConvert.ToString(dtFiscalPeriod.Rows[i + 1]["fiscalPeriodId"]);
                        break;
                    }
                }
            }

            Dictionary <string, object> paras = new Dictionary <string, object>();

            sql = @"select * from DepreciationTrack ";
            DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dt.TableName = "DepreciationTrack";
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["fiscalYearId"]       = model.FiscalYearId;
                    dr["fiscalPeriodId"]     = model.FiscalPeriodId;
                    dr["fiscalYearIdNext"]   = fiscalYearIdNext;
                    dr["fiscalPeriodIdNext"] = fiscalPeriodIdNext;
                }
                Update5Field(dt, sysUser == null ? "" : sysUser.UserId, viewTitle);
            }
            else
            {
                DataRow dr = dt.NewRow();
                dr["depreciationTrackId"] = IdGenerator.GetMaxId(dt.TableName);
                dr["fiscalYearId"]        = model.FiscalYearId;
                dr["fiscalPeriodId"]      = model.FiscalPeriodId;
                dr["fiscalYearIdNext"]    = fiscalYearIdNext;
                dr["fiscalPeriodIdNext"]  = fiscalPeriodIdNext;
                dt.Rows.Add(dr);
                Create5Field(dt, sysUser == null ? "" : sysUser.UserId, viewTitle);
            }
            return(DbUpdate.Update(dt));
        }
        protected int Delete(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("styleId", pkValue);
            string    sql = @"select * from AppLabelStyle where styleId=@styleId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "AppLabelStyle";
            dt.Rows[0].Delete();
            return(DbUpdate.Update(dt));
        }
        protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("equityOwnerId", pkValue);
            string    sql = @"select * from EquityOwner where equityOwnerId=@equityOwnerId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "EquityOwner";
            dt.Rows[0].Delete();
            return(DbUpdate.Update(dt));
        }
Example #21
0
        protected int DeleteData(string pkValue)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("testId", pkValue);
            string    sql = @"select * from Test where testId=@testId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "Test";
            dt.Rows[0].Delete();
            return(DbUpdate.Update(dt));
        }
Example #22
0
 protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle)
 {
     Dictionary<string, object> paras = new Dictionary<string, object>();
     paras.Add("AssetsSplitId", pkValue);
     string sql = @"select * from AssetsSplit where AssetsSplitId=@AssetsSplitId";
     DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];
     dt.TableName = "AssetsSplit";
     dt.Rows[0].Delete();
     DbUpdate.Update(dt);
     DeleteDetail(pkValue, sysUser, viewTitle);
     DeleteApproveData("AssetsSplit", pkValue, sysUser.UserId);
     return 1;
 }
        protected virtual int UpdateAssetsState(string assetsId, string assetsState, string sysUser, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("assetsId", assetsId);
            string    sql      = @"select * from Assets where assetsId=@assetsId";
            DataTable dtAssets = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dtAssets.TableName = "Assets";
            dtAssets.Rows[0]["assetsState"] = assetsState;
            Update5Field(dtAssets, sysUser, viewTitle);
            return(DbUpdate.Update(dtAssets));
        }
Example #24
0
        /// <summary>
        /// 更新审批状态,如果为R(退回),将这条工作流的历史审批信息设为无效(isValid='N')
        /// 如果为非R,同一角色下有一人审批过,将其他人的审批信息设为无效(isValid='N')
        /// </summary>
        /// <param name="sysUser"></param>
        /// <param name="viewTitle"></param>
        /// <param name="tableName"></param>
        /// <param name="pkField"></param>
        /// <param name="pkValue"></param>
        /// <param name="approveState"></param>
        /// <param name="approveMind"></param>
        /// <param name="approveNode"></param>
        /// <param name="isEndNode"></param>
        /// <returns></returns>
        public int EditData(UserInfo sysUser, string viewTitle, string tableName, string pkField, string pkValue, string approveState, string approveMind, string approveNode, bool isEndNode = false)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            string sql = "";

            if (approveState == "R")
            {
                paras.Add("tableName", tableName);
                paras.Add("refId", pkValue);
                sql = @"select * from AppApprove where tableName=@tableName and refId=@refId ";
            }
            else
            {
                paras.Add("tableName", tableName);
                paras.Add("refId", pkValue);
                paras.Add("approver", sysUser.UserId);
                sql = @"select * from AppApprove where tableName=@tableName and refId=@refId and approver=@approver and isValid='Y'";
            }
            DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, DbUpdate.cmd).Tables[0];

            dt.TableName = "AppApprove";
            foreach (DataRow dr in dt.Rows)
            {
                if (DataConvert.ToString(dr["approver"]) == sysUser.UserId && DataConvert.ToString(dr["isValid"]) == "Y")
                {
                    dr["approveMind"]  = approveMind;
                    dr["approveTime"]  = DateTime.Now;
                    dr["approveState"] = approveState;
                }
                if (approveState == "R")
                {
                    dr["isValid"] = "N";
                }
                else
                {
                    dr["isValid"] = "Y";
                }
            }
            Update5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            if (approveState != "A")
            {
                if (approveState != "R")
                {
                    UpdateSameNodeOtherApprove(sysUser, viewTitle, tableName, pkField, pkValue, approveState, approveMind, approveNode);
                }
                OverrideRefTable(tableName, pkField, pkValue, sysUser, viewTitle, approveState, isEndNode);
            }
            return(1);
        }
Example #25
0
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from AssetsCheck where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];

            dt.TableName = "AssetsCheck";
            DataRow    dr            = dt.NewRow();
            string     assetsCheckId = IdGenerator.GetMaxId(dt.TableName);
            int        retApprove    = InitFirstApproveTask("AssetsCheck", "AssetsCheckId", assetsCheckId, viewTitle, "", sysUser.UserId);
            EntryModel myModel       = model as EntryModel;

            dr["assetsCheckNo"]   = myModel.AssetsCheckNo;
            dr["assetsCheckName"] = myModel.AssetsCheckName;
            dr["checkPeople"]     = myModel.CheckPeople;
            string updateType = "Add";

            if (retApprove != 0)
            {
                dr["approveState"] = "O";
                updateType         = "ApproveAdd";
            }
            dr["AssetsCheckId"] = assetsCheckId;
            dr["setBooksId"]    = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);

            DataTable gridData = GetEntryGridSource(myModel);

            //List<AssetsCheck> gridData = JsonHelper.JSONStringToList<AssetsCheck>(DataConvert.ToString(myModel.EntryGridString));
            //if (gridData.Count < 1)
            //    throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]);
            if (gridData.Rows.Count < 1)
            {
                throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]);
            }
            foreach (DataRow assetsCheck in gridData.Rows)
            {
                AddDetail(assetsCheck, assetsCheckId, sysUser, viewTitle, updateType, DataConvert.ToString(myModel.CheckDate));
                if (retApprove != 0)
                {
                    UpdateChecking(DataConvert.ToString(assetsCheck["AssetsId"]), "I", sysUser.UserId, viewTitle);
                }
                else
                {
                    UpdateChecking(DataConvert.ToString(assetsCheck["AssetsId"]), "Y", sysUser.UserId, viewTitle);
                }
            }

            return(1);
        }
        protected override int Add(EntryViewModel model, UserInfo sysUser, string viewTitle)
        {
            string    sql = @"select * from AssetsTransfer where 1<>1 ";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, DbUpdate.cmd).Tables[0];

            dt.TableName = "AssetsTransfer";
            DataRow    dr = dt.NewRow();
            string     assetsTransferId = IdGenerator.GetMaxId(dt.TableName);
            int        retApprove       = InitFirstApproveTask("AssetsTransfer", "assetsTransferId", assetsTransferId, viewTitle, "", sysUser.UserId);
            EntryModel myModel          = model as EntryModel;

            myModel.AssetsTransferId = assetsTransferId;
            UpdateUser(myModel, sysUser, viewTitle);
            dr["assetsTransferNo"]   = myModel.AssetsTransferNo;
            dr["assetsTransferName"] = myModel.AssetsTransferName;
            string updateType = "Add";

            if (retApprove != 0)
            {
                dr["approveState"] = "O";
                updateType         = "ApproveAdd";
            }
            dr["assetsTransferId"] = assetsTransferId;
            dr["setBooksId"]       = sysUser.MySetBooks.SetBooksId;
            dt.Rows.Add(dr);
            Create5Field(dt, sysUser.UserId, viewTitle);
            DbUpdate.Update(dt);
            List <AssetsTransfer> gridData = JsonHelper.JSONStringToList <AssetsTransfer>(DataConvert.ToString(myModel.EntryGridString));

            if (gridData.Count < 1)
            {
                throw new Exception(AppMember.AppText["NeedMoreThanOneAssets"]);
            }
            foreach (AssetsTransfer assetsTransfer in gridData)
            {
                AddDetail(assetsTransfer, myModel, assetsTransferId, sysUser, viewTitle, updateType);
                if (retApprove == 0)
                {
                    UpdateAssets(assetsTransfer.AssetsId, DataConvert.ToString(myModel.DepartmentId),
                                 DataConvert.ToString(myModel.StoreSiteId), DataConvert.ToString(myModel.Keeper),
                                 DataConvert.ToString(myModel.UsePeople), sysUser.UserId, viewTitle, assetsTransfer.AssetsStateId);
                }
                else
                {
                    UpdateAssetsState(assetsTransfer.AssetsId, "TI", sysUser.UserId, viewTitle);
                }
            }

            return(1);
        }
Example #27
0
 protected int DeleteDetail(string pkValue, UserInfo sysUser, string viewTitle)
 {
     Dictionary<string, object> paras = new Dictionary<string, object>();
     paras.Add("AssetsSplitId", pkValue);
     string sql = @"select * from AssetsSplitDetail where AssetsSplitId=@AssetsSplitId";
     DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];
     dt.TableName = "AssetsSplitDetail";
     foreach (DataRow dr in dt.Rows)
     {
         UpdateAssetsState(DataConvert.ToString(dr["assetsId"]), "A", sysUser.UserId, viewTitle);
         dr.Delete();
     }
     return DbUpdate.Update(dt);
 }
        protected override int Delete(EntryViewModel model, UserInfo sysUser, string pkValue, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("barcodeStyleId", pkValue);
            string    sql = @"select * from BarcodeStyle where barcodeStyleId=@barcodeStyleId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "BarcodeStyle";
            dt.Rows[0].Delete();
            DeleteDetail(pkValue);
            DbUpdate.Update(dt);
            return(1);
        }
        protected int Modified(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle)
        {
            Dictionary <string, object> paras = new Dictionary <string, object>();

            paras.Add("styleId", pkValue);
            string    sql = @"select * from AppLabelStyle where styleId=@styleId";
            DataTable dt  = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0];

            dt.TableName = "AppLabelStyle";
            //dt.Rows[0]["styleName"] = model.BarcodeStyleName;
            dt.Rows[0]["xmlString"] = model.XmlString;
            Update5Field(dt, sysUser.UserId, viewTitle);
            return(DbUpdate.Update(dt));
        }
Example #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pdbId"></param>
        /// <param name="interfaceId"></param>
        /// <param name="isSymmetry"></param>
        private void UpdateInterfaceIsSymmetry(string pdbId, int interfaceId, bool isSymmetry)
        {
            string updateString = "";

            if (isSymmetry)
            {
                updateString = string.Format("Update CrystEntryInterfaces Set IsSymmetry = '1' Where PdbID = '{0}' AND InterfaceID = {1};", pdbId, interfaceId);
            }
            else
            {
                updateString = string.Format("Update CrystEntryInterfaces Set IsSymmetry = '0' Where PdbID = '{0}' AND InterfaceID= {1};", pdbId, interfaceId);
            }
            dbUpdate.Update(ProtCidSettings.protcidDbConnection, updateString);
        }