/// <summary> /// 获取PagePowerSign表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<PagePowerSign>(wheres); }
/// <summary> /// 获取排序字段Sort的最大值 /// </summary> public int GetSortMax() { //查询 var select = new SelectHelper(); return ConvertHelper.Cint0(select.GetMax<Branch>(BranchTable.Sort)); }
/// <summary>排序</summary> /// <param name="nowId"></param> /// <param name="m">"up" or "down"</param> /// <param name="fieldId">id字段名:"ClassId"</param> /// <param name="tableName">表名</param> /// <param name="strWhere">附加Where : " sid=1 "</param> /// <param name="isExistsMoreLv">是否存在多级分类,一级时,请使用false,多级使用true(一级不包括ParentId字段)</param> /// <param name="fieldName">字段名:"SortId"</param> /// <param name="fieldParentId">字段名:"ParentId"</param> public static void AutoSort(int nowId, string m, string fieldId, string tableName, string strWhere = "", bool isExistsMoreLv = false, string fieldName = "SortId", string fieldParentId = "ParentId") { string ss = ""; string iOldId = nowId.ToString(), iOldNo = "", iNewId = "", iNewNo = ""; string[] aRs1, aRs2; var select = new SelectHelper(); if (string.IsNullOrEmpty(strWhere) == false) { ss = " and "; } if (isExistsMoreLv) { var dt = select.ExcuSQLDataTable("select top 1 " + fieldName + "," + fieldParentId + " from " + tableName + " where " + strWhere + " " + ss + " " + fieldId + "=" + iOldId); aRs1 = DataTableHelper.GetColumnsString(dt); if (aRs1.Length > 0) { iOldNo = aRs1[0]; if (string.IsNullOrEmpty(strWhere) == false) { ss = " and " + fieldParentId + "=" + aRs1[1] + " and "; } else { ss = " " + fieldParentId + "=" + aRs1[1] + " and "; } } else { return; } aRs1 = null; } else { iOldNo = select.ExecuteScalar("select top 1 " + fieldName + " from " + tableName + " where " + strWhere + " " + ss + " " + fieldId + "=" + iOldId) + ""; if (iOldNo.Length == 0) { return; } } if (m == "up") {//上移 var dt = select.ExcuSQLDataTable("select top 1 " + fieldId + "," + fieldName + " from " + tableName + " where " + strWhere + " " + ss + " " + fieldName + "<" + iOldNo + " order by " + fieldName + " desc"); aRs2 = DataTableHelper.GetColumnsString(dt); if (aRs2.Length > 0) { iNewId = aRs2[0]; iNewNo = aRs2[1]; } else { return; } } else {//下移 var dt = select.ExcuSQLDataTable("select top 1 " + fieldId + "," + fieldName + " from " + tableName + " where " + strWhere + " " + ss + " " + fieldName + ">" + iOldNo + " order by " + fieldName + " asc"); aRs2 = DataTableHelper.GetColumnsString(dt); if (aRs2.Length > 0) { iNewId = aRs2[0]; iNewNo = aRs2[1]; } else { return; } } var update = new UpdateHelper(); update.Update("update " + tableName + " set " + fieldName + "=" + iNewNo + " where " + strWhere + " " + ss + " " + fieldId + "=" + iOldId); update.Update("update " + tableName + " set " + fieldName + "=" + iOldNo + " where " + strWhere + " " + ss + " " + fieldId + "=" + iNewId); }
/// <summary>删除FrontCoverImg字段存储的对应图片</summary> /// <param name="page">当前页面指针</param> /// <param name="pkValue">主键Id</param> /// <param name="isCache">是否同步更新缓存</param> public void DelFrontCoverImg(Page page, int pkValue, bool isCache = true) { try { string img = ""; //设置条件 var wheres = new List<ConditionHelper.SqlqueryCondition>(); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, InformationTable.Id, Comparison.Equals, pkValue)); //获取图片地址 var select = new SelectHelper(); img = select.GetColumnsValue<Information>(InformationTable.FrontCoverImg, wheres) + ""; //删除图片 UploadFileBll.GetInstence().Upload_OneDelPic(img); //设置更新值 var setValue = new Dictionary<string, object>(); setValue[InformationTable.FrontCoverImg] = ""; //更新 UpdateValue(page, setValue, wheres, "{0}更新了Ad表id为【" + pkValue + "】的记录,将图片Img删除", false); //判断是否启用缓存 if (isCache && CommonBll.IsUseCache()) { //从缓存中获取实体 var model = GetModelForCache(pkValue); if (model != null) { //给获取的实体赋值 SetModelValue(model, InformationTable.FrontCoverImg, ""); //更新缓存中的实体 SetModelForCache(model); } } } catch (Exception e) { //出现异常,保存出错日志信息 CommonBll.WriteLog("", e); } }
/// <summary> /// 获取数据表中的某个值——从数据库中查询 /// </summary> /// <param name="colName">获取的列名</param> /// <param name="wheres">条件</param> /// <returns></returns> public object GetFieldValue(string colName, List <ConditionFun.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetColumnsValue <DUE00>(colName, wheres)); }
/// <summary> /// 获取OnlineUsers表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<OnlineUsers>(wheres); }
/// <summary> /// 获取Advertisement表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<Advertisement>(wheres); }
public ActionResult EditHomePlanDesign(string planID) { ViewData["PlanID"] = planID; IList<HomePlanDesign> designList = BoFactory.GetVersionTrackBo.QueryHomePlanDesignList(planID); List<Application> applicationList = new List<Application>(); BoFactory.GetVersionTrackBo.QueryApplicationList().ForEach(a => { bool exist = false; designList.ForEach(d => { if (d.AppID == a.ID) { exist = true; return; } }); if (!exist) { applicationList.Add(a); } }); SelectHelper ddlAppSelect = new SelectHelper(applicationList.ToDataTable()); string[] formats = BoFactory.GetVersionTrackBo.GetHomePlan(planID).Format.Split(','); ViewData["PageW"] = formats[0]; ViewData["PageH"] = formats[1]; ViewData["AppList"] = ddlAppSelect.GetSelectListItem("DisplayName", "ID", false); ViewData["DesignList"] = BoFactory.GetVersionTrackBo.QueryHomePlanDesignList(planID); return View(); }
/// <summary>比较oldFile 同 newFile,删除旧文件</summary> /// <param name="fieldId">InfoID</param> /// <param name="fieldImg">PicImg</param> /// <param name="tableName">AdInfo</param> /// <param name="id">InfoID</param> /// <param name="newFile">新文件</param> public void Upload_DiffFile(string fieldId, string fieldImg, string tableName, int id, string newFile) { var select = new SelectHelper(); string sOldFile = select.ExecuteScalar("select top 1 " + fieldImg + " from " + tableName + " where Len(" + fieldImg + ")>4 and " + fieldId + "=" + id) + ""; Upload_DiffFile(sOldFile, newFile, true); }
private IQueryable <dynamic> GetDefaultSelectableQuery <T>(IQueryable <T> query) where T : class { var selectColumns = _clauseValueManager.Select; query = query.Take(_profile.DefaultToTake); if (_profile.MaxToTake.HasValue) { query = query.Take(_profile.MaxToTake.Value); } if (_profile.ToListBeforeSelect) { query = query.ToList().AsQueryable(); } return(_profile.UseBaseType ? query.Select(SelectHelper.GetSelector <T, T>(selectColumns, _profile)) : query.Select(SelectHelper.GetSelector <T, object>(selectColumns, _profile))); }
public ActionResult CreateOutApplicationPackage() { List<SelectListItem> unitList = new List<SelectListItem>(); //获取当前用户的本单位 IList<SmartBox.Console.Common.Entities.SMC_Unit> js = GetUnitData(); foreach (SmartBox.Console.Common.Entities.SMC_Unit r in js) { //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); unitList.Add(new SelectListItem { Text = r.Unit_Name, Value = r.Unit_ID }); } ViewData["Application"] = BoFactory.GetVersionTrackBo.QueryApplicationList().ToDataTable(); ViewData["unitData"] = Newtonsoft.Json.JsonConvert.SerializeObject(js); //Dictionary<string, string> unitInfo = BoFactory.GetSMC_UserListBo.GetUnitByUL_UID(CurrentUser.UserUId); //if (unitInfo.Count > 0) //{ // string unitName = "本单位-" + unitInfo.ElementAt(0).Key; // string unitId = unitInfo.ElementAt(0).Value; // unitList.Add(new SelectListItem { Text = unitName, Value = unitId, Selected = true }); //} //if (BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId)) //{ // //加入所有单位列表 // PageView view = new PageView(); // view.PageSize = 15; // JsonFlexiGridData units = BoFactory.GetSMC_UnitBo.QueryUnitByUpperUnitCode(view, ""); // foreach (FlexiGridRow r in units.rows) // { // //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); // unitList.Add(new SelectListItem { Text = r.cell[1], Value = r.id }); // } //} SelectHelper ddlApplicationSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationCategoryList().ToDataTable()); ViewData["AppID"] = ddlApplicationSelect.GetSelectList("DisplayName", "ID", false); SelectHelper chkClientTypeSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryClientTypeList().ToDataTable()); ViewData["ClientType"] = chkClientTypeSelect.GetSelectListItem("DisplayName", "ClientType", false); List<SelectListItem> IsRecom = new List<SelectListItem>(); IsRecom.Add(new SelectListItem { Text = "推荐", Value = "1", Selected = true }); IsRecom.Add(new SelectListItem { Text = "不推荐", Value = "0" }); List<SelectListItem> IsMust = new List<SelectListItem>(); IsMust.Add(new SelectListItem { Text = "必备", Value = "1", Selected = true }); IsMust.Add(new SelectListItem { Text = "不必备", Value = "0" }); ViewData["IsRecom"] = IsRecom; ViewData["IsMust"] = IsMust; ViewData["Unit"] = unitList; return View(); }
public ViewResult UpdatePackage(string id) { //var pe = BoFactory.GetVersionTrackBo.GetPackageExt(id); //if (pe.TableName != "Package4AI") //{ // return RedirectToAction("ModifyPackageExt", new {id=id }); //} ViewData["packageID"] = id; SelectHelper dllAppSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationList().ToDataTable(), "未指定", ""); ViewData["AppCode_"] = dllAppSelect.GetSelectListItem("Name", "ID", true); SelectHelper chkClientTypeSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryClientTypeList().ToDataTable()); ViewData["ClientType"] = chkClientTypeSelect.GetSelectListItem("DisplayName", "ClientType", false); return View(); }
public ActionResult EditWebApplication(string id) { id = Request.QueryString["id"]; List<SelectListItem> unitList = new List<SelectListItem>(); //获取当前用户的本单位 IList<SmartBox.Console.Common.Entities.SMC_Unit> js = GetUnitData(); foreach (SmartBox.Console.Common.Entities.SMC_Unit r in js) { //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); unitList.Add(new SelectListItem { Text = r.Unit_Name, Value = r.Unit_ID }); } ViewData["Application"] = BoFactory.GetVersionTrackBo.QueryApplicationList().ToDataTable(); //Dictionary<string, string> unitInfo = BoFactory.GetSMC_UserListBo.GetUnitByUL_UID(CurrentUser.UserUId); //if (unitInfo.Count > 0) //{ // string unitName = "本单位-" + unitInfo.ElementAt(0).Key; // string unitId = unitInfo.ElementAt(0).Value; // unitList.Add(new SelectListItem { Text = unitName, Value = unitId, Selected = true }); //} //if (BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId)) //{ // //加入所有单位列表 // PageView view = new PageView(); // view.PageSize = 15; // JsonFlexiGridData units = BoFactory.GetSMC_UnitBo.QueryUnitByUpperUnitCode(view, ""); // foreach (FlexiGridRow r in units.rows) // { // //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); // unitList.Add(new SelectListItem { Text = r.cell[1], Value = r.id }); // } //} List<SelectListItem> IsRecom = new List<SelectListItem>(); IsRecom.Add(new SelectListItem { Text = "推荐", Value = "1", Selected = true }); IsRecom.Add(new SelectListItem { Text = "不推荐", Value = "0" }); List<SelectListItem> IsMust = new List<SelectListItem>(); IsMust.Add(new SelectListItem { Text = "必备", Value = "1", Selected = true }); IsMust.Add(new SelectListItem { Text = "不必备", Value = "0" }); WebApplication webApplication; SMC_PackageExt entity = null; if (string.IsNullOrEmpty(id)) { webApplication = new WebApplication(); webApplication.Seq = 1; } else { webApplication = BoFactory.GetVersionTrackBo.GetWebApplication(id); entity = BoFactory.GetAppCenterBO.GetPackage("webapplication", id); string unit = ""; if (webApplication != null) { unit = webApplication.Unit; if (entity.pe_IsTJ == "False") { IsRecom[1].Selected = true; } else { IsRecom[0].Selected = true; } if (entity.pe_IsBB == "False") { IsMust[1].Selected = true; } else { IsMust[0].Selected = true; } } else { if (entity != null && !String.IsNullOrEmpty(entity.pe_UnitCode)) unit = entity.pe_UnitCode; } foreach (SelectListItem item in unitList) { if (item.Value == unit) { item.Selected = true; break; } } } ViewData["pe_IsTJ"] = IsRecom; ViewData["pe_IsBB"] = IsMust; if (entity != null && !String.IsNullOrEmpty(entity.pe_PictureUrl)) { ViewData["IconUrl"] = entity.pe_PictureUrl; } else { ViewData["IconUrl"] = ""; } ViewData["entity"] = entity; if (webApplication != null && string.IsNullOrEmpty(webApplication.ClientType)) { webApplication.ClientType = string.Empty; } SelectHelper ddlApplicationSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationCategoryList().ToDataTable()); SelectHelper chkClientTypeSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryClientTypeList().ToDataTable()); int appId = 0; if (webApplication != null) appId = webApplication.AppID; else { if (entity != null) appId = Convert.ToInt32(entity.pe_CategoryID); } ViewData["AppID"] = ddlApplicationSelect.GetSelectList("DisplayName", "ID", appId, false); if (webApplication == null) { List<string> vals = new List<string>(); if (entity != null && !String.IsNullOrEmpty(entity.pe_ClientType)) vals.Add(entity.pe_ClientType); ViewData["ClientType"] = chkClientTypeSelect.GetSelectListItem("DisplayName", "ClientType", vals, false); } else { ViewData["ClientType"] = chkClientTypeSelect.GetSelectListItem("DisplayName", "ClientType", webApplication.ClientType.Split('|').ToList(), false); } ViewData["Unit"] = unitList; return View(webApplication); }
/// <summary> /// 获取UploadConfig表记录总数 /// </summary> /// <returns>记录总数</returns> public int GetRecordCount() { //判断是否启用缓存 if (CommonBll.IsUseCache()) { //从缓存中获取记录集 var list = GetList(); return list == null ? 0 : list.Count; } else { //从数据库中查询记录集数量 var select = new SelectHelper(); return select.GetRecordCount<UploadConfig>(); } }
/// <summary> /// 获取排序字段Sort的最大值 /// </summary> public int GetSortMax() { //查询 var select = new SelectHelper(); return ConvertHelper.Cint0(select.GetMax<Advertisement>(AdvertisementTable.Sort)); }
/// <summary> /// 获取UploadConfig表记录 /// </summary> /// <param name="norepeat">是否使用去重复</param> /// <param name="top">获取指定数量记录</param> /// <param name="columns">获取指定的列记录</param> /// <param name="pageIndex">当前分页页面索引</param> /// <param name="pageSize">每个页面记录数量</param> /// <param name="wheres">查询条件</param> /// <param name="sorts">排序方式</param> /// <returns>返回DataTable</returns> public DataTable GetDataTable(bool norepeat = false, int top = 0, List<string> columns = null, int pageIndex = 0, int pageSize = 0, List<ConditionHelper.SqlqueryCondition> wheres = null, List<string> sorts = null) { try { //分页查询 var select = new SelectHelper(); return select.SelectDataTable<UploadConfig>(norepeat, top, columns, pageIndex, pageSize, wheres, sorts); } catch (Exception e) { //记录日志 CommonBll.WriteLog("获取UploadConfig表记录时出现异常", e); return null; } }
/// <summary> /// 获取V_Position_Branch表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<V_Position_Branch>(wheres); }
/// <summary> /// 获取V_ORDER01_PRODUCT01表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List <ConditionFun.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetRecordCount <V_ORDER01_PRODUCT01>(wheres)); }
/// <summary> /// Инициализирует карточку по заданным данным. /// </summary> /// <param name="ClassBase">Скрипт карточки.</param> public MarketingFilesCard(ScriptClassBase ClassBase) : base(ClassBase) { try { /* Назначение прав */ NeedAssign = CardScript.CardControl.ActivateFlags.HasFlag(ActivateFlags.New) || CardScript.CardControl.ActivateFlags.HasFlag(ActivateFlags.NewFromTemplate); NeedSynchronize = false; Boolean Open = true; if (!NeedAssign) { if (CardScript.CardControl.ModeId == RefMarketingFilesCard.Modes.OpenFiles || CardScript.CardControl.ModeId.IsEmpty()) { if (MyHelper.OpenFolder(FolderPath).HasValue) { Open = false; CardScript.CardFrame.Close(); } } else if (CardScript.CardControl.ModeId == RefMarketingFilesCard.Modes.OpenCardAndFiles) { MyHelper.OpenFolder(FolderPath); } } if (Open) { /* Получение рабочих объектов */ _Control_Categories = ICardControl.FindPropertyItem <CollectionControlView>(RefMarketingFilesCard.Categories.Alias); _Button_Upload = ICardControl.FindPropertyItem <SimpleButton>(RefMarketingFilesCard.Buttons.Upload); _Edit_Files = ICardControl.FindPropertyItem <TextEdit>(RefMarketingFilesCard.MainInfo.Files); ArchiveTempPath = CardScript.Session.GetArchiveTempPath(); if (ICardControl.ContainsControl(RefMarketingFilesCard.EquipmentSorts.Alias)) { Control_EquipmentSorts = ICardControl.FindPropertyItem <CollectionControlView>(RefMarketingFilesCard.EquipmentSorts.Alias); } if (ICardControl.ContainsControl(RefMarketingFilesCard.EquipmentTypes.Alias)) { Control_EquipmentTypes = ICardControl.FindPropertyItem <CollectionControlView>(RefMarketingFilesCard.EquipmentTypes.Alias); } if (ICardControl.ContainsControl(RefMarketingFilesCard.Manufacturers.Alias)) { Control_Manufacturers = ICardControl.FindPropertyItem <CollectionControlView>(RefMarketingFilesCard.Manufacturers.Alias); } if (!Control_EquipmentSorts.IsNull() && !Control_EquipmentTypes.IsNull()) { Selector_EquipmentTypes = new SelectHelper(Context, SelectionType.BaseUniversalItem, Control_EquipmentTypes.TypeIds[0].NodeId, false, new List <String>() { Dynamic.CardBaseUniversalItem.EquipmentDirectory.ID + "\t" + Dynamic.CardBaseUniversalItem.EquipmentDirectory.Sort }, new List <String>() { Control_EquipmentSorts.SelectedItems.Select(item => item.ObjectId.ToUpper()).Aggregate("\t") }, false); } /* Привязка методов */ if (!IsReadOnly) { CardScript.CardControl.CardClosed -= CardControl_CardClosed; CardScript.CardControl.CardClosed += CardControl_CardClosed; CardScript.CardControl.Saved -= CardControl_Saved; CardScript.CardControl.Saved += CardControl_Saved; CardScript.CardControl.Saving -= CardControl_Saving; CardScript.CardControl.Saving += CardControl_Saving; _Button_Upload.Click -= Button_Upload_Click; _Button_Upload.Click += Button_Upload_Click; _Edit_Files.DoubleClick -= Edit_Files_DoubleClick; _Edit_Files.DoubleClick += Edit_Files_DoubleClick; if (!Control_EquipmentSorts.IsNull() && !Control_EquipmentTypes.IsNull()) { Control_EquipmentSorts.ValueChanged -= Control_EquipmentSorts_ValueChanged; Control_EquipmentSorts.ValueChanged += Control_EquipmentSorts_ValueChanged; Control_EquipmentTypes.CustomChoosingValue -= Control_EquipmentTypes_CustomChoosingValue; Control_EquipmentTypes.CustomChoosingValue += Control_EquipmentTypes_CustomChoosingValue; Control_EquipmentTypes.CustomizeTypeSearchQuery -= Control_EquipmentTypes_CustomizeTypeSearchQuery; Control_EquipmentTypes.CustomizeTypeSearchQuery += Control_EquipmentTypes_CustomizeTypeSearchQuery; } } Customize(); RefreshChanges(); } } catch (Exception Ex) { CallError(Ex); } }
/// <summary> /// 获取DUE00表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List <ConditionFun.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetRecordCount <DUE00>(wheres)); }
/// <summary> /// 获取InformationClass表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<InformationClass>(wheres); }
/// <summary>自动排序</summary> /// <param name="fieldId">id字段名:"Id"</param> /// <param name="tableName">表名:"NewsClass"</param> /// <param name="strWhere">附加Where : " sid=1 "</param> /// <param name="isExistsMoreLv">是否存在多级分类,一级时,请使用false,多级使用true,(一级不包括ParentId字段)</param> /// <param name="pid">父级分类的ParentId</param> /// <param name="fieldName">字段名:"OrderId"</param> /// <param name="fieldParentId">字段名:"ParentId"</param> public static bool AutoSort(string fieldId, string tableName, string strWhere = "", bool isExistsMoreLv = false, int pid = 0, string fieldName = "Sort", string fieldParentId = "ParentId") { try { string sw = ""; var select = new SelectHelper(); var update = new UpdateHelper(); if (string.IsNullOrEmpty(strWhere) == false) { sw = " where " + strWhere; } if (isExistsMoreLv) { pid = ConvertHelper.Cint0(pid); if (string.IsNullOrEmpty(sw)) { sw = " where " + fieldParentId + "=" + pid; } else { sw += " and " + fieldParentId + "=" + pid; } } var dt = select.ExcuSQLDataTable("select " + fieldId + " from " + tableName + " " + sw + " order by " + fieldName + " asc," + fieldId); string[] pRs = DataTableHelper.GetArrayString(dt, fieldId); if (pRs.Length > 0) { int ti = pRs.Length; for (int i = 0; i < ti; i++) { if (pRs[i].Length > 0) { update.Update("update " + tableName + " set " + fieldName + "=" + (i + 1).ToString() + " where " + fieldId + "=" + pRs[i]); if (isExistsMoreLv) { AutoSort(fieldId, tableName, strWhere, isExistsMoreLv, ConvertHelper.Cint0(pRs[i]), fieldName, fieldParentId); } } } } pRs = null; return true; } catch { return false; } }
/// <summary> /// 获取SHOP_SUPPLIER_RELATION表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List <ConditionFun.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetRecordCount <SHOP_SUPPLIER_RELATION>(wheres)); }
/// <summary> /// 获取排序字段Sort的最大值 /// </summary> public int GetSortMax() { //查询 var select = new SelectHelper(); return ConvertHelper.Cint0(select.GetMax<Information>(InformationTable.Sort)); }
/// <summary> /// 获取MenuInfo表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List <ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetRecordCount <MenuInfo>(wheres)); }
public ActionResult EditIOSOutsideApp(string id) { IOSOutsideApp app; id = Request.QueryString["id"]; if (string.IsNullOrEmpty(id)) { app = new IOSOutsideApp(); } else { app = BoFactory.GetVersionTrackBo.GetIOSOutsideApp(id); } SMC_PackageExt ext = null; if (!String.IsNullOrEmpty(id)) { List<KeyValuePair<string, object>> objs = new List<KeyValuePair<string, object>>(); objs.Add(new KeyValuePair<string, object>("TableName", "IOSOutsideApplication")); objs.Add(new KeyValuePair<string, object>("TableID", id)); ext = Bo.BoFactory.GetSMC_PackageExtBO.Get(objs); } //获取ClientType,只包含ios类型 var clientTypes = BoFactory.GetVersionTrackBo.QueryClientTypeList(); IList<ClientTypes> cTypes = new List<ClientTypes>(); foreach (var cT in clientTypes) { if (cT.ClientType.ToLower().Contains("ios")) cTypes.Add(cT); } List<SelectListItem> unitList = new List<SelectListItem>(); //获取当前用户的本单位 IList<SmartBox.Console.Common.Entities.SMC_Unit> js = GetUnitData(); foreach (SmartBox.Console.Common.Entities.SMC_Unit r in js) { if (r == null) continue; //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); unitList.Add(new SelectListItem { Text = r.Unit_Name, Value = r.Unit_ID }); } List<SelectListItem> IsRecom = new List<SelectListItem>(); IsRecom.Add(new SelectListItem { Text = "推荐", Value = "1", Selected = true }); IsRecom.Add(new SelectListItem { Text = "不推荐", Value = "0" }); List<SelectListItem> IsMust = new List<SelectListItem>(); IsMust.Add(new SelectListItem { Text = "必备", Value = "1", Selected = true }); IsMust.Add(new SelectListItem { Text = "不必备", Value = "0" }); ViewData["IsRecom"] = IsRecom; ViewData["IsMust"] = IsMust; ViewData["Unit"] = unitList; ViewData["Application"] = BoFactory.GetVersionTrackBo.QueryApplicationList().ToDataTable(); ViewData["ClientType"] = cTypes.ToDataTable(); SelectHelper ddlApplicationSelect = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationCategoryList().ToDataTable()); ViewData["Cate"] = ddlApplicationSelect.GetSelectList("DisplayName", "ID", false); ViewData["DispName"] = (ext == null ? "" : ext.pe_DisplayName); return View(app); }
/// <summary> /// 获取排序字段Sort的最大值 /// </summary> public int GetSortMax() { //查询 var select = new SelectHelper(); return ConvertHelper.Cint0(select.GetMax<MenuInfo>(MenuInfoTable.Sort)); }
/// <summary> /// 获取数据表中的某个值——从数据库中查询 /// </summary> /// <param name="colName">获取的列名</param> /// <param name="wheres">条件</param> /// <returns></returns> public object GetFieldValue(string colName, List <ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetColumnsValue <PagePowerSignPublic>(colName, wheres)); }
/// <summary> /// 获取排序字段Sort的最大值 /// </summary> /// <param name="parentId">父Id值</param> public int GetSortMax(int parentId) { //定义查询条件 var wheres = new List<ConditionHelper.SqlqueryCondition>(); wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, BranchTable.ParentId, Comparison.Equals, parentId)); //查询 var select = new SelectHelper(); return ConvertHelper.Cint0(select.GetMax<Branch>(BranchTable.Sort, wheres)); }
/// <summary> /// 获取PagePowerSignPublic表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List <ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return(select.GetRecordCount <PagePowerSignPublic>(wheres)); }
/// <summary> /// 获取UploadConfig表记录总数——从数据库中查询 /// </summary> /// <param name="wheres">条件</param> /// <returns>int</returns> public int GetRecordCount(List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetRecordCount<UploadConfig>(wheres); }
//[ValidateAntiForgeryToken] public async Task <ActionResult> Register(AccountRegistrationModel viewModel) { Dictionary <string, string> StaList = EnumHelper.GetEnumItemDesc(typeof(States)); ViewBag.StatesList = new SelectList(StaList, "key", "value"); ViewBag.TimeZone = SelectHelper.TimeZoneToSelect(db);; // Ensure we have a valid viewModel to work with if (!ModelState.IsValid) { return(View(viewModel)); } // Prepare the identity with the provided information DateTime dt = DateTime.UtcNow; Company company = new Company { CompanyName = viewModel.CompanyName, Address1 = viewModel.Address, City = viewModel.City, State = viewModel.State, Telphone = viewModel.Telphone, TimeZone = viewModel.TimeZone, Email = viewModel.Email, Zip = viewModel.Zip, TradeName = viewModel.TradeName, PayFreq = "Weekly", Country = "United States", RoundTo = "15", PayRollRegTime = dt, WeekRule = true, WeekRuleValue = 40, DayRule = true, DayRuleValue = 8, DoubeRule = true, DoubeRuleValue = 12, DaylightSavingTime = true, Status = "3" }; var user = new AppUser { UserName = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Millisecond.ToString(), Email = viewModel.Email, TimeZone = viewModel.TimeZone, LastLoginDate = DateTime.UtcNow, Company = company }; // Try to create a user with the given identity try { var result = await UserManager.CreateAsync(user, "Pay123456"); // If the user could not be created if (!result.Succeeded) { // Add all errors to the page so they can be used to display what went wrong AddErrors(result); return(View(viewModel)); } if (!UserManager.IsInRole(user.Id, "Admin")) { UserManager.AddToRole(user.Id, "Admin"); } string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("CompleteRegist", "Account", new { userId = user.Id, code = code, Nt = TimeHelper.ConvertDateTimeInt(DateTime.UtcNow) }, protocol: Request.Url.Scheme); string EmailBody = "Thank you for creating an PayRoll account. You need to complete the registration information and confirm your account, you'll have access to PayRoll system."; string EmailLink = "Please confirm your account complete regist by clicking.<a href=\"" + callbackUrl + "\">Click it! »</a>"; string strbody = ReplaceText(EmailBody, EmailLink); await UserManager.SendEmailAsync(user.Id, "Confirm Your Account – Complete Registration Information (" + user.Company.CompanyName + ")", strbody); ViewBag.ReceiveEmail = user.Email; return(View("WaitEmail")); //return RedirectToLocal(); } catch (DbEntityValidationException ex) { // Add all errors to the page so they can be used to display what went wrong AddErrors(ex); return(View(viewModel)); } }
/// <summary> /// 获取数据表中的某个值——从数据库中查询 /// </summary> /// <param name="colName">获取的列名</param> /// <param name="wheres">条件</param> /// <returns></returns> public object GetFieldValue(string colName, List<ConditionHelper.SqlqueryCondition> wheres) { var select = new SelectHelper(); return select.GetColumnsValue<UploadConfig>(colName, wheres); }
public ActionResult EditApplication(string id) { List<SelectListItem> unitList = new List<SelectListItem>(); IList<SmartBox.Console.Common.Entities.SMC_Unit> js = GetUnitData(); foreach (SmartBox.Console.Common.Entities.SMC_Unit r in js) { //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); unitList.Add(new SelectListItem { Text = r.Unit_Name, Value = r.Unit_ID }); } //ViewData["unitData"] = Newtonsoft.Json.JsonConvert.SerializeObject(js); //获取当前用户的本单位 //Dictionary<string, string> unitInfo = BoFactory.GetSMC_UserListBo.GetUnitByUL_UID(CurrentUser.UserUId); //if (unitInfo.Count > 0) //{ // string unitName = "本单位-" + unitInfo.ElementAt(0).Key; // string unitId = unitInfo.ElementAt(0).Value; // unitList.Add(new SelectListItem { Text = unitName, Value = unitId, Selected = true }); //} //if (BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId)) //{ // //加入所有单位列表 // PageView view = new PageView(); // view.PageSize = 15; // JsonFlexiGridData units = BoFactory.GetSMC_UnitBo.QueryUnitByUpperUnitCode(view, ""); // foreach (FlexiGridRow r in units.rows) // { // //unitList.Add(new SelectListItem { Text = "全局", Value = "" }); // unitList.Add(new SelectListItem { Text = r.cell[1], Value = r.id }); // } //} Application app; SelectHelper ddlPrivilege = new SelectHelper(BoFactory.GetVersionTrackBo.QueryAppPrivilegeList().ToDataTable(), "未指定", ""); SelectHelper chkCategoryIDs = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationCategoryList().ToDataTable()); if (string.IsNullOrEmpty(id)) { app = new Application(); } else { app = BoFactory.GetVersionTrackBo.GetApplication(id); foreach (SelectListItem item in unitList) { if (item.Value == app.Unit) { item.Selected = true; break; } } } if (string.IsNullOrEmpty(app.CategoryIDs)) { ViewData["CategoryIDs"] = chkCategoryIDs.GetSelectListItem("DisplayName", "ID", false); } else { ViewData["CategoryIDs"] = chkCategoryIDs.GetSelectListItem("DisplayName", "ID", app.CategoryIDs.Split(',').ToList(), false); } ViewData["Privilege"] = ddlPrivilege.GetSelectListItem("DisplayName", "ID", true); ViewData["Unit"] = unitList; return View(app); }