public void OP_Command(object sender, CommandEventArgs e) { int intId = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "edit") { if (HelperUtility.hasPurviewOP("MedicalRecord_update")) { Response.Redirect("edit.aspx?id=" + intId.ToString() + "&page=" + ViewState["page"]); } else { string strUrl = "list.aspx?page=" + ViewState["page"]; HelperUtility.showAlert("没有操作权限", strUrl); } } else if (e.CommandName == "del") { if (HelperUtility.hasPurviewOP("MedicalRecord_del")) { BllMedicalRecord.deleteById(intId); } else { string strUrl = "list.aspx?page=" + ViewState["page"]; HelperUtility.showAlert("没有操作权限", strUrl); } } LoadDataPage(); }
public void OP_Command(object sender, CommandEventArgs e) { int intIdGoods = Convert.ToInt32(e.CommandArgument); int intIdContract = Convert.ToInt32(ViewState["ContractId"]); string strUrl; if (e.CommandName == "AddGoods") { if (!HelperUtility.hasPurviewOP("InventoryContract_update")) { HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]); } int rowIndex = ((GridViewRow)((Button)sender).NamingContainer).RowIndex; GridViewRow row = gvShow.Rows[rowIndex]; TextBox tbAmountFill = (TextBox)row.FindControl("tbAmountFill"); if (tbAmountFill is null) { return; } Label lblAmountReal = (Label)row.FindControl("lblAmountReal"); Label lblAmountStock = (Label)row.FindControl("lblAmountStock"); ModelInventoryRecord model = new ModelInventoryRecord(); model.id_contract = intIdContract; model.id_goods = intIdGoods; model.amount_real = Convert.ToDecimal(lblAmountReal.Text); model.amount_stock = Convert.ToDecimal(lblAmountStock.Text); model.amount_fill = Convert.ToDecimal(tbAmountFill.Text); BllInventoryRecord.add(model); } LoadData(); }
protected void btnEdit_Click(object sender, EventArgs e) { if (!HelperUtility.hasPurviewOP("SalesContract_update")) { HelperUtility.showAlert("没有操作权限", "/BackManager/home.aspx"); } int intAdminId = (int)ViewState["AdminId"]; int intId = (int)ViewState["id"]; int intPage = (int)ViewState["page"]; string strThisPageUrl = "edit.aspx?id=" + intId + "&page=" + intPage; string strMsgError = ""; // 验证输入 string strCompanyName = tbCompanyName.Text.Trim(); if ("".Equals(strCompanyName)) { strMsgError += "公司名不能为空!"; } string strTimeSign = tbTimeSign.Value.ToString(); if ("".Equals(strTimeSign)) { strMsgError += "入库单签发时间不能为空!"; } if (!HelperUtility.isDateType(strTimeSign)) { strMsgError += "入库单签发时间格式不正确!"; } string strComment = tbComment.Text.Trim(); if (strComment.Length > 500) { strMsgError += "备注信息不能超过500个字数!"; } if (!"".Equals(strMsgError)) { HelperUtility.showAlert(strMsgError, strThisPageUrl); return; } string strPhotoUrls = ""; // 验证完毕,提交数据 ModelSalesContract model = BllSalesContract.getById(intId); if (strCompanyName.Contains("未知公司")) { model.id_company = 0; } else { model.id_company = BllSalesCompany.getIdByName(strCompanyName, intAdminId); } model.id_admin = intAdminId; model.photo_urls = strPhotoUrls; model.comment = strComment; model.time_sign = Convert.ToDateTime(strTimeSign); // 更新数据库记录 BllSalesContract.update(model); // 跳转回列表页 Response.Redirect("/BackManager/sales_contract/list.aspx?page=" + intPage); }
public void ProcessRequest(HttpContext context) { // context.Response.ContentType = "text/plain"; context.Response.ContentType = "application/json"; string strOPFlag; if (context.Request.Params["op_flag"] == null || "".Equals(context.Request.Params["op_flag"].ToString())) { context.Response.Write(HelperUtility.setReturnJson("500", "需要指明操作类型!", "")); return; } strOPFlag = context.Request.Params["op_flag"].ToString(); switch (strOPFlag) { case "UploadFile": UploadFile(context); break; case "DelFile": DelFile(context); break; default: context.Response.Write(HelperUtility.setReturnJson("500", "需要指明操作类型!", "")); break; } }
// 批量更改选中货品的入库单ID protected void btnTrans_Click(object sender, EventArgs e) { int intCount = 0, intId, intContractId; intContractId = Convert.ToInt32(ddlSalesContract.SelectedValue); foreach (GridViewRow objGVRow in gvShow.Rows) { CheckBox objCB = (CheckBox)objGVRow.FindControl("cbSelect"); //Label lblId = (Label)objGVRow.FindControl("lblId"); //intId = Convert.ToInt32(lblId.Text); if (objCB == null) { continue; } if (objCB.Checked) { intId = Convert.ToInt32(gvShow.DataKeys[objGVRow.RowIndex].Value); if (intId > 0) { BllSalesGoods.updateContractId(intId, intContractId); intCount += 1; } } } string strUrlBack = "?cid=" + ViewState["ContractId"] + "&cpage=" + ViewState["ContractPage"]; HelperUtility.showAlert("转移成功 " + intCount + " 条数据!", "list.aspx" + strUrlBack + "&page=" + ViewState["page"]); }
protected void btnAdd_Click(object sender, EventArgs e) { if (HelperUtility.hasPurviewOP("SalesCompany_add")) { ModelSalesCompany model; StringBuilder objSB = new StringBuilder(); if ("".Equals(tbCompanyName.Value.Trim())) { return; } objSB.Append(tbCompanyName.Value.Trim()); // 获取文本框文本根据换行符分割成字符串数组 string[] aryRows = objSB.ToString().Split(Environment.NewLine.ToCharArray()); aryRows = HelperUtility.removeArrayBlankRow(aryRows); if (aryRows.Length <= 0) { return; } for (int i = 0; i < aryRows.Length; i++) { model = new ModelSalesCompany(); model.name = aryRows[i]; model.id_admin = (int)ViewState["AdminId"]; BllSalesCompany.add(model); } HelperUtility.showAlert("添加成功!", "list.aspx"); } else { string strUrl = "list.aspx?page=" + ViewState["page"]; HelperUtility.showAlert("没有添加权限", strUrl); } }
public void OP_Command(object sender, CommandEventArgs e) { int intId = Convert.ToInt32(e.CommandArgument); string strUrlBack = "?cid=" + ViewState["ContractId"] + "&cpage=" + ViewState["ContractPage"]; if (e.CommandName == "edit") { if (HelperUtility.hasPurviewOP("SalesGoods_update")) { string strUrl = "edit.aspx" + strUrlBack; strUrl += "&page=" + ViewState["page"] + "&id=" + intId.ToString(); Response.Redirect(strUrl); } else { HelperUtility.showAlert("没有操作权限", "list.aspx" + strUrlBack + "&page=" + ViewState["page"]); } } else if (e.CommandName == "del") { if (HelperUtility.hasPurviewOP("SalesGoods_del")) { BllSalesGoods.deleteById(intId); } else { HelperUtility.showAlert("没有操作权限", "list.aspx" + strUrlBack + "&page=" + ViewState["page"]); } } LoadDataPage(); }
protected void gvShow_RowUpdating(object sender, GridViewUpdateEventArgs e) { string strMsg = ""; string strId = gvShow.DataKeys[e.RowIndex].Values[0].ToString(); Debug.WriteLine(strId); TextBox tbAmount = (TextBox)gvShow.Rows[e.RowIndex].FindControl("tbAmount"); if ("".Equals(tbAmount.Text)) { strMsg += "数量不能为空!"; } if (!HelperUtility.isDecimal(tbAmount.Text)) { strMsg += "请输入正确的数字!"; } decimal dcmAmount = Convert.ToDecimal(tbAmount.Text); if (dcmAmount == 0) { strMsg += "数量必须大于0!"; } if (!"".Equals(strMsg)) { HelperUtility.showAlert(strMsg, ""); return; } else { // BllCheckoutRecord.updateAmountById(dcmAmount, Convert.ToInt32(strId)); } gvShow.EditIndex = -1; LoadData(); }
public void LoadEnums() { @ViewData["ComplainPriorityFilter"] = HelperUtility.ComplainProrityTypesEnums(); @ViewData["ComplainTypeFilter"] = HelperUtility.ComplainTypesEnums(); @ViewData["ComplainStatusFilter"] = HelperUtility.ComplainStatusTypesEnums(); FilterLists(); }
public static MxMLParsedData[] ParseData(string path) { HelperUtility.LogInitiation($"Started Parsing files of Path:{path}"); var parseSuccessStatus = true; List <MxMLParsedData> parseResult = new List <MxMLParsedData>(); var files = HelperUtility.GetAllFilesOfExtension(path, ".mxml"); foreach (string file in files) { HelperUtility.LogStatus($"started parsing {file}"); GenerateRazor.GetRazorString(file); } if (parseSuccessStatus) { HelperUtility.LogSuccess($"Successfully parsed files of {path}"); } else { HelperUtility.LogError($"Failed parsing files of {path}"); } return(parseResult.ToArray()); }
public List <SalesViewModel> GetSalesByCustomerId(string id) { var customerId = Convert.ToInt64(id); var SalesList = new List <SalesViewModel>(); try { SalesList = (from stock in _dbContext.StockIn from sales in _dbContext.Sales from vendor in _dbContext.Vendor from cust in _dbContext.Customer where sales.CustId.Equals(customerId) && stock.StockId.Equals(sales.StockIn) && stock.VendorId.Equals(vendor.VendorId) && sales.CustId.Equals(cust.CustId) select new SalesViewModel { VendorId = HelperUtility.ConvertLongToInt(vendor.VendorId), StockInId = HelperUtility.ConvertLongToInt(stock.StockId), CustomerId = HelperUtility.ConvertLongToInt(cust.CustId), CustomerName = HelperUtility.GetCustName(cust), LoadName = stock.LoadName, Id = HelperUtility.ConvertLongToInt(sales.SalesId), Quantity = sales.Quantity, Total = sales.Total, Price = sales.Price, CreatedDate = sales.CreatedDate.ToString(), VendorName = HelperUtility.GetVendorName(vendor), }).ToList(); } catch (Exception) { } return(SalesList); }
public static SearchElements Filter(this SearchElements source, String AttrName, String AttrValue) { if (source == null) { return(null); } String[] Params = { AttrName, AttrValue }; //Console.WriteLine("<Sequence method='" + GetCurrentMethod(source, Params) + "'>"); if (source.SearchList.Count() == 0) { // Console.WriteLine("<Error>"); // Console.WriteLine("<Message>" + "There are no nodes named [" + source.getParams()[0] + "] in the xml document." + "</Message>"); //Console.WriteLine("</Error>"); //Console.WriteLine("</Sequence>"); return(null); } IEnumerable <XElement> list1 = from el in source.SearchList where el.Attribute(AttrName).Value == AttrValue select el; //Console.WriteLine("<completed />"); // Console.WriteLine("</Sequence>"); return(new SearchElements(list1.ToList <XElement>(), HelperUtility.GetCurrentMethod(), Params)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HelperUtility.hasPurviewPage("SysAdmin_add"); } }
public FileResult GetJobPerformanceData() { string jsonData = "{}"; try { List <TriggerStatistic> triggerStats = null; var triggerStatStore = GetConfiguredTriggerStatStore(); if (triggerStatStore != null) { triggerStats = triggerStatStore.GetAllTriggerStatistics(); if (triggerStats != null) { jsonData = HelperUtility.GetJsonSerializedData(triggerStats); jsonData = HelperUtility.AddJsonHeader(jsonData); } else { Diagnostics.Log.Warn("No chart data retrieved from configured Sitecore.QuartzScheduler.TriggerStatisticsStoreProvider when GetAllTriggerStatistics is called!", this); } } Diagnostics.Log.Info(String.Format("Sitecore.QuartzScheuler: Job performance data being returned from the controller action ReportDataController.GetJobPerformanceData: {0}", jsonData), this); } catch (Exception ex) { Diagnostics.Log.Error("Sitecore.QuartzScheuler: " + ex.Message + Environment.NewLine + ex.StackTrace, this); throw ex; } return((FileResult)this.File(new UTF8Encoding().GetBytes(jsonData), "text/json", "data.json"));; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("SalesContract_update"); ViewState["AdminId"] = intAdminId; // 本页只能从list.aspx的编辑页转过来 // 因此要得到要修改的id值和页面的page值用于修改成功后返回 int intId = HelperUtility.getQueryInt("id"); ViewState["id"] = intId; int intPage = HelperUtility.getQueryInt("page"); ViewState["page"] = intPage; // 绑定销售公司名称的下拉列表数据 BllSalesCompany.bindRPT(rptName); // 根据入库单id查询得到入库单model ModelSalesContract model = BllSalesContract.getById(intId); int intCompanyId = model.id_company; if (intCompanyId > 0) { tbCompanyName.Text = (BllSalesCompany.getById(intCompanyId)).name; } else { tbCompanyName.Text = "未知公司"; } tbTimeSign.Value = model.time_sign.ToString("yyyy-MM-dd"); tbComment.Text = model.comment; } }
public void FilterLists() { var visaStatusFilterList = new List <SelectListItem> { new SelectListItem { Value = "-1", Text = "All" }, new SelectListItem { Value = "1", Text = "New Visas" }, new SelectListItem { Value = "2", Text = "Assigned Visas" }, }; var cats = new SelectList(visaStatusFilterList, "value", "text"); @ViewData["VisaStatus"] = cats; //Agency var agencies = HelperUtility.GetAgencies(); var agencyFilterList = new List <SelectListItem> { new SelectListItem { Value = "-1", Text = "Do Not Assign" } }; agencyFilterList.AddRange(agencies); @ViewData["AgencyFilter"] = new SelectList(agencyFilterList, "value", "text"); var agencyList = new List <SelectListItem> { new SelectListItem { Value = "-1", Text = "All" } }; agencyList.AddRange(agencies); @ViewData["AgencyList"] = new SelectList(agencyList, "value", "text"); //Agents var agentFilterList = new List <SelectListItem> { new SelectListItem { Value = "-1", Text = "Do Not Assign" } }; var agents = HelperUtility.GetAgents(); agentFilterList.AddRange(agents.Select(agent => new SelectListItem { Value = agent.Value, Text = agent.Text })); //agentFilterList.AddRange(HelperUtility.GetAgents()); @ViewData["AgentFilter"] = new SelectList(agentFilterList, "value", "text"); agentFilterList[0].Text = "All"; // new SelectListItem { Value = "-1", Text = "All" }; @ViewData["AgentList"] = new SelectList(agentFilterList, "value", "text"); }
public static SearchElements Traverse(this SearchElements source, String SrcAttrName, String RelNodeName, String RelAttrName) { String[] Params = { RelAttrName, RelNodeName, RelAttrName }; // Console.WriteLine("<Sequence method='" + GetCurrentMethod(source, Params) + "'>"); if (source.SearchList.Count() == 0) { return(null); } IEnumerable <XElement> list1 = null; foreach (XElement el in source.SearchList) { XAttribute att = el.Attribute(SrcAttrName); string srcAttrValue = att.Value; list1 = from elT in HelperUtility.GetXML().Descendants() where elT.Name.LocalName.Equals(RelNodeName) && elT.Attribute(RelAttrName).Value == srcAttrValue select elT; } return(new SearchElements(list1.ToList <XElement>(), HelperUtility.GetCurrentMethod(), Params)); }
/// <summary> /// Creates instance of DataReader for commandText,commandType, active connection, active /// transaction and optional Parameters. /// </summary> /// /// <remarks> Asim Naeem, 7/20/2017. </remarks> /// /// <param name="commandText"> Open Sql Statement or Procedure Name. </param> /// <param name="commandType"> CommandType for Text or StoredProcedure (1 or 4) </param> /// <param name="connection"> Active Connection Object. </param> /// <param name="transaction"> Active Transaction Object. </param> /// <param name="aParams"> (Optional) Collection of Optional Parameters. </param> /// /// <returns> An IDataReader. </returns> private IDataReader ExecuteDataReader(string commandText, CommandType commandType, IDbConnection connection, IDbTransaction transaction, DBParameter[] aParams = null) { IDataReader dataReader = null; try { using (IDbCommand dbCommand = CreateCommand(commandText, commandType)) { if (aParams != null) { HelperUtility.AddParameters(dbCommand, aParams, DBProvider); } dbCommand.Transaction = transaction; dbCommand.Connection = connection; if (connection.State != ConnectionState.Open) { connection.Open(); } dataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConnection); } } catch (Exception exc) { Logger.ILogger.Fatal(exc); throw; } return(dataReader); }
protected void btnSubmit_Click(object sender, EventArgs e) { HelperUtility.hasPurviewPage("Department_add"); string strContent = tbDepartmentName.InnerText; HelperFile.WriteTxt(strContent, strFileName); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("MedicalRecord_add"); ViewState["AdminId"] = intAdminId; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HelperUtility.hasPurviewPage("Department_add"); tbDepartmentName.InnerText = HelperFile.ReadTxt(strFileName); } }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="totalRecordsQuery"></param> /// <param name="predicate"></param> /// <param name="sortBy"></param> /// <param name="orderBy"></param> /// <returns></returns> protected override string GetPagingQuery <T>(int pageNumber, int pageSize, out string totalRecordsQuery, System.Linq.Expressions.Expression <Func <T, bool> > predicate = null, SortOption sortBy = SortOption.ASC, params System.Linq.Expressions.Expression <Func <T, object> >[] orderBy) { WD.DataAccess.QueryProviders.QueryBuilder <T> qbe = new WD.DataAccess.QueryProviders.QueryBuilder <T>(); qbe.Where(predicate); qbe.OrderBy(orderBy); totalRecordsQuery = String.Format("SELECT Count(1) FROM {0} {1}", HelperUtility.GetTableName <T>(), qbe.Where()); return(String.Format("SELECT * FROM (SELECT RowNum R,E.* FROM ({0} {1}) WHERE R BETWEEN {2} AND {3}", qbe.Select(), sortBy.ToString(), ((pageNumber - 1) * pageSize) + 1, pageNumber * pageSize)); }
private EfDbContext.VendorPayments ConstructVendorPaymentVModelToContext(VendorPaymentViewModel vendorPaymentVM) { return(new EfDbContext.VendorPayments { StockInId = HelperUtility.ConvertLongToInt(vendorPaymentVM.StockInId), VendorId = HelperUtility.ConvertLongToInt(vendorPaymentVM.VendorId), AmountPaid = vendorPaymentVM.AmountPaid, }); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("HOME"); ModelAdmin model = BllAdmin.getById(intAdminId); lblAdminName.Text = model.real_name; } }
/// <summary> Gets the join. </summary> /// /// <remarks> Asim Naeem, 7/20/2017. </remarks> /// /// <returns> A string. </returns> public string Join() { return(string.Join(" ", _join.Select( x => string.Format("JOIN {0} ON {1}.{2}={3}.{4}", HelperUtility.GetTableName(x.Key), HelperUtility.GetTableName <T>(), x.Value.Item1, HelperUtility.GetTableName(x.Key), x.Value.Item2)))); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("SalesContract_add"); ViewState["AdminId"] = intAdminId; BllSalesCompany.bindRPT(rptName); } }
private static void WriteFile(string path, string data) { StreamWriter sw = new StreamWriter(HelperUtility.NameWithoutExtension(path, ".cs")); sw.Write(data); var c = HelperUtility.NameWithoutExtension(path, ".cs"); sw.Close(); }
public ActionResult CreateInit(ContractCreateInitViewModel model, string submit) { if (ModelState.IsValid) { //Initialize new contract Contract contract = new Contract(); if (model.ContractId != null) { //this only if contract is edited - load contract from db var c = db.Contracts.Find(model.ContractId); if (c != null) { contract = c; } } else { //first creation of the contract - Signer and owner are not to be changed contract.SignerId = User.Identity.GetUserId(); contract.OwnerId = model.OwnerId; } contract.Description = model.Description; //Set Contract Status contract.ContractStatus = HelperUtility.checkContractStatus(contract, db); //Add Contract to View to display its information in the RightFormPartial (for Status etc...) model.Contract = contract; if (contract.Id == 0) //Means that contract isn't in DB { db.Contracts.Add(contract); } else { db.Entry(contract).State = EntityState.Modified; } db.SaveChanges(); //Decide which button was pressed...then redirect if (submit == continueBtn) { return(RedirectToAction("CreateGeneral", new { id = contract.Id })); } else { return(RedirectToAction("Index")); } } //Repeat Model Initialization of SelectLists -> See GET: ActionMethod model = CreateInitHelper(model); //initialization:end return(View(model)); }
public void Update(Guid userId, string displayName, string email, string mobile) { if (string.IsNullOrWhiteSpace(displayName)) { throw new BizException("显示名不能为空!"); } displayName = displayName.Trim(); if (displayName.Length > 32) { throw new BizException("显示名不能超过32个字符!"); } if (string.IsNullOrWhiteSpace(email) == false) { if (Regex.IsMatch(email.Trim(), @"^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$") == false) { throw new BizException("电子邮箱格式不合法"); } if (email.Length > 256) { throw new BizException("电子邮箱不能超过256个字符!"); } } if (string.IsNullOrWhiteSpace(mobile) == false && HelperUtility.IsMobileFormat(mobile.Trim()) == false) { throw new BizException("手机号格式不合法"); } string sql = @" UPDATE TOP (1) [FlyBase].[dbo].[StaffUser] SET [DisplayName]=@DisplayName ,[Email]=@Email ,[Mobile]=@Mobile ,[UpdatedOn]=GETDATE() ,[UpdatedBy]=@operatorId WHERE [Id]=@UserId" ; int x = SqlHelper.ExecuteNonQuery(DbInstance.CanWrite, sql, new { UserId = userId, DisplayName = displayName, Email = email, Mobile = mobile, operatorId = ContextManager.Current.UserId }); if (x > 0) { this.RemoveAllUserCache(); } }
private void AddRestItemColumns(List <ColumnAndField> whichFields, List <ColumnAndField> whereToAdd, MatchingOptions options, JObject clientPayload) { foreach (var item in whichFields) { var isAdded = whereToAdd.Where(t => t.ColumnName.ToLower().Equals(item.ColumnName.ToLower()) && t.TableName.ToLower().Equals(item.TableName.ToLower()) && t.EntityFullName.ToLower().Equals(item.EntityFullName.ToLower()) && t.EntityPrefix.ToLower().Equals(item.EntityPrefix.ToLower()) ).ToList(); if (isAdded.Any()) { continue; } if (item.ColumnName.Equals(BusinessConstant.UpdatedBy)) { item.Value = options.UserId; } if (item.ColumnName.Equals(BusinessConstant.UpdatedDate)) { item.Value = HelperUtility.GetCurrentUTCDate(); } if (item.ColumnName.Equals(BusinessConstant.EntityCode)) { item.Value = options.Context; } if (item.ColumnName.Equals(BusinessConstant.EntitySubtype)) { item.Value = options.EntitySubType; } if (item.ColumnName.Equals(BusinessConstant.Active)) { item.Value = 1; } if (item.ColumnName.Equals(BusinessConstant.Name)) { item.Value = "NotImplemented"; } if (item.ColumnName.Equals(ItemHelper.ItemTablePrimarykey)) { item.Value = options.PrimaryId; } if (item.ColumnName.Equals(BusinessConstant.TenantId)) { item.Value = options.TenantId; } if (item.ColumnName.Equals(BusinessConstant.AutogeneratedCode)) { item.Value = CodeGenerationHelper.Generate(ItemHelper.ItemClassName, clientPayload); } whereToAdd.Add(item); } }