public override void ApprovalBusiness(DataRow summaryRow) { summaryRow[BusinessCommonFields.AppDate] = DateTime.Now; summaryRow[BusinessCommonFields.AppUser] = Loginer.CurrentUser.Account; summaryRow[BusinessCommonFields.FlagApp] = "Y"; string key = ConvertEx.ToString(summaryRow[tb_IO.IONO]); _Bridge.ApprovalBusiness(key, "Y", Loginer.CurrentUser.Account, DateTime.Now); }
/// <summary> /// 检查业务主表的当前记录是否已审核 /// </summary> /// <param name="summaryRow">业务主表的当前记录</param> /// <returns></returns> public virtual bool IsApproved(DataRow summaryRow) { if (summaryRow == null) { return(false); } return((ConvertEx.ToString(summaryRow[BusinessCommonFields.FlagApp]).ToUpper() == "Y") && (ConvertEx.ToString(summaryRow[BusinessCommonFields.AppUser]).ToUpper() != "")); }
/// <summary> /// Joins the elements of an array together as a string using the given separator. /// </summary> /// <param name="arr"></param> /// <param name="separator"></param> /// <returns></returns> public static string Join(this Array arr, string separator) { var vals = new List <string>(); foreach (var val in arr) { vals.Add(ConvertEx.ToString(val)); } return(string.Join(separator, vals.ToArray())); }
protected override void key_Validated(object sender, EventArgs e) { CurrentTextBox = (sender as TextBox); string attribute = ConvertEx.ToString(CurrentTextBox.Tag); SetAttribute(attribute, CurrentTextBox.Text); base.key_Validated(sender, e); }
//移动主表记录自动显示明细记录 private void gvSummary_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if ((_LastSearch != null) && (e.FocusedRowHandle >= 0)) { string GUID32 = ConvertEx.ToString(gvSummary.GetDataRow(e.FocusedRowHandle)["GUID32"]); DataView detail = _LastSearch.Tables[1].DefaultView; detail.RowFilter = "GUID32='" + GUID32 + "'"; gcDetail.DataSource = detail; } }
/// <summary> /// 更新明细记录的总金额 /// </summary> private void UpdateDetailAmount() { decimal price = ConvertEx.ToDecimal(gvDetail.GetDataRow(gvDetail.FocusedRowHandle)[tb_SOs.Price]); decimal qty = ConvertEx.ToDecimal(gvDetail.GetDataRow(gvDetail.FocusedRowHandle)[tb_SOs.Qty]); decimal amt = Math.Round(price * qty, 2, MidpointRounding.ToEven); //四舍五入 gvDetail.SetFocusedRowCellValue(colD_Amount, amt); gvDetail.UpdateCurrentRow(); }
/// <summary> /// 检查数据是否存在 /// </summary> /// <param name="keyValue">主键</param> /// <returns></returns> public virtual bool CheckNoExists(string keyValue) { string sql = string.Format("SELECT COUNT(*) C FROM [{0}] WHERE ISDELETED=0 AND [{1}]=@KEY", _TableName, _CodeName); SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sql); cmd.AddParam("@KEY", SqlDbType.VarChar, keyValue); object o = DataProvider.Instance.ExecuteScalar(_Loginer.DBName, cmd.SqlCommand); return(ConvertEx.ToInt(o) > 0); }
public string GetNumber(string DocNoName) { using (var dbConnection = dbcontext.Database.Connection) { DbParameter[] dbParameter = { new SqlParameter("DocName", DocNoName) }; string sql = "sp_GetNo"; return(ConvertEx.ToString(new DbHelper(dbConnection).ExecuteScalar(CommandType.StoredProcedure, sql, dbParameter))); } }
/// <summary> /// Returns the field value as the specified type. Uses ConvertEx to convert the value to the correct type. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="row"></param> /// <param name="fieldName"></param> /// <param name="dfltVal">The value to return if the value is DBNull</param> /// <returns></returns> public static T GetValue <T>(this IDataReader row, string fieldName, T dfltVal = default(T)) { var i = row.GetOrdinal(fieldName); if (row.IsDBNull(i)) { return(dfltVal); } return(ConvertEx.To <T>(row[i])); }
/// <summary> /// Gets an integer from an attribute or node. /// </summary> /// <param name="node"></param> /// <param name="name"></param> /// <param name="dfltVal"></param> /// <returns></returns> public static int GetInt(this XmlNode node, string name, int dfltVal) { var val = GetString(node, name, null); if (val == null) { return(dfltVal); } return(ConvertEx.ToInteger(val)); }
public void UpdateFileOrderIndex(string fileListID, string OrderIndex) { T_FileList_MDL flMDL = fileListBLL.GetModel(ConvertEx.ToInt(fileListID)); if (flMDL != null) { flMDL.MyOrderIndex = ConvertEx.ToInt(OrderIndex); fileListBLL.Update(flMDL); } }
/// <summary> /// Returns the value of the given parameter. /// </summary> /// <param name="name"></param> /// <param name="dflt"></param> /// <returns></returns> public int?GetInt(string name, int?dflt = null) { var str = GetString(name); if (str.IsEmpty()) { return(dflt); } return(ConvertEx.ToInt(str)); }
public void Should_Convert_IntNullable_To_LongNullable() { int?i = 3; var v1 = ConvertEx.ConvertTo(i, typeof(long?)); var v2 = ConvertEx.Convert <long?>(i); Assert.True(v1 is long l1 && l1 == 3); Assert.True(v2 == 3); }
public bool SingleProjectSubmit(string singleProjectID, string workFlowID) { WorkFlowManage workflowmanage = new WorkFlowManage(); if (workflowmanage.GoNextProjectWorkFlowSataus(ConvertEx.ToInt(singleProjectID), ConvertEx.ToInt(workFlowID))) { return(true); } return(false); }
internal RC getOverflowPage(Pgno ovfl, out MemPage ppPage, out Pgno pPgnoNext) { Pgno next = 0; MemPage pPage = null; ppPage = null; var rc = RC.OK; Debug.Assert(MutexEx.Held(this.Mutex)); // Debug.Assert( pPgnoNext != 0); #if !SQLITE_OMIT_AUTOVACUUM // Try to find the next page in the overflow list using the autovacuum pointer-map pages. Guess that the next page in // the overflow list is page number (ovfl+1). If that guess turns out to be wrong, fall back to loading the data of page // number ovfl to determine the next page number. if (this.AutoVacuum) { Pgno pgno = 0; Pgno iGuess = ovfl + 1; PTRMAP eType = 0; while (MemPage.PTRMAP_ISPAGE(this, iGuess) || iGuess == MemPage.PENDING_BYTE_PAGE(this)) { iGuess++; } if (iGuess <= btreePagecount()) { rc = ptrmapGet(iGuess, ref eType, ref pgno); if (rc == RC.OK && eType == PTRMAP.OVERFLOW2 && pgno == ovfl) { next = iGuess; rc = RC.DONE; } } } #endif Debug.Assert(next == 0 || rc == RC.DONE); if (rc == RC.OK) { rc = btreeGetPage(ovfl, ref pPage, 0); Debug.Assert(rc == RC.OK || pPage == null); if (rc == RC.OK) { next = ConvertEx.Get4(pPage.Data); } } pPgnoNext = next; if (ppPage != null) { ppPage = pPage; } else { pPage.releasePage(); } return(rc == RC.DONE ? RC.OK : rc); }
/// <summary> /// 初始化功能点树结点 /// </summary> /// <param name="node">功能点所在的树结点</param> /// <param name="menuItem">菜单项</param> private void InitAction(TreeNode node, ToolStripItem menuItem) { if (menuItem.Tag == null || !(menuItem.Tag is MenuItemTag)) { return; //功能菜单没有分配权限,不处理 } MenuItemTag menuItemTag = menuItem.Tag as MenuItemTag; //取菜单的功能权限对象 if (menuItemTag.MenuType != MenuType.DataForm) { return; //只处理数据窗体 } if (menuItemTag.FormAuthorities == 0) { return; //此菜单对应的窗体没有分配权限(功能点) } //取当前菜单权限.SystemAuthentication.UserAuthorities当前用户的权限数据 DataRow auth = GetDataRowByMenuName(SystemAuthentication.UserAuthorities, menuItemTag.ModuleID, menuItem.Name); int userAuths = auth == null ? 0 : ConvertEx.ToInt(auth[TUserRole.Authorities]); //当前用户拥有此菜单的权限 int formAuths = menuItemTag.FormAuthorities; //窗体可用的功能点 bool isAdmin = Loginer.CurrentUser.IsAdmin(); //是否系统管理员 foreach (DataRow row in _AuthorityItem.Rows) //循环所有功能点. { int value = int.Parse(row["AuthorityValue"].ToString()); //功能点权限值 if (value == 0) { continue; //不显示权限值为0的功能点 } //用每个功能点的值与窗体的最大权限进行逻辑"与"运算, 但不能超出当前用户的权限. if (((value & formAuths) == value) && (isAdmin || ((value & userAuths) == value))) { string caption = row["AuthorityName"].ToString(); //取功能点名称 DataRow tagNameRow = GetCustomTagName(menuItem.Name, value); //取功能点的自定义名称资料行 if (tagNameRow != null) { caption = tagNameRow["TagName"].ToString(); //如果有自定义名称,则取定义名 } //构建一个树结点Tag属性的引用对象,Node.Tag=引用对象 ActionNodeTag tag = new ActionNodeTag(value, auth); tag.TagMenuNameRef = menuItem.Name; tag.TagNameTable = _FormTagCustomName; tag.TagNameDataRow = tagNameRow; tag.TagNameOld = caption; //按钮标题 TreeNode actionNode = new TreeNode(caption, 0, 0); //新增树结点 actionNode.Tag = tag; //绑定引用的对象 actionNode.ImageIndex = 2; actionNode.SelectedImageIndex = 2; node.Nodes.Add(actionNode); } } }
public SyncStatus(DataRow row) { Id = (int)row["Id"]; CompanyId = ConvertEx.ToNullable <int>(row["CompanyId"]); SyncTable = (string)row["SyncTable"]; SyncName = (string)row["SyncName"]; DisplayName = (string)row["DisplayName"]; DoSync = (bool)row["DoSync"]; SyncType = ConvertEx.StringToEnum <EnumSyncType>(row["SyncType"]); Status = ConvertEx.StringToEnum <EnumTableSyncStatus>(row["Status"]); }
internal ushort cellSizePtr(byte[] pCell) { int _pIter = this.ChildPtrSize; uint nSize = 0; #if DEBUG // The value returned by this function should always be the same as the (CellInfo.nSize) value found by doing a full parse of the // cell. If SQLITE_DEBUG is defined, an Debug.Assert() at the bottom of this function verifies that this invariant is not violated. */ var debuginfo = new CellInfo(); btreeParseCellPtr(pCell, ref debuginfo); #else var debuginfo = new CellInfo(); #endif if (this.HasIntKey) { if (this.HasData != 0) { _pIter += ConvertEx.GetVariant4(pCell, out nSize); } else { nSize = 0; } // pIter now points at the 64-bit integer key value, a variable length integer. The following block moves pIter to point at the first byte // past the end of the key value. */ var pEnd = _pIter + 9; while (((pCell[_pIter++]) & 0x80) != 0 && _pIter < pEnd) { ; } } else { _pIter += ConvertEx.GetVariant4(pCell, (uint)_pIter, out nSize); } if (nSize > this.MaxLocal) { var minLocal = (int)this.MinLocal; nSize = (ushort)(minLocal + (nSize - minLocal) % (this.Shared.UsableSize - 4)); if (nSize > this.MaxLocal) { nSize = (ushort)minLocal; } nSize += 4; } nSize += (uint)_pIter; // The minimum size of any cell is 4 bytes. if (nSize < 4) { nSize = 4; } Debug.Assert(nSize == debuginfo.nSize); return((ushort)nSize); }
public void UpdateFile(string fileListID, string remark, string mustSubmitFlag) { T_FileList_MDL fileMDL = fileListBLL.GetModel(ConvertEx.ToInt(fileListID)); if (fileMDL != null) { fileMDL.Remark = remark; fileMDL.MustSubmitFlag = ConvertEx.ToBool(mustSubmitFlag); fileListBLL.Update(fileMDL); } }
public string SetCheckBox(object flag) { if (ConvertEx.ToBool(flag)) { return(" checked='checked' "); } else { return(""); } }
public string SetTextDisabled(object isFolder) { if (ConvertEx.ToBool(isFolder)) { return(" disabled='disabled' style='border:solid 0px;' "); } else { return(""); } }
public string SetTextDisabled(object isFolder) { if (ConvertEx.ToBool(isFolder)) { return(" disabled='disabled' "); } else { return(""); } }
public string getShowText(object isFolder, string html) { if (!ConvertEx.ToBool(isFolder)) { return(html); } else { return(""); } }
/// <summary> /// 获取染整订单列表 /// </summary> /// <param name="_"></param> /// <returns></returns> private Negotiator GetProRzOrderModuleList(dynamic _) { try { var watch = CommonHelper.TimerStart(); var recdata = this.GetModule <ReceiveModule <PaginationModule> >(); bool resValidation = this.DataValidation(recdata.userid, recdata.token); if (!resValidation) { return(this.SendData(ResponseType.Fail, "后台无登录信息")); } else { Pagination pagination = new Pagination { page = recdata.data.page, rows = recdata.data.rows, sidx = recdata.data.sidx, sord = recdata.data.sord }; Operator operator_ = this.ReadCache <Operator>(recdata.userid); var data = proRzOrderbll.GetDataListByDt(pagination, recdata.data.queryData, operator_.Account); IList <ProRzOrderEntity> listOrder = new List <ProRzOrderEntity>(); foreach (DataRow row in data.Rows) { ProRzOrderEntity proOrder = new ProRzOrderEntity(); Type t = proOrder.GetType(); PropertyInfo[] pro2 = t.GetProperties(); foreach (PropertyInfo item in pro2) { item.SetValue(proOrder, ConvertEx.ToString(row[item.Name])); } listOrder.Add(proOrder); } DataPageList <IList <ProRzOrderEntity> > dataPageList = new DataPageList <IList <ProRzOrderEntity> > { rows = listOrder, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(this.SendData <DataPageList <IList <ProRzOrderEntity> > >(dataPageList, recdata.userid, recdata.token, ResponseType.Success)); } } catch { return(this.SendData(ResponseType.Fail, "异常")); } }
private void gvEquipment_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { DataRow row = gvEquipment.GetDataRow(e.RowHandle); if (e.Column == colEqpNum || e.Column == colAssetDescription) { string eqtNum = Convert.ToString(row[e.Column.FieldName]); row[colEqpNum.FieldName] = eqtNum; row[colAssetDescription.FieldName] = eqtNum; var equip = Equipment.GetEquipment(eqtNum); row[colEquipmentClass.FieldName] = EquipmentClass.GetEquipmentClass(equip.ClassCode)?.DisplayName ?? ""; Employee employee = (equip.OwnerType == EnumOwnerType.Employee) ? EquipmentAssignment.GetEmployee(equip.EqpNum, _headerRecord.LogDate) : null; row[colEmpNum.FieldName] = (object)employee?.EmpNum ?? DBNull.Value; row[colEmployeeName.FieldName] = employee?.DisplayName ?? ""; RefreshBillRate(row); } else if (e.Column == colLevel1Code) { row[colLevel2Code.FieldName] = DBNull.Value; row[colLevel3Code.FieldName] = DBNull.Value; row[colLevel4Code.FieldName] = DBNull.Value; } else if (e.Column == colLevel2Code) { row[colLevel3Code.FieldName] = DBNull.Value; row[colLevel4Code.FieldName] = DBNull.Value; } else if (e.Column == colLevel3Code) { row[colLevel4Code.FieldName] = DBNull.Value; } else if (e.Column == colBillCycle) { RefreshBillRate(row); } else if (e.Column == colQuantity) { RefreshBillAmount(row); } if (!gvEquipment.IsNewItemRow(e.RowHandle)) { if (new GridColumn[] { colEqpNum, colAssetDescription, colChangeOrder, colLevel1Code, colLevel2Code, colLevel3Code, colLevel4Code, colBillable, colQuantity, colBillCycle }.Contains(e.Column)) { EquipTimeEntry.SqlUpdate((int)row[colId.FieldName], (string)row[colEqpNum.FieldName], ConvertEx.ToNullable <int>(row[colEmpNum.FieldName]), ConvertEx.ToNullable <int>(row[colChangeOrder.FieldName]), ConvertEx.ToNullable <int>(row[colLevel1Code.FieldName]), ConvertEx.ToNullable <int>(row[colLevel2Code.FieldName]), ConvertEx.ToNullable <int>(row[colLevel3Code.FieldName]), ConvertEx.ToNullable <int>(row[colLevel4Code.FieldName]), (bool)row[colBillable.FieldName], ConvertEx.ToNullable <decimal>(row[colQuantity.FieldName]) ?? 0, ConvertEx.CharToEnum <EnumBillCycle>(row[colBillCycle.FieldName]), ConvertEx.ToNullable <decimal>(row[colBillAmount.FieldName])); LemHeader.SqlUpdateSubmitStatus(_headerRecord.Id, EnumSubmitStatus.Open); } } }
public bool IsMatched(object value) { double @double; if (!ConvertEx.TryConvert(value, out @double)) { return(false); } return((IsMinStrictly && Min <= @double || !IsMinStrictly && Min < @double) && (IsMaxStrictly && Max >= @double || !IsMaxStrictly && Max > @double)); }
/// <summary> /// 获取文件所属 PID /// </summary> /// <param name="fromPID"></param> /// <param name="fromFileKey"></param> /// <param name="fromType"></param> /// <returns></returns> private string GetFilePID(string fromPID, string FromRecID, string fromType) { if (ConvertEx.ToInt(fromPID) < 1) //如果外部系统没有传入PID,则根据他们传入的关联文件KEY,在关联表中查找 { return(ConvertEx.ToString(fileBLL.GetPID(FromRecID, fromType))); } else //如果外部系统传入PID,则用他们传入的 { return(fromPID); } }
/// <summary> /// 获取窗体的可用权限值 /// </summary> /// <param name="account">登录帐号</param> /// <param name="moduleID">模块编号</param> /// <param name="menuName">菜单名称</param> /// <returns></returns> public int GetFormAuthority(string account, int moduleID, string menuName) { SqlProcedure sp = SqlBuilder.BuildSqlProcedure("p_sys_GetFormAuthority"); sp.AddParam("@account", SqlDbType.VarChar, account); sp.AddParam("@moduleID", SqlDbType.Int, moduleID); sp.AddParam("@menuName", SqlDbType.VarChar, menuName); object o = DataProvider.Instance.ExecuteScalar(_Loginer.DBName, sp.SqlCommand); return(ConvertEx.ToInt(o)); }
private static void pager_write_changecounter(PgHdr pPg) { // Increment the value just read and write it back to byte 24. uint change_counter = ConvertEx.Get4(pPg.Pager.dbFileVers, 0) + 1; ConvertEx.Put4(pPg.Data, 24, change_counter); // Also store the SQLite version number in bytes 96..99 and in bytes 92..95 store the change counter for which the version number // is valid. ConvertEx.Put4(pPg.Data, 92, change_counter); ConvertEx.Put4(pPg.Data, 96, SysEx.SQLITE_VERSION_NUMBER); }
private void GetImageHTML(DataTable tb) { StringBuilder strBuilder = new StringBuilder(); if (tb != null) { string cssName = string.Empty; for (var i = 0; i < tb.Rows.Count; i++) { if (i == 0) { cssName = "liSelected"; } else { cssName = string.Empty; } string rootPath = ConvertEx.ToString(tb.Rows[i]["RootPath"]); //照片路径 string fileName = ConvertEx.ToString(tb.Rows[i]["wjbt"]); //文件名称 string LastPath = rootPath.Substring(0, rootPath.Length - 1); LastPath = LastPath.Substring(LastPath.IndexOf('\\') + 1); string imgURL = string.Concat("http://", Request.ServerVariables["HTTP_HOST"], "/", LastPath, "/", fileName); ltImagBig.Text += "<li class=\"" + cssName + "\">"; ltImagBig.Text += " <span class=\"sPic\">"; ltImagBig.Text += " <i class=\"iBigPic\">"; ltImagBig.Text += " <img alt=\"大图\" width=\"570px\" height=\"440px\" src=\"" + imgURL + "\"></a></i>"; ltImagBig.Text += " </span>"; ltImagBig.Text += " <span class=\"sSideBox\">"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">文件题名:</td><td>" + ConvertEx.ToString(tb.Rows[i]["title"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">拍摄地点:</td><td>" + ConvertEx.ToString(tb.Rows[i]["psdd"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">拍摄者:</td><td>" + ConvertEx.ToString(tb.Rows[i]["psz"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">拍摄时间:</td><td>" + ((tb.Rows[i]["pssj"] == DBNull.Value) ? "" : ConvertEx.ToDate(tb.Rows[i]["pssj"]).ToString("yyyy-MM-dd")) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">色别:</td><td>" + ConvertEx.ToString(tb.Rows[i]["sb"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">分别率:</td><td>" + ConvertEx.ToString(tb.Rows[i]["fbl"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">相机品牌:</td><td>" + ConvertEx.ToString(tb.Rows[i]["xjpp"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">相机型号:</td><td>" + ConvertEx.ToString(tb.Rows[i]["xjxh"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sIntro\"><table><tr><td class=\"td1\">附注:</td><td>" + ConvertEx.ToString(tb.Rows[i]["bz"]) + "</td></tr></table></span>"; ltImagBig.Text += " <span class=\"sMore\"><a href=\"" + imgURL + "\" target=\"_blank\">查看原图>></a></span>"; ltImagBig.Text += " </span>"; ltImagBig.Text += " </li>"; ltImageSmall.Text += "<li class=\"" + cssName + "\">"; ltImageSmall.Text += " <span class=\"sPic\">"; ltImageSmall.Text += " <img alt=\"" + ConvertEx.ToString(tb.Rows[i]["title"]) + "\" src=\"" + imgURL + "\" width=\"135\" height=\"100\"></span>"; ltImageSmall.Text += " <span class=\"sTitle\">" + ConvertEx.ToString(tb.Rows[i]["title"]) + "</span>"; ltImageSmall.Text += "</li>"; } } }