protected void friendAttentionGridView_RowDataBound(object sender, GridViewRowEventArgs e) { DataRowView view = e.Row.DataItem as DataRowView;//定义一个DataRowView的实例 Image img = new Image(); Button btn = new Button(); btn = (Button)e.Row.FindControl("btnAddFriend"); img = (Image)e.Row.FindControl("imgTopfo"); if (view != null) { //2会员类型,3会员周期,6付费状态,7审核状态 switch (view["ManageTypeId"].ToString().Trim()) { case "1001": e.Row.Cells[2].Text = "个人会员"; break; case "1003": e.Row.Cells[2].Text = "企业会员"; break; case "1004": e.Row.Cells[2].Text = "政府会员"; break; } //会员意向 string[] requireInfo = view["requirInfo"].ToString().Trim().Split(','); string reqInfo = ""; int reqCount = 0; string other = ""; if (requireInfo.Length > 3) { reqCount = 3; other = "..."; } else { reqCount = requireInfo.Length; other = ""; } for (int i = 0; i < reqCount; i++) { if (requireInfo[i].Trim() != "") { switch (requireInfo[i].Trim()) { case "1001": reqInfo += "政府招商 "; break; case "1002": reqInfo += "企业招商 "; break; case "1003": reqInfo += "项目融资 "; break; case "1004": reqInfo += "项目投资 "; break; case "1005": reqInfo += "创业合作 "; break; default: break; } } } e.Row.Cells[3].Text = reqInfo + other; //来自何处 e.Row.Cells[4].Text = view["provinceName"].ToString() + " " + view["cityName"].ToString() + " " + view["countyName"].ToString(); e.Row.Cells[5].Text = view["RegisterTime"].ToString(); btn.CommandName = view["loginName"].ToString().Trim() + "_"; if (view["memberGradeId"].ToString().Trim() != "") { btn.CommandName += view["memberGradeId"].ToString().Trim(); } else { btn.CommandName += "0000"; } btn.CommandName += "%"; if (view["manageTypeId"].ToString().Trim() != "") { btn.CommandName += view["manageTypeId"].ToString().Trim(); } else { btn.CommandName += "0000"; } btn.CommandName += "$"; if (view["requirInfo"].ToString().Trim() != "") { btn.CommandName += view["requirInfo"].ToString().Trim(); } else { btn.CommandName += "0000"; } //会员门户或个人信息 long m = 1; long j = 1; long k = 1; string memberGrade = ""; string strWhere = ""; Tz888.BLL.Conn dal = new Tz888.BLL.Conn(); strWhere = "loginName='" + view["loginName"].ToString().Trim() + "'"; DataTable dt = dal.GetList("loginInfoTab", "loginName", "memberGradeId", strWhere, "loginName", ref m, k, ref j); if (dt != null && dt.Rows.Count > 0) { memberGrade = dt.Rows[0][0].ToString(); } bool bl = (memberGrade.Trim() == "1002"); if (bl) { img.Visible = true; } } }
private void button3_Click(object sender, EventArgs e) { DataRowView drv = BS.AddNew() as DataRowView; }
/// <summary> /// 添加筛选清单 /// </summary> /// <param name="isAdd">是否添加</param> private void ScreenWDBH(bool isAdd) { try { if (null == this.bindingSource1.Current) { this.InformationForm.Fiter(" 1<>1 "); return; } DataRowView drCurrent = this.bindingSource1.Current as DataRowView; //string strTJ = string.Format("{0}[{1}]", drCurrent["FormMC"], drCurrent["ID"]);//条件 清单、子目标识 string strTJ = ""; if (string.IsNullOrEmpty(drCurrent["BZ"].ToString())) { strTJ = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "G" + APP.GoldSoftClient.GlodSoftDiscern.CurrNo + "G"; drCurrent["BZ"] = strTJ; } else { strTJ = drCurrent["BZ"].ToString(); } if (isAdd) { #region 确定清单 string strQDWhere = string.Format("TFLX = '{0}' and (LX is null or LX like '%,{1},%') ", "土石方运输", toString(drCurrent["TSFYSFS"])); DataRow dr = this.GetTFQD(strQDWhere, strTJ, CDataConvert.ConToValue <float>(drCurrent["SWGCL"])); #endregion #region 确定定额 List <DataRow> rows = new List <DataRow>(); StringBuilder sb = new StringBuilder(); this.GCYQCSbindingSource.Filter = " LX = '" + toString(drCurrent["TSFYSFS"]) + "'"; this.TSFYSQDDEbindingSource.Filter = string.Format("YSFS = '{0}' and (YTJL is null or YTJL = '{1}' )", toString(drCurrent["TSFYSFS"]), getGCYCCS(drCurrent["YTJL"], BHTYPE.全部包含)); foreach (DataRowView item in this.TSFYSQDDEbindingSource) { DataRow row = APP.UnInformation.DETable.NewRow(); row["DEBH"] = item["DEBH"]; row["DEMC"] = item["DEMC"]; row["DW"] = item["DW"]; row["XS"] = item["GCLSX"]; row["GCL"] = CDataConvert.ConToValue <float>(row["XS"]) * CDataConvert.ConToValue <float>(dr["GCL"]); row["QDBH"] = dr["QDBH"]; row["TJ"] = strTJ; row["WZLX"] = WZLX.分部分项; rows.Add(row); sb.Append(string.Format("{0},{1},{2},{3}|", item["DEBH"], item["GCLSX"], "", "")); } //dr["BZ"] = sb.ToString() + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "G" + APP.GoldSoftClient.GlodSoftDiscern.CurrNo + "G"; if (string.IsNullOrEmpty(dr["TJ"].ToString())) { dr["BZ"] = sb.ToString() + strTJ; dr["TJ"] = strTJ; } else { dr["BZ"] = sb.ToString() + dr["TJ"].ToString(); } #endregion this.InformationForm.Remove(strTJ); this.InformationForm.Add(dr, rows); } else { //this.InformationForm.Fiter(string.Format("TJ='{0}[{1}]'", drCurrent["FormMC"], drCurrent["ID"]));///添加筛选清单 this.InformationForm.Fiter(string.Format("TJ='{0}'", strTJ));///添加筛选清单 } } catch (Exception ex) { DebugErr(ex.Message); } }
protected void gHistory_ItemDataBound(object sender, DataGridItemEventArgs e) { if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) || (e.Item.ItemType == ListItemType.EditItem)) { long num = _Convert.StrToLong(e.Item.Cells[12].Text, 0L); string text = e.Item.Cells[1].Text; if (text.Length > 6) { text = text.Substring(0, 5) + ".."; } e.Item.Cells[1].Text = "<a href='Scheme.aspx?id=" + num.ToString() + "' target='_blank'><font color=\"#330099\">" + text + "</Font></a>"; double num2 = _Convert.StrToDouble(e.Item.Cells[3].Text, 0.0); e.Item.Cells[3].Text = (num2 == 0.0) ? "" : num2.ToString("N"); num2 = _Convert.StrToDouble(e.Item.Cells[5].Text, 0.0); e.Item.Cells[5].Text = (num2 == 0.0) ? "" : num2.ToString("N"); double num3 = _Convert.StrToDouble(e.Item.Cells[2].Text, 0.0); double num4 = _Convert.StrToDouble(e.Item.Cells[4].Text, 0.0); if (num4 >= num3) { e.Item.Cells[6].Text = "100%"; } else if (num3 > 0.0) { e.Item.Cells[6].Text = Math.Round((double)((num4 / num3) * 100.0), 2).ToString() + "%"; } num2 = _Convert.StrToDouble(e.Item.Cells[7].Text, 0.0); e.Item.Cells[7].Text = (num2 == 0.0) ? "" : num2.ToString("N"); num2 = _Convert.StrToDouble(e.Item.Cells[8].Text, 0.0); e.Item.Cells[8].Text = (num2 == 0.0) ? "" : num2.ToString("N"); if (num2 == 0.0) { e.Item.Cells[9].Text = "未中奖"; e.Item.Cells[9].Style.Add(HtmlTextWriterStyle.Color, "FFFFCC"); } else { e.Item.Cells[9].Text = "中奖啦!"; } try { DataRowView dataItem = (DataRowView)e.Item.DataItem; if (!_Convert.StrToBool(dataItem.Row["IsOpened"].ToString(), false)) { e.Item.Cells[9].Text = "未开奖"; } } catch { } if (_Convert.StrToShort(e.Item.Cells[13].Text, 0) != 0) { e.Item.Cells[11].Text = "已撤单"; } else if (_Convert.StrToBool(e.Item.Cells[14].Text, false)) { e.Item.Cells[11].Text = "<Font color='Red'>已成功</font>"; } else { int num7 = _Convert.StrToInt(e.Item.Cells[0x10].Text, 0); int num8 = _Convert.StrToInt(e.Item.Cells[2].Text, 0); if (num7 >= num8) { e.Item.Cells[11].Text = "<Font color='Red'>已满员</font>"; } else { e.Item.Cells[11].Text = "未成功"; } } } }
protected object gridOrders_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "totalprice": DataRowView dr = (DataRowView)parameter; int currencyId = ValidationHelper.GetInteger(dr["OrderCurrencyID"], 0); var currency = CurrencyInfoProvider.GetCurrencyInfo(currencyId); // If order is not in main currency, show order price if (currency != null) { var orderTotalPrice = ValidationHelper.GetDouble(dr["OrderTotalPrice"], 0); var priceFormatted = currency.FormatPrice(orderTotalPrice); // Formatted currency return(HTMLHelper.HTMLEncode(priceFormatted)); } return(string.Empty); case "invoice": return("<a target=\"_blank\" href=\"" + URLHelper.ResolveUrl("~/CMSModules/Ecommerce/CMSPages/GetInvoice.aspx?orderid=" + ValidationHelper.GetInteger(parameter, 0)) + "\">" + GetString("general.view") + "</a>"); case "downloads": int orderId = ValidationHelper.GetInteger(parameter, 0); // Get order item SKU files for the order DataSet orderItemSkuFiles = OrderItemSKUFileInfoProvider.GetOrderItemSKUFiles(orderId); // If there are some downloads available for the order if (!DataHelper.DataSourceIsEmpty(orderItemSkuFiles)) { // Make download links column visible downloadLinksColumnVisible = true; // Show view action for this record string url = URLHelper.ResolveUrl("~/CMSModules/Ecommerce/CMSPages/EProducts.aspx?orderid=" + orderId); return(String.Format("<a href=\"#\" onclick=\"{0} \">{1}</a>", ScriptHelper.GetModalDialogScript(url, "DownloadLinks", 700, 600), GetString("general.view"))); } return(String.Empty); case "ordertoshoppingcart": int id = ValidationHelper.GetInteger(parameter, 0); LinkButton addToCartButton = new LinkButton { OnClientClick = "return confirm(" + ScriptHelper.GetLocalizedString("myorders.addtocart") + ");", Text = GetString("myorders.reorder") }; addToCartButton.Click += (s, e) => AddToCart(id); return(addToCartButton); } return(parameter); }
protected void gvReimburseDetails_RowDataBound(object sender, GridViewRowEventArgs e) { // 对数据列进行赋值 if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) != DataControlRowState.Edit) { DataRowView drvDetail = (DataRowView)e.Row.DataItem; FormDS.FormReimburseDetailRow row = (FormDS.FormReimburseDetailRow)drvDetail.Row; ApplyFeeTotal = decimal.Round((ApplyFeeTotal + row.AccruedAmount), 2); RemainFeeTotal = decimal.Round((RemainFeeTotal + row.RemainAmount), 2); ReimburseFeeTotal = decimal.Round((ReimburseFeeTotal + row.Amount), 2); PrePaidTotal = decimal.Round((PrePaidTotal + row.PrePaidAmount), 2); AmountTotal = decimal.Round((AmountTotal + row.Amount), 2); TaxTotal = decimal.Round((TaxTotal + row.TaxAmount), 2); //如果是票扣的话,那么不能编辑 TextBox txtPrePaidAmount = (TextBox)e.Row.FindControl("txtPrePaidAmount"); TextBox txtAmount = (TextBox)e.Row.FindControl("txtAmount"); TextBox txtTaxAmount = (TextBox)e.Row.FindControl("txtTaxAmount"); if (int.Parse(this.ViewState["PaymentTypeID"].ToString()) == (int)SystemEnums.PaymentType.PiaoKou) { txtAmount.ReadOnly = true; txtTaxAmount.ReadOnly = true; txtPrePaidAmount.ReadOnly = true; } else { txtPrePaidAmount.Attributes.Add("onBlur", "PlusTotal('totallblPrePaid',this);"); txtPrePaidAmount.Attributes.Add("onFocus", "MinusTotal('totallblPrePaid',this)"); txtAmount.Attributes.Add("onBlur", "PlusTotal('totallblBeforeTax',this);"); txtAmount.Attributes.Add("onFocus", "MinusTotal('totallblBeforeTax',this)"); txtTaxAmount.Attributes.Add("onBlur", "PlusTotal('totallblTax',this);"); txtTaxAmount.Attributes.Add("onFocus", "MinusTotal('totallblTax',this)"); } HyperLink lblApplyFormNo = (HyperLink)e.Row.FindControl("lblApplyFormNo"); FormDS.FormRow form = this.SalesReimburseBLL.GetFormByID(row.FormApplyID)[0]; switch (form.PageType) { case (int)SystemEnums.PageType.PromotionApply: lblApplyFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesPromotionApproval.aspx?ShowDialog=1&ObjectId=" + row.FormApplyID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; break; case (int)SystemEnums.PageType.GeneralApply: lblApplyFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesGeneralApproval.aspx?ShowDialog=1&ObjectId=" + row.FormApplyID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; break; case (int)SystemEnums.PageType.RebateApply: lblApplyFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesRebateApproval.aspx?ShowDialog=1&ObjectId=" + row.FormApplyID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; break; case (int)SystemEnums.PageType.GeneralApplyExecute: lblApplyFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesGeneralExecution.aspx?ShowDialog=1&ObjectId=" + row.FormApplyID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; break; case (int)SystemEnums.PageType.PromotionApplyExecute: lblApplyFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesPromotionExecution.aspx?ShowDialog=1&ObjectId=" + row.FormApplyID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; break; } } } if (e.Row.RowType == DataControlRowType.Footer) { Label applbl = (Label)e.Row.FindControl("applbl"); applbl.Text = ApplyFeeTotal.ToString("N"); Label Remainlbl = (Label)e.Row.FindControl("Remainlbl"); Remainlbl.Text = RemainFeeTotal.ToString("N"); Label totallblPrePaid = (Label)e.Row.FindControl("totallblPrePaid"); totallblPrePaid.Text = PrePaidTotal.ToString("N"); Label totallblBeforeTax = (Label)e.Row.FindControl("totallblBeforeTax"); totallblBeforeTax.Text = AmountTotal.ToString("N"); Label totallblTax = (Label)e.Row.FindControl("totallblTax"); totallblTax.Text = TaxTotal.ToString("N"); } }
protected object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView row = null; if (parameter is DataRowView) { row = (DataRowView)parameter; } int subscriberId = 0; switch (sourceName) { case "name": subscriberId = ValidationHelper.GetInteger(DataHelper.GetDataRowValue(row.Row, "SubscriberID"), 0); string name = null; if (subscriberId == 0) { // Get full name for contact group member (contact) name = ValidationHelper.GetString(DataHelper.GetDataRowValue(row.Row, "SubscriberFullName"), string.Empty); // Return encoded name return(HTMLHelper.HTMLEncode(name)); } else { // Add the field transformation control that handles the translation var tr = new ObjectTransformation("newsletter.subscriber", subscriberId); tr.Transformation = "SubscriberFullName"; return(tr); } case "email": subscriberId = ValidationHelper.GetInteger(DataHelper.GetDataRowValue(row.Row, "SubscriberID"), 0); string email = null; if (subscriberId == 0) { // Get email for contact group member (contact) email = ValidationHelper.GetString(DataHelper.GetDataRowValue(row.Row, "SubscriberEmail"), string.Empty); } else { SubscriberInfo subscriber = SubscriberInfoProvider.GetSubscriberInfo(subscriberId); if (subscriber != null) { if (subscriber.SubscriberType == null) { // Get email for classic subscriber email = subscriber.SubscriberEmail; } else { switch (subscriber.SubscriberType) { case PredefinedObjectType.USER: UserInfo user = UserInfoProvider.GetUserInfo(subscriber.SubscriberRelatedID); if (user != null) { // Get email for user subscriber email = user.Email; } break; case PredefinedObjectType.CONTACT: DataSet ds = ModuleCommands.OnlineMarketingGetContactForNewsletters(subscriber.SubscriberRelatedID, "ContactEmail"); if (!DataHelper.DataSourceIsEmpty(ds)) { // Get email from contact subscriber email = ValidationHelper.GetString(ds.Tables[0].Rows[0]["ContactEmail"], string.Empty); } break; } } } } if (!string.IsNullOrEmpty(email)) { // Return encoded email email = HTMLHelper.HTMLEncode(email); } return(email); case "variantname": if (!isMainABTestIssue) { return(null); } IssueInfo issue = IssueInfoProvider.GetIssueInfo(ValidationHelper.GetInteger(parameter, 0)); string variantName = null; if (issue != null) { if (!issue.IssueIsVariant) { // Get varinat name from the winner issue if (winnerIssue == null) { ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issue.IssueID); if (test != null) { // Get A/B test winner variant winnerIssue = IssueInfoProvider.GetIssueInfo(test.TestWinnerIssueID); } } if (winnerIssue != null) { // Get variant name variantName = winnerIssue.IssueVariantName; } } else { // Get variant name variantName = issue.IssueVariantName; } } return(variantName); default: return(parameter); } }
private void Select() { selectedRow = bindingSource.Current as DataRowView; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
/// <summary> /// Zeigt den Jewaligen Dialog an /// </summary> /// <param name="mode"></param> private void ShowDialog(Mode mode) { // Testet die Verbundung zur Datenbank if (Database.ConnectionAvailable()) { if (type == Type.Busflotte) { Bus bus = new Bus(); DataRowView dr = (DataRowView)tblBusBS.Current; if (dr != null) { bus.BusID = (int)dr.Row.ItemArray[0]; bus.AusstattungsID = (int)dr.Row.ItemArray[1]; bus.SitzplanID = (int)dr.Row.ItemArray[2]; bus.HasWlan = (bool)dr.Row.ItemArray[3]; bus.HasToilet = (bool)dr.Row.ItemArray[4]; bus.HasDrinks = (bool)dr.Row.ItemArray[5]; bus.CountSeats = (int)dr.Row.ItemArray[6]; bus.CountReclining = (int)dr.Row.ItemArray[7]; bus.CountSleeping = (int)dr.Row.ItemArray[8]; } BusDialog busDialog = new BusDialog(bus, (BusDialog.Mode)mode); busDialog.ShowDialog(); } else if (type == Type.Buchungen) { Buchung buchung = new Buchung(); DataRowView dr = (DataRowView)tblBuchungBS.Current; if (dr != null) { buchung.BuchungsID = (int)dr.Row.ItemArray[0]; buchung.BenutzerdatenID = (int)dr.Row.ItemArray[1]; buchung.LinienID = (int)dr.Row.ItemArray[2]; buchung.Nachname = (string)dr.Row.ItemArray[3].ToString(); buchung.Vorname = (string)dr.Row.ItemArray[4].ToString(); buchung.Sitzplaetze = (int)dr.Row.ItemArray[5]; buchung.Liegesitze = (int)dr.Row.ItemArray[6]; buchung.Schlafsitze = (int)dr.Row.ItemArray[7]; if (dr.Row.ItemArray[8].ToString() != "") { buchung.Starthaltestelle = (string)dr.Row.ItemArray[8]; } if (dr.Row.ItemArray[9].ToString() != "") { buchung.Endhaltestelle = (string)dr.Row.ItemArray[9]; } } BuchungDialog buchungDialog = new BuchungDialog(buchung, (BuchungDialog.Mode)mode); buchungDialog.ShowDialog(); } else if (type == Type.Buslinie) { Buslinie buslinie = new Buslinie(); DataRowView dr = (DataRowView)tblBuslinieBS.Current; if (dr != null) { buslinie.LinienID = (int)dr.Row.ItemArray[0]; buslinie.FahrplanID = (int)dr.Row.ItemArray[1]; buslinie.BusID = (int)dr.Row.ItemArray[2]; buslinie.Start = (string)dr.Row.ItemArray[3]; buslinie.Ende = (string)dr.Row.ItemArray[4]; } BuslinieDialog buslinieDialog = new BuslinieDialog(buslinie, (BuslinieDialog.Mode)mode); buslinieDialog.ShowDialog(); } else if (type == Type.Fahrplan) { Fahrplan fahrplan = new Fahrplan(); DataRowView dr = (DataRowView)tblFahrplanBS.Current; if (dr != null) { fahrplan.FahrplanID = (int)dr.Row.ItemArray[0]; fahrplan.AbfahrtsZeit = (string)dr.Row.ItemArray[1].ToString(); fahrplan.Abfahrtdatum = (DateTime)dr.Row.ItemArray[2]; fahrplan.Fahrtdauer = (string)dr.Row.ItemArray[3].ToString(); fahrplan.Fahrpreis = (double)dr.Row.ItemArray[4]; } FahrplanDialog fahrplanDialog = new FahrplanDialog(fahrplan, (FahrplanDialog.Mode)mode); fahrplanDialog.ShowDialog(); } ResetView(); } else { MessageBox.Show("Es konnte keine Verbindung zur Datenbank hergestellt werden."); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int k = e.ColumnIndex; int l = e.RowIndex; if (l >= 0) { currentrow = l; dataGridView1.Rows[l].Selected = true; currentpos = dataGridView1.FirstDisplayedScrollingRowIndex; dataGridView1.Rows[l].Selected = true; DataRowView temprow = (DataRowView)dataGridView1.Rows[l].DataBoundItem; // string liushui = temprow[5].ToString(); switch (k) { case 0: //名称 SEQ_label.Text = temprow["流水号"].ToString(); textBox1.Text = temprow["名称"].ToString(); textBox2.Text = temprow["数量"].ToString(); comboBox2.Text = temprow["类别"].ToString(); textBox4.Text = temprow["备注"].ToString(); textBox5.Text = temprow["当前状态"].ToString(); textBox3.Text = temprow["现场数量"].ToString(); comboBox1.Text = temprow["单位"].ToString(); MFG.Text = temprow["供应商"].ToString(); DWG.Text = temprow["图号"].ToString(); CODE.Text = temprow["工具编号"].ToString(); ORG_CODE.Text = temprow["出厂编号"].ToString(); string startdatestr = temprow["提出日期"].ToString(); string closedatestr = temprow["到货日期"].ToString(); if (closedatestr != "" && !closedatestr.Contains("0000")) { dateTimePicker1.Value = DateTime.Parse(closedatestr); checkBox1.Checked = false; } if (startdatestr != "" && !startdatestr.Contains("0000")) { dateTimePicker2.Value = DateTime.Parse(startdatestr); // checkBox1.Checked = false; } break; case 1: //流水号 string liushui = temprow["流水号"].ToString(); string folderpath = Program.InfoPath + "Tools" + "\\" + liushui + "\\"; localMethod.creatDir(folderpath); System.Diagnostics.Process.Start("explorer.exe", folderpath); break; } } }
protected void Button2_Click(object sender, EventArgs e) { string id = DropDownList3.SelectedValue.ToString(); string time = DateTime.Now.ToString(); string ct = md.Text; string sqltj1 = "insert into Appointment_Information(DoctorID,PatientID,SubmitTime,AppointmentInfo,Info) values('" + id + "','" + Convert.ToString(Session["IDLogin"]) + "','" + time + "','" + ct + "','0')"; if (dataOperate.execSQL(sqltj1)) { RegisterStartupScript("", "<script>alert('Add member successful!')</script>"); string sqlallMember = "select * from Appointment_Information"; this.GridView1.Visible = true; this.Label10.Visible = true; this.Label11.Visible = true; this.Label11.Text = "All"; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Appointment_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; string sql = "select * from Appointment_Information"; if (dataOperate.seleSQL(sql) > 0) { this.GridView1.DataSource = dataOperate.getDataset(sql, "DoctorID"); this.GridView1.DataBind(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { DataSet myds = new DataSet(); myds = dataOperate.getDataset("select * from Appointment_Information where DoctorID='" + GridView1.Rows[i].Cells[1].Text + "' and SubmitTime='" + GridView1.Rows[i].Cells[2].Text + "'", "Appointment_Information"); if (myds.Tables["Appointment_Information"].Rows.Count > 0) { DataRowView mydrv = myds.Tables["Appointment_Information"].DefaultView[0]; string score = Convert.ToString(mydrv["Info"]); if (score == "1") { GridView1.Rows[i].Cells[3].Text = "Proved"; } else if (score == "2") { GridView1.Rows[i].Cells[3].Text = "Deny"; } } } } string sql1 = "select * from Member_Information where MemberDepartment='Doctor'"; DataSet ds1 = new DataSet(); ds1 = dataOperate.getDataset(sql1, "Member_Information"); DataView rowview1 = ds1.Tables["Member_Information"].DefaultView; DropDownList3.DataSource = rowview1; DropDownList3.DataValueField = "MemberID"; DropDownList3.DataBind(); this.Label10.Visible = false; this.Label11.Visible = false; //Response.Write("<script>alert('添加学生成功!');location.href='xuesheng.aspx';</script>"); } else { RegisterStartupScript("", "<script>alert('Sorry,add member failed!')</script>"); string sqlallMember = "select * from Appointment_Information"; this.GridView1.Visible = true; this.Label10.Visible = true; this.Label11.Visible = true; this.Label11.Text = "All"; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Appointment_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; string sql = "select * from Appointment_Information"; if (dataOperate.seleSQL(sql) > 0) { this.GridView1.DataSource = dataOperate.getDataset(sql, "DoctorID"); this.GridView1.DataBind(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { DataSet myds = new DataSet(); myds = dataOperate.getDataset("select * from Appointment_Information where DoctorID='" + GridView1.Rows[i].Cells[1].Text + "' and SubmitTime='" + GridView1.Rows[i].Cells[2].Text + "'", "Appointment_Information"); if (myds.Tables["Appointment_Information"].Rows.Count > 0) { DataRowView mydrv = myds.Tables["Appointment_Information"].DefaultView[0]; string score = Convert.ToString(mydrv["Info"]); if (score == "1") { GridView1.Rows[i].Cells[3].Text = "Proved"; } else if (score == "2") { GridView1.Rows[i].Cells[3].Text = "Deny"; } } } } string sql1 = "select * from Member_Information where MemberDepartment='Doctor'"; DataSet ds1 = new DataSet(); ds1 = dataOperate.getDataset(sql1, "Member_Information"); DataView rowview1 = ds1.Tables["Member_Information"].DefaultView; DropDownList3.DataSource = rowview1; DropDownList3.DataValueField = "MemberID"; DropDownList3.DataBind(); this.Label10.Visible = false; this.Label11.Visible = false; } }
protected void DSD_Click(object sender, EventArgs e) { int cont = this.GridView1.Rows.Count; for (int i = 0; i < cont; i++) { CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("CB"); if (cb.Checked == true) { string did = GridView1.Rows[i].Cells[1].Text; string sbt = GridView1.Rows[i].Cells[3].Text; string sqlr = "Delete Appointment_Information where DoctorID='" + did + "' and PatientID='" + Convert.ToString(Session["IDLogin"]) + "' and SubmitTime='" + sbt + "'"; int a = 0; a = dataOperate.SqlENQ(sqlr); if (a > 0 && dataOperate.execSQL(sqlr)) { RegisterStartupScript("", "<script>alert('Delete Successful!')</script>"); } else { RegisterStartupScript("", "<script>alert('Delete failed!')</script>"); } } } string sqlallMember = "select * from Appointment_Information"; this.GridView1.Visible = true; this.Label10.Visible = true; this.Label11.Visible = true; this.Label11.Text = "All"; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Appointment_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; string sql = "select * from Appointment_Information"; if (dataOperate.seleSQL(sql) > 0) { this.GridView1.DataSource = dataOperate.getDataset(sql, "DoctorID"); this.GridView1.DataBind(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { DataSet myds = new DataSet(); myds = dataOperate.getDataset("select * from Appointment_Information where DoctorID='" + GridView1.Rows[i].Cells[1].Text + "' and SubmitTime='" + GridView1.Rows[i].Cells[2].Text + "'", "Appointment_Information"); if (myds.Tables["Appointment_Information"].Rows.Count > 0) { DataRowView mydrv = myds.Tables["Appointment_Information"].DefaultView[0]; string score = Convert.ToString(mydrv["Info"]); if (score == "1") { GridView1.Rows[i].Cells[3].Text = "Proved"; } else if (score == "2") { GridView1.Rows[i].Cells[3].Text = "Deny"; } } } } string sql1 = "select * from Member_Information where MemberDepartment='Doctor'"; DataSet ds1 = new DataSet(); ds1 = dataOperate.getDataset(sql1, "Member_Information"); DataView rowview1 = ds1.Tables["Member_Information"].DefaultView; DropDownList3.DataSource = rowview1; DropDownList3.DataValueField = "MemberID"; DropDownList3.DataBind(); Session["search"] = sqlallMember; }
public ApplicationRecordDataType ShowDialog(IWin32Window owner, IList <ApplicationRecordDataType> records, NodeId defaultRecord) { ApplicationsTable.Rows.Clear(); DataRow selectedRow = null; if (records != null) { foreach (var record in records) { DataRow row = ApplicationsTable.NewRow(); if (selectedRow == null && defaultRecord != null) { if (defaultRecord == record.ApplicationId) { selectedRow = row; } } row[0] = record.ApplicationId; row[1] = (record.ApplicationNames != null && record.ApplicationNames.Count > 0 && !LocalizedText.IsNullOrEmpty(record.ApplicationNames[0]))?record.ApplicationNames[0].Text:String.Empty; row[2] = record.ApplicationType; row[3] = record.ProductUri; StringBuilder buffer = new StringBuilder(); if (record.DiscoveryUrls != null) { foreach (var url in record.DiscoveryUrls) { if (buffer.Length > 0) { buffer.Append(','); } buffer.Append(url); } } row[4] = buffer.ToString(); buffer = new StringBuilder(); if (record.ServerCapabilities != null) { foreach (var id in record.ServerCapabilities) { if (buffer.Length > 0) { buffer.Append(','); } buffer.Append(id); } } row[5] = buffer.ToString(); row[6] = record; ApplicationsTable.Rows.Add(row); } m_dataset.AcceptChanges(); } if (selectedRow != null) { foreach (DataGridViewRow row in ApplicationRecordDataGridView.Rows) { DataRowView source = row.DataBoundItem as DataRowView; if (Object.ReferenceEquals(source.Row, selectedRow)) { row.Selected = true; break; } } } if (base.ShowDialog(owner) != DialogResult.OK) { return(null); } if (ApplicationRecordDataGridView.SelectedRows.Count > 0) { DataRowView source = ApplicationRecordDataGridView.SelectedRows[0].DataBoundItem as DataRowView; return((ApplicationRecordDataType)source.Row[6]); } return(null); }
public void RowFilter() { //note: this test does not check all the possible row filter expression. this is done in DataTable.Select method. // this test also check DataView.Count property DataRowView[] drvResult = null; ArrayList al = new ArrayList(); //create the source datatable DataTable dt = DataProvider.CreateChildDataTable(); //create the dataview for the table DataView dv = new DataView(dt); //------------------------------------------------------------- //Get excpected result al.Clear(); foreach (DataRow dr in dt.Rows) { if ((int)dr["ChildId"] == 1) { al.Add(dr); } } // RowFilter = 'ChildId=1', check count dv.RowFilter = "ChildId=1"; Assert.Equal(al.Count, dv.Count); // RowFilter = 'ChildId=1', check rows drvResult = new DataRowView[dv.Count]; dv.CopyTo(drvResult, 0); //check that the filterd rows exists bool Succeed = true; for (int i = 0; i < drvResult.Length; i++) { Succeed = al.Contains(drvResult[i].Row); if (!Succeed) break; } Assert.Equal(true, Succeed); //------------------------------------------------------------- //------------------------------------------------------------- //Get excpected result al.Clear(); foreach (DataRow dr in dt.Rows) if ((int)dr["ChildId"] == 1 && dr["String1"].ToString() == "1-String1") al.Add(dr); // RowFilter - ChildId=1 and String1='1-String1' dv.RowFilter = "ChildId=1 and String1='1-String1'"; Assert.Equal(al.Count, dv.Count); // RowFilter = ChildId=1 and String1='1-String1', check rows drvResult = new DataRowView[dv.Count]; dv.CopyTo(drvResult, 0); //check that the filterd rows exists Succeed = true; for (int i = 0; i < drvResult.Length; i++) { Succeed = al.Contains(drvResult[i].Row); if (!Succeed) break; } Assert.Equal(true, Succeed); //------------------------------------------------------------- //EvaluateException // RowFilter - check EvaluateException Assert.Throws<EvaluateException>(() => { dv.RowFilter = "Col=1"; }); //SyntaxErrorException 1 // RowFilter - check SyntaxErrorException 1 Assert.Throws<SyntaxErrorException>(() => { dv.RowFilter = "sum('something')"; }); //SyntaxErrorException 2 // RowFilter - check SyntaxErrorException 2 Assert.Throws<SyntaxErrorException>(() => { dv.RowFilter = "HH**!"; }); }
/// <summary> /// Отобразить форму настроек приложения /// </summary> public static void Show(TableView.Item item, DataTable tblInCnl, DataTable tblCtrlCnl, DataTable tblObj, DataTable tblKP) { if (item == null) { throw new ArgumentNullException("item"); } if (tblInCnl == null) { throw new ArgumentNullException("tblInCnl"); } if (tblCtrlCnl == null) { throw new ArgumentNullException("tblCtrlCnl"); } if (tblObj == null) { throw new ArgumentNullException("tblObj"); } if (tblKP == null) { throw new ArgumentNullException("tblKP"); } // создание и перевод формы FrmItemInfo frmItemInfo = new FrmItemInfo(); Translator.TranslateForm(frmItemInfo, "ScadaTableEditor.FrmItemInfo"); // получение информации о входном канале if (item.CnlNum > 0) { string cnlNumStr = item.CnlNum.ToString(); frmItemInfo.txtInCnlNum.Text = cnlNumStr; try { DataView view = new DataView(tblInCnl); view.RowFilter = "CnlNum = " + cnlNumStr; if (view.Count > 0) { DataRowView rowView = view[0]; frmItemInfo.txtInCnlName.Text = (string)rowView["Name"]; int objNum = (int)rowView["ObjNum"]; if (objNum > 0) { frmItemInfo.txtInCnlObjNum.Text = objNum.ToString(); frmItemInfo.txtInCnlObjName.Text = GetObjName(objNum, tblObj); } int kpNum = (int)rowView["KPNum"]; if (kpNum > 0) { frmItemInfo.txtInCnlKPNum.Text = kpNum.ToString(); frmItemInfo.txtInCnlKPName.Text = GetKPName(kpNum, tblKP); } } } catch (Exception ex) { ScadaUiUtils.ShowError(AppPhrases.GetInCnlError + ":\n" + ex.Message); } } // получение информации о канале управления if (item.CtrlCnlNum > 0) { string ctrlCnlNumStr = item.CtrlCnlNum.ToString(); frmItemInfo.txtCtrlCnlNum.Text = ctrlCnlNumStr; try { DataView view = new DataView(tblCtrlCnl); view.RowFilter = "CtrlCnlNum = " + ctrlCnlNumStr; if (view.Count > 0) { DataRowView rowView = view[0]; frmItemInfo.txtCtrlCnlName.Text = (string)rowView["Name"]; int objNum = (int)rowView["ObjNum"]; if (objNum > 0) { frmItemInfo.txtCtrlCnlObjNum.Text = objNum.ToString(); frmItemInfo.txtCtrlCnlObjName.Text = GetObjName(objNum, tblObj); } int kpNum = (int)rowView["KPNum"]; if (kpNum > 0) { frmItemInfo.txtCtrlCnlKPNum.Text = kpNum.ToString(); frmItemInfo.txtCtrlCnlKPName.Text = GetKPName(kpNum, tblKP); } } } catch (Exception ex) { ScadaUiUtils.ShowError(AppPhrases.GetCtrlCnlError + ":\n" + ex.Message); } } // отображение формы frmItemInfo.ShowDialog(); }
protected void gvAuthor_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView drv = (DataRowView)e.Row.DataItem; Label lblIdTemp = (Label)e.Row.FindControl("lblId"); string authorIdStr = lblIdTemp.Text; //string connectionStr = ConfigurationManager.AppSettings.Get("ConnectionString"); string connectionStr = ConfigurationManager.ConnectionStrings["UcccPubMedDB"].ConnectionString; SqlConnection conn = new SqlConnection(connectionStr); string sqlStatement = ""; LinkButton lnkDeleteTemp = (LinkButton)e.Row.FindControl("lnkDelete"); if (lnkDeleteTemp == null) { return; } if (chxAllDate.Checked) { lnkDeleteTemp.Visible = true; sqlStatement = "select count(distinct pa.publication_id) as cnt" + " from publication_author pa" + " where pa.author_id = " + authorIdStr; } else { lnkDeleteTemp.Visible = false; sqlStatement = "select count(distinct pa.publication_id) as cnt" + " from publication_author pa" + " inner join publication_processing pp" + " on pa.publication_id = pp.publication_id" + " and pp.review_editorial is null" + " and ((pp.publication_date >= '" + txtStartDate.Text + "' and pp.publication_date <= '" + txtEndDate.Text + "'))" + " where pa.author_id = " + authorIdStr; /* * sqlStatement = * "select count(distinct pa.publication_id) as cnt" + * " from publication_author pa" + * " inner join publication_processing pp" + * " on pa.publication_id = pp.publication_id" + * " and pp.publication_date >= '" + * txtStartDate.Text + * "' and pp.publication_date <= '" + * txtEndDate.Text + * "' where pa.author_id = " + authorIdStr; * */ } SqlCommand command = new SqlCommand(sqlStatement, conn); conn.Open(); int pubCnt = 0; object maxClientAuthorObj = (object)command.ExecuteScalar(); if (maxClientAuthorObj != DBNull.Value) { pubCnt = Convert.ToInt32(maxClientAuthorObj); } conn.Close(); LinkButton lnkLinkTemp = (LinkButton)e.Row.FindControl("lnkLink"); lnkLinkTemp.Text = pubCnt.ToString(); //Label lblIdTemp = (Label)e.Row.FindControl("lblId"); /* * string currConfirmStr = drv["confirm"].ToString(); * DropDownList ddlConfirmTemp = null; * ddlConfirmTemp = (DropDownList)e.Row.FindControl("ddlConfirm"); * if (ddlConfirmTemp != null) * { * LoadLookup.LoadYesNo(ddlConfirmTemp, currConfirmStr); * } * */ } }
public string getFValue(object v, string name, string format) { object s = null; if (v.GetType() == typeof(DataRowView)) { DataRowView r = (DataRowView)v; s = r[name]; } else if (v is DataRow) { DataRow r = (DataRow)v; s = r[name]; } else if (v is DBObject) { System.Reflection.PropertyInfo propInfo = v.GetType().GetProperty(name); if (propInfo != null) { s = propInfo.GetValue(v, null); } } if (s == null || Convert.IsDBNull(s)) { return(""); } if (db != null) { DBField f = db.getField(name); if (f != null && f.transcoder != null) { s = f.transcoder.fromDB(s); } } Hashtable map = (Hashtable)values[name]; if (map != null && s != null) { object s1 = map[s.ToString()]; if (s1 == null) { try { s1 = map[Convert.ToInt32(s)]; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } if (s1 != null) { s = s1; } } if (string.IsNullOrEmpty(format) && db != null) { DBField field = db.getField(name); if (field != null) { s = field.populateValue(s); } else { s = s.ToString().Trim(); } } else if (s is DateTime) { DateTime dt = (DateTime)s; if (dt.Ticks == 0) { return(""); } if (format != null) { return(((DateTime)s).ToString(format)); } } else if (s is decimal) { if (format != null) { s = ((decimal)s).ToString(format); } } else if (s is double) { if (Double.IsNaN((double)s)) { s = ""; } else if (format != null) { s = ((double)s).ToString(format); } } else if (s is float) { if (float.IsNaN((float)s)) { s = ""; } else if (format != null) { s = ((float)s).ToString(format); } } else if (s is int) { if (format != null) { s = ((int)s).ToString(format); } } else if (s is long) { if (format != null) { s = ((long)s).ToString(format); } } return(HTMLUtils.toHTMLText(s.ToString().Trim())); }
private void PrepareGridView() { DataView dataView = null; if (this._dataView != null) { dataView = this._dataView; } else if (this._bindingSource != null) { DataRowView view2 = (DataRowView)this._bindingSource[0]; dataView = view2.DataView; } this.EmptyControl(); ColumnDataTypes dataType = ColumnDataTypes.NotSupported; this.grdCr.RowHeadersWidth = 100; DataGridViewComboBoxCell cellTemplate = new DataGridViewComboBoxCell(); this.grdCr.Columns.Add(new DataGridViewColumn(cellTemplate)); this.grdCr.Columns[0].Name = "Condition"; DataGridViewTextBoxCell cell3 = new DataGridViewTextBoxCell(); this.grdCr.Columns.Add(new DataGridViewColumn(cell3)); this.grdCr.Columns[1].Name = "Value"; for (int i = 0; i < dataView.Table.Columns.Count; i++) { dataType = this.GetColumnDataType(dataView.Table.Columns[i].DataType.ToString()); this.grdCr.Rows.Add(new object[] { "(none)", String.Empty }); this.grdCr.Rows[i].HeaderCell.Value = dataView.Table.Columns[i].ColumnName; DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)this.grdCr[0, i]; switch (dataType) { case ColumnDataTypes.Text: cell.Items.AddRange(new object[] { "(none)", "=", ">", "<", ">=", "<=", "<>", "Like", "Not Like", "Null", "Not Null" }); cell.Value = "(none)"; cell.MaxDropDownItems = 11; break; case ColumnDataTypes.Integer: cell.Items.AddRange(new object[] { "(none)", "=", ">", "<", ">=", "<=", "<>", "Null", "Not Null" }); cell.Value = "(none)"; cell.MaxDropDownItems = 9; break; case ColumnDataTypes.Float: cell.Items.AddRange(new object[] { "(none)", "=", ">", "<", ">=", "<=", "<>", "Null", "Not Null" }); cell.Value = "(none)"; cell.MaxDropDownItems = 9; break; case ColumnDataTypes.DateTime: cell.Items.AddRange(new object[] { "(none)", "=", ">", "<", ">=", "<=", "<>", "Null", "Not Null" }); cell.Value = "(none)"; cell.MaxDropDownItems = 11; break; case ColumnDataTypes.Boolean: cell.Items.AddRange(new object[] { "(none)", "True", "False", "Null", "Not Null" }); cell.Value = "(none)"; cell.MaxDropDownItems = 5; this.grdCr[1, i].Style.BackColor = SystemColors.GradientInactiveCaption; this.grdCr[1, i].Style.SelectionBackColor = SystemColors.GradientInactiveCaption; this.grdCr[1, i].ReadOnly = true; break; case ColumnDataTypes.NotSupported: cell.Items.AddRange(new object[] { String.Empty }); cell.Value = ""; this.grdCr[0, i].Style.BackColor = SystemColors.GradientInactiveCaption; this.grdCr[0, i].Style.SelectionBackColor = SystemColors.GradientInactiveCaption; this.grdCr[0, i].ReadOnly = true; this.grdCr[1, i].Style.BackColor = SystemColors.GradientInactiveCaption; this.grdCr[1, i].Style.SelectionBackColor = SystemColors.GradientInactiveCaption; this.grdCr[1, i].ReadOnly = true; break; } } this.grdCr.CurrentCell = null; }
public string getValue(object v, string name) { object s = null; if (v is DataRowView) { DataRowView r = (DataRowView)v; s = r[name]; } else if (v is DataRow) { DataRow r = (DataRow)v; s = r[name]; } else if (v is DBObject) { System.Reflection.PropertyInfo propInfo = v.GetType().GetProperty(name); if (propInfo != null) { s = propInfo.GetValue(v, null); } } if (s == null || Convert.IsDBNull(s)) { return(""); } if (db != null) { DBField f = db.getField(name); if (f != null && f.transcoder != null) { s = f.transcoder.fromDB(s); } } Hashtable map = (Hashtable)values[name]; if (map != null && s != null) { object s1 = map[s.ToString()]; if (s1 == null) { try { s1 = map[Convert.ToInt32(s)]; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } if (s1 != null) { s = s1; } } s = s.ToString().Trim(); return(HTMLUtils.toHTMLText(s.ToString())); }
// IZMENI CLICK static void PopuniFormu(DataGrid grid, string selectUslov) { try { konekcija.Open(); azuriraj = true; DataRowView red = (DataRowView)grid.SelectedItems[0]; pomocniRed = red; string upit = selectUslov + red["ID"]; SqlCommand cmd = new SqlCommand(upit, konekcija); SqlDataReader citac = cmd.ExecuteReader(); while (citac.Read()) { if (ucitanaTabela.Equals(filmoviSelect)) { Film prozorFilm = new Film(); prozorFilm.cbZanrFilma.SelectedValue = citac["ZanrFilmaID"].ToString(); prozorFilm.cbLokacija.SelectedValue = citac["LokacijaID"].ToString(); prozorFilm.txtNazivFilma.Text = citac["NazivFilma"].ToString(); prozorFilm.txtOpisFilma.Text = citac["OpisFilma"].ToString(); prozorFilm.txtTrajanje.Text = citac["Trajanje"].ToString(); prozorFilm.txtJezik.Text = citac["Jezik"].ToString(); prozorFilm.dpDatum.SelectedDate = (DateTime)citac["Datum"]; prozorFilm.ShowDialog(); } else if (ucitanaTabela.Equals(zanrFilmaSelect)) { ZanrFilma prozorZanr = new ZanrFilma(); prozorZanr.txtRejting.Text = citac["Rejting"].ToString(); prozorZanr.txtZanr.Text = citac["Zanr"].ToString(); prozorZanr.ShowDialog(); } else if (ucitanaTabela.Equals(zaposleniSelect)) { Zaposleni prozorZaposleni = new Zaposleni(); prozorZaposleni.txtIme.Text = citac["ImeZap"].ToString(); prozorZaposleni.txtPrezime.Text = citac["PrezZap"].ToString(); prozorZaposleni.txtJMBG.Text = citac["JMBG"].ToString(); prozorZaposleni.txtKorisnickoIme.Text = citac["KorisnickoIme"].ToString(); prozorZaposleni.txtLozinka.Text = citac["Lozinka"].ToString(); prozorZaposleni.txtKontakt.Text = citac["KontaktZap"].ToString(); prozorZaposleni.ShowDialog(); } else if (ucitanaTabela.Equals(tipKarteSelect)) { TipKarte prozorTipKarte = new TipKarte(); prozorTipKarte.txtTipKarte.Text = citac["NazivTipaKarte"].ToString(); prozorTipKarte.ShowDialog(); } else if (ucitanaTabela.Equals(lokacijeSelect)) { Lokacija prozorLokacija = new Lokacija(); prozorLokacija.txtAdresa.Text = citac["Adresa"].ToString(); prozorLokacija.txtGrad.Text = citac["Grad"].ToString(); prozorLokacija.ShowDialog(); } else if (ucitanaTabela.Equals(kupciSelect)) { Kupac prozorKupac = new Kupac(); prozorKupac.txtIme.Text = citac["ImeKupca"].ToString(); prozorKupac.txtPrezime.Text = citac["PrezKupca"].ToString(); prozorKupac.txtKontakt.Text = citac["Kontakt"].ToString(); prozorKupac.txtGodine.Text = citac["Godine"].ToString(); prozorKupac.ShowDialog(); } else if (ucitanaTabela.Equals(rezervacijeSelect)) { Rezervacija prozorRezervacija = new Rezervacija(); prozorRezervacija.txtVreme.Text = citac["Vreme"].ToString(); prozorRezervacija.txtMesto.Text = citac["Mesto"].ToString(); prozorRezervacija.txtCenaKarte.Text = citac["CenaKarte"].ToString(); prozorRezervacija.cbKupac.SelectedValue = citac["KupacID"].ToString(); prozorRezervacija.cbZaposleni.SelectedValue = citac["ZaposleniID"].ToString(); prozorRezervacija.cbTipKarte.SelectedValue = citac["TipKarteID"].ToString(); prozorRezervacija.cbFilm.SelectedValue = citac["FilmID"].ToString(); prozorRezervacija.ShowDialog(); } } } catch (ArgumentOutOfRangeException) { MessageBox.Show("Niste selektovali red!", "Greska", MessageBoxButton.OK, MessageBoxImage.Error); } finally { if (konekcija != null) { konekcija.Close(); } azuriraj = false; } }
/// <summary> /// Handels and cell changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks>Created: Werner Scheffer 14/08/2013</remarks> private void grvOpenItem_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { DataRowView FocusedRow = grvOpenItem.GetFocusedRow() as DataRowView; bool rowchecked = false; Boolean.TryParse(e.Value.ToString(), out rowchecked); if (grvOpenItem.FocusedColumn.Equals(colCheck)) { if (rowchecked) { pnlReceiveInto.Enabled = false; //If you change default payment accounts value set the other accounts to Zero if (defaultPaymentAccountColumn == e.Column.FieldName) { foreach (var acc in accountsColumns) { if (FocusedRow[acc.Value] != System.DBNull.Value && acc.Value != defaultPaymentAccountColumn) { FocusedRow[acc.Value] = 0; } } } if (FocusedRow["colTotal"] == System.DBNull.Value) { FocusedRow[defaultPaymentAccountColumn] = Convert.ToDecimal(FocusedRow["Balance"]); } if (FocusedRow["Type"].Equals("BBF")) { FocusedRow["colEntryAging"] = Agings.Where(n => n.Code.Equals(FocusedRow["Aging"])).Select(n => n.Id).FirstOrDefault(); } else if (FocusedRow["Type"].Equals("OI")) { DateTime entryDate = Convert.ToDateTime(FocusedRow["colEntryDate"]); entryDate = entryDate.AddDays(-(entryDate.Day - 1)); DateTime date = Convert.ToDateTime(FocusedRow["Date"]); date = date.AddDays(-(date.Day - 1)); int monthDiff = (int)entryDate.Subtract(date).Days / (365 / 12); if (monthDiff >= 5) { FocusedRow["colEntryAging"] = 5; } else { FocusedRow["colEntryAging"] = monthDiff + 1; } } } else { if (grvOpenItem.FocusedColumn.Equals(colCheck)) { FocusedRow["colEntryAging"] = System.DBNull.Value; } } } else if (grvOpenItem.FocusedColumn.FieldName.Equals("colEntryDate")) { if (FocusedRow["Type"].Equals("BBF")) { DateTime entryDate = Convert.ToDateTime(FocusedRow["colEntryDate"]); entryDate = entryDate.AddDays(-(entryDate.Day - 1)); DateTime date = Convert.ToDateTime(FocusedRow["Date"]); date = date.AddDays(-(date.Day - 1)); int monthDiff = (int)date.Subtract(entryDate).Days / (365 / 12); //Date in the future then dont change aging if (monthDiff <= 0) { FocusedRow["colEntryAging"] = Agings.Where(n => n.Code.Equals(FocusedRow["Aging"])).Select(n => n.Id).FirstOrDefault(); } //If date in the aging range then calculate if (monthDiff > 0 && monthDiff < 5) { FocusedRow["colEntryAging"] = Agings.Where(n => n.Code.Equals(FocusedRow["Aging"])).Select(n => n.Id).FirstOrDefault() - monthDiff; } //If date more than 4 months back then use current if (monthDiff > 4) { FocusedRow["colEntryAging"] = 1; } } else if (FocusedRow["Type"].Equals("OI")) { DateTime entryDate = Convert.ToDateTime(FocusedRow["colEntryDate"]); entryDate = entryDate.AddDays(-(entryDate.Day - 1)); DateTime date = Convert.ToDateTime(FocusedRow["Date"]); date = date.AddDays(-(date.Day - 1)); int monthDiff = (int)entryDate.Subtract(date).Days / (365 / 12); if (monthDiff < 0) { FocusedRow["colEntryAging"] = 1; } else if (monthDiff >= 5) { FocusedRow["colEntryAging"] = 5; } else { FocusedRow["colEntryAging"] = monthDiff + 1; } } } else if (grvOpenItem.FocusedColumn.FieldName.StartsWith("colReceive")) { //If changed cel value is not default payment accounts cell if (defaultPaymentAccountColumn != e.Column.FieldName) { decimal defaultPaymentAccountValue = 0M; foreach (var acc in accountsColumns) { if (acc.Value != defaultPaymentAccountColumn) { defaultPaymentAccountValue += Convert.ToDecimal(FocusedRow[acc.Value] == System.DBNull.Value ? 0 : FocusedRow[acc.Value]); } } if (FocusedRow["colTotal"] == System.DBNull.Value) { FocusedRow[defaultPaymentAccountColumn] = Convert.ToDecimal(FocusedRow["Balance"]); } else { FocusedRow[defaultPaymentAccountColumn] = Convert.ToDecimal(FocusedRow["colTotal"] == System.DBNull.Value ? 0 : FocusedRow["colTotal"]) - defaultPaymentAccountValue; } } } decimal sum = 0M; foreach (var acc in accountsColumns) { sum += Convert.ToDecimal(FocusedRow[acc.Value] == System.DBNull.Value ? 0 : FocusedRow[acc.Value]); } if (sum.Equals(0)) { FocusedRow["colTotal"] = System.DBNull.Value; } else { FocusedRow["colTotal"] = sum; } }
public List <ThamSoBaoCao> GetParameters() { if (!Validation()) { return(null); } GetFormData(); List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>(); if (MaChiNhanh.Equals("%")) { foreach (AutoCompleteEntry item in lstSourceChiNhanh) { string ma = item.KeywordStrings.First(); if (!ma.Equals("%")) { listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); } } } else { listThamSoBaoCao.Add(new ThamSoBaoCao("@MaChiNhanh", MaChiNhanh, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); } if (MaPhongGiaoDich.Equals("%")) { foreach (AutoCompleteEntry item in lstSourcePhongGD_Select) { string ma = item.KeywordStrings.First(); if (!ma.Equals("%")) { listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", ma, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); } } } else { listThamSoBaoCao.Add(new ThamSoBaoCao("@DSPhongGD", MaPhongGiaoDich, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); } if (grNhomTS.SelectedItems.Count > 0) { for (int i = 0; i < grNhomTS.SelectedItems.Count; i++) { DataRowView dr = (DataRowView)grNhomTS.SelectedItems[i]; listThamSoBaoCao.Add(new ThamSoBaoCao("@DSNhom", dr["MA_NHOM"].ToString(), ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); } } listThamSoBaoCao.Add(new ThamSoBaoCao("@LoaiTien", MaLoaiTien, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("@NgayBaoCao", NgayBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("@TuNgay", TuNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("@DenNgay", DenNgay, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("@NguoiGhiSo", ClientInformation.HoTen, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("@MaBaoCao", MaBaoCao, ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("MaNgonNgu", MaNgonNgu, ApplicationConstant.LoaiThamSoBaoCao.LANG.layGiaTri())); listThamSoBaoCao.Add(new ThamSoBaoCao("MaDinhDang", MaDinhDang, ApplicationConstant.LoaiThamSoBaoCao.FORMAT.layGiaTri())); return(listThamSoBaoCao); }
private void LoginSys() { loginname = this.comboBox1.Text; if (loginname == "admin") { DataTable sumret = service.UserService.sumUser(); if (sumret != null && sumret.Rows.Count >= 1) { DialogResult rr = MessageBox.Show("未初始化数据,是否继续?", "操作提示", MessageBoxButtons.YesNo); int tt = (int)rr; if (tt == 7) { return; } } } passw = this.txtPassword.Text; string md5passw = Md5.HashString(passw); //特殊处理下用户名 string username = ""; try { DataRowView dv = comboBox1.Items[comboBox1.SelectedIndex] as DataRowView; username = dv.Row["username"].ToString(); } catch { username = comboBox1.Text; } //用户登录 获取用户的账号和密码并判断 //DataTable ret = service.UserService.UserExists(comboBox1.Text, txtPassword.Text); DataTable ret = service.UserService.UserExists(username, md5passw); if (ret.Rows.Count > 0) { //获取当前登录用户的机构 userCode = ret.Rows[0]["user_code"].ToString(); if (!"admin".Equals(username)) { organCode = ret.Rows[0]["organ_code"].ToString(); if (udao.checkOrganNameBycode(organCode) == null || udao.checkOrganNameBycode(organCode).Rows.Count <= 0) { } else { organName = udao.checkOrganNameBycode(organCode).Rows[0]["organ_name"].ToString(); } } loginname = ret.Rows[0]["username"].ToString(); name = ret.Rows[0]["user_name"].ToString(); user_Name = name; bean.loginLogBean lb = new bean.loginLogBean(); lb.name = name; lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); lb.eventInfo = "登录系统!"; lb.type = "1"; if (lb.name != "admin" && lb.name != "" && lb.name != null) { lls.addCheckLog(lb); } /************/ string fpath = Application.StartupPath + "\\sysstem.ini"; sysstem.UpdateInfo(fpath); string spath = Application.StartupPath + "/log.txt"; FileInfo f = new FileInfo(spath); double fm = f.Length / 1024.0 / 1024.0; if (fm >= 1) //文件大于1M就删除掉 { File.WriteAllText(spath, string.Empty); } /*****end******/ this.Hide(); int m_nWindwMetricsY = GetWindwMetricsY(); Common.m_nWindwMetricsY = m_nWindwMetricsY; if (m_nWindwMetricsY <= 900) { frmMainm main = new frmMainm(); main.Show(); } else { frmMainmm main = new frmMainmm(); main.Show(); } } else { MessageBox.Show("用户名或密码错误!"); } }
private void popControl1_onCurrentChanged(popControl Sender, DataRowView CurrRowView) { this.bindPopReturn(Sender, CurrRowView); this.gridView1.HideEditor(); }
/// <summary> /// 依据传入参数TableName导入数据 /// </summary> protected virtual int ImportData(DataRowView drv) { //double fjlsl = 0; //int cnt = 0, jlsl = 1; //string[] columns = Columns; //string xn = TStar.Web.Globals.SystemSetting.Dqxn; //string xh = drv[columns[0]].ToString(); //string xm = drv[columns[1]].ToString(); //string fzrbh = BLL.Jcgl.JcJs.GetPkid(xh); //string bmbh = TStar.Web.Globals.Account.DeptPkid; //string djbh = null, ztbh = null, xmrq, jzrq, bz = ""; //string zbbh = Djzbmc.Substring(0, 32); //string xmmc = Djzbmc.Substring(32); //if (!BLL.Jcgl.Jc_xs.Exists(bmbh, xh, xm)) throw new Exception("该教师信息不存在。"); //switch (columns.Length) //{ // case 3: // fjlsl = TU.Globals.Parse2Double(drv[columns[2]].ToString(), -1); // if (fjlsl == -1) throw new Exception(columns[2] + "不正确。"); // jlsl = (int)Math.Round(fjlsl); // break; // case 4: // xmmc = drv[columns[3]].ToString(); // if (columns[2].IndexOf("等级") > -1) // { // string filter = "Zbbh='" + TU.Globals.GetParaValue("zb", "") + "'"; // string djmc = drv[columns[2]].ToString(); // djbh = TU.Globals.BindSystemCode(BLL.Globals.SystemCode.DtJd_xmdjLocal, filter, "Djmc", "Pkid", djmc, ""); // if (djbh == "") throw new Exception(columns[2] + "不正确。"); // } // else // { // jlsl = TU.Globals.Parse2Int(drv[columns[2]].ToString(), -1); // if (jlsl == -1) throw new Exception(columns[2] + "不正确。"); // } // break; // case 5: // 教学评价 // fjlsl = TU.Globals.Parse2Double(drv[columns[2]].ToString(), -1); // if (fjlsl == -1) throw new Exception(columns[2] + "不正确。"); // jlsl = (int)Math.Round(fjlsl); // string xs = drv[columns[3]].ToString(); // string zj = drv[columns[4]].ToString(); // bz = String.Format("学生评教分:{0},专家评教分:{1}", xs, String.IsNullOrEmpty(zj) ? "-" : zj); // break; //} //if (BLL.Yjgl.Yj_xm.Exists(xn, bmbh, zbbh, fzrbh, xmmc)) throw new Exception("该教学业绩项目已导入。"); //Model.Yjgl.Yj_xm yj = new Model.Yjgl.Yj_xm(); //DataTable DtXmfp = BLL.Yjgl.Yj_xmfp.CreateDtXmfp(); //if (jlsl != 0) //jlsl > 0 || jlsl < 0 && TableName == "待定扣分") // 数量为0的不导入 //{ // xmrq = "本学年"; // jzrq = TStar.Globals.SystemSettings.DxnJzrq; // yj.Xn = xn; // yj.Bmbh = bmbh; // yj.Zbbh = zbbh; // yj.Djbh = djbh; // yj.Ztbh = ztbh; // yj.Fzrbh = fzrbh; // yj.Fzrxm = xm; // yj.Xmmc = xmmc; // yj.Xmrq = xmrq; // yj.Jzrq = jzrq; // yj.Jlsl = jlsl; // yj.Bz = bz; // yj.Shrbh = TStar.Globals.Account.Pkid; // yj.Bcsj = yj.Shsj = DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00"); // yj.Ztdm = ((int)TStar.Globals.SystemSettings.YjState.PublicityFinished).ToString(); // BLL.Globals.CalculateYjf(yj); //} //if (jlsl == 0 || BLL.Yjgl.Yj_xm.Insert(yj, DtXmfp) > 0) //{ // cnt = 1; // drv["Del"] = 1; //} //return cnt; return(0); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { String temp = null; ZcspBU bu1 = new ZcspBU(); DataRowView dv = e.Row.DataItem as DataRowView; if (dv != null) { DataRow dr = dv.Row; HyperLink link1 = e.Row.FindControl("link1") as HyperLink; if (link1 != null) { link1.Text = JSJ.SysFrame.Util.GetMaxLenth(dr["bname"].ToString().Trim(), 18); if (dr["id"].ToString().Trim() != String.Empty) { link1.NavigateUrl = "~/ZcMng2/ZcBaoDetail1.aspx?id=" + dr["id"].ToString(); link1.ToolTip = "浏览资产包的详细情况"; //link1.Target = "_blank"; } } //计算本金 double benjin = 0; Label lab1 = e.Row.FindControl("benjin") as Label; if (lab1 != null) { temp = dr["bj"].ToString().Replace(",", ""); if (String.IsNullOrEmpty(temp)) { temp = "0"; } benjin = double.Parse(temp); lab1.Text = benjin.ToString("n"); } //计算利息 double lixi = 0; lab1 = e.Row.FindControl("lixi") as Label; if (lab1 != null) { temp = dr["lx"].ToString().Replace(",", ""); if (String.IsNullOrEmpty(temp)) { temp = "0"; } lixi = double.Parse(temp); lab1.Text = lixi.ToString("n"); } //计算总额 lab1 = e.Row.FindControl("zqce") as Label; if (lab1 != null) { lab1.Text = (benjin + lixi).ToString("n"); } DataRow info1 = bu1.GetShenPiInfo("spstatus,spresult,status1,status2 ", dr["id"].ToString(), "2"); //审批状态 lab1 = e.Row.FindControl("spstatus") as Label; if (lab1 != null && dr["id"].ToString().Trim() != String.Empty) { String s1 = String.Empty; if (info1 != null) { s1 = info1["spstatus"].ToString().Trim(); } if (s1 == String.Empty) { s1 = "-1"; } int status1 = int.Parse(s1); if (status1 == -1) { lab1.Text = "<span title='未启动审批'>□</span>"; } if (status1 == 0) { lab1.Text = "<span title='审批中'><font color='blue'>○</font></span>"; } if (status1 == 1) { lab1.Text = "<span title='审核委员会批'><font color='Red'>☆</font></span>"; } if (status1 == 2) { lab1.Text = "<span title='决策委员会批'><font color='Red'>☆☆</font></span>"; } } //执行结果 lab1 = e.Row.FindControl("spresult") as Label; if (lab1 != null && dr["id"].ToString().Trim() != String.Empty) { if (info1 != null) { lab1.Text = info1["spresult"].ToString().Trim(); } } //执行状态 lab1 = e.Row.FindControl("zxzt") as Label; if (lab1 != null && dr["id"].ToString().Trim() != String.Empty) { if (info1 != null) { if (info1["status1"].ToString().Trim() != String.Empty) { temp = info1["status1"].ToString() + "-" + info1["status2"].ToString(); } else { temp = " "; } lab1.Text = temp; } } } }
protected void Button2_Click(object sender, EventArgs e) { string id = DropDownList2.SelectedValue.ToString(); string recordid = record.Text; string xm = xingming.Text; string sqltj1 = "insert into Record_Information(DoctorID,PatientID,RecordID) values('" + Convert.ToString(Session["IDLogin"]) + "','" + id + "','" + recordid + "')"; if (dataOperate.execSQL(sqltj1)) { RegisterStartupScript("", "<script>alert('Add record successful!')</script>"); string sqlallMember = "select * from Record_Information join Authorization_Information on Record_Information.RecordID=Authorization_Information.RecordID and Record_Information.PatientID=Authorization_Information.PatientID join Member_Information on Record_Information.DoctorID=Member_Information.MemberID where Authorization_Information.AuthorizationID='" + Convert.ToString(Session["IDLogin"]) + "'"; DataSet ds = new DataSet(); ds = dataOperate.getDataset(sqlallMember, "Record_Information"); if (ds.Tables["Record_Information"].Rows.Count > 0) { DataRowView rowview = ds.Tables["Record_Information"].DefaultView[0]; this.Label11.Text = rowview["PatientID"].ToString(); this.Label10.Visible = true; this.Label11.Visible = true; ds.Clear(); } this.GridView1.Visible = true; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Record_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; string time = DateTime.Now.ToString(); string sqlvisitation = "insert into Visitation_Information(RecordID,MemberID,Working,Location,Visitation) values('" + recordid + "','" + Convert.ToString(Session["IDLogin"]) + "','Creation, successful','Record','" + time + "')"; dataOperate.execSQL(sqlvisitation); //Response.Write("<script>alert('添加学生成功!');location.href='xuesheng.aspx';</script>"); } else { RegisterStartupScript("", "<script>alert('Sorry,add record failed!')</script>"); string sqlallMember = "select * from Record_Information join Authorization_Information on Record_Information.RecordID=Authorization_Information.RecordID and Record_Information.PatientID=Authorization_Information.PatientID join Member_Information on Record_Information.DoctorID=Member_Information.MemberID where Authorization_Information.AuthorizationID='" + Convert.ToString(Session["IDLogin"]) + "'"; DataSet ds = new DataSet(); ds = dataOperate.getDataset(sqlallMember, "Record_Information"); if (ds.Tables["Record_Information"].Rows.Count > 0) { DataRowView rowview = ds.Tables["Record_Information"].DefaultView[0]; this.Label11.Text = "All"; this.Label10.Visible = true; this.Label11.Visible = true; ds.Clear(); } this.GridView1.Visible = true; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Record_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; string time = DateTime.Now.ToString(); string sqlvisitation = "insert into Visitation_Information(RecordID,MemberID,Working,Location,Visitation) values('" + recordid + "','" + Convert.ToString(Session["IDLogin"]) + "','Creation, successful','Record','" + time + "')"; dataOperate.execSQL(sqlvisitation); } record.Text = ""; this.DropDownList1.DataBind(); this.DropDownList2.DataBind(); string sql3 = " select distinct(PatientID) from Record_Information join Member_Information on Record_Information.PatientID=Member_Information.MemberID where Record_Information.DoctorID='" + Convert.ToString(Session["IDLogin"]) + "' and Member_Information.MemberDepartment='Patient'"; DataSet ds3 = new DataSet(); ds3 = dataOperate.getDataset(sql3, "Record_Information"); DataView rowview3 = ds3.Tables["Record_Information"].DefaultView; DropDownList1.DataSource = rowview3; DropDownList1.DataValueField = "PatientID"; DropDownList1.DataBind(); string sql2 = " select MemberID from Member_Information where MemberDepartment='Patient'"; DataSet ds2 = new DataSet(); ds2 = dataOperate.getDataset(sql2, "Record_Information"); DataView rowview2 = ds2.Tables["Record_Information"].DefaultView; DropDownList2.DataSource = rowview2; DropDownList2.DataValueField = "MemberID"; DropDownList2.DataBind(); }
private void datagridMedicineList_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataRowView row1 = (DataRowView)datagridMedicineList.SelectedItem; a = row1["product_name"].ToString(); }
protected void Button4_Click(object sender, EventArgs e) { string id = mid.Text; string name = xingming.Text; string sqltj1 = "insert into Member_Information(MemberID,MemberName,MemberDepartment) values('" + id + "','" + name + "','Patient')"; if (dataOperate.execSQL(sqltj1)) { RegisterStartupScript("", "<script>alert('Add member successful!')</script>"); string sqlallMember = "select * from Record_Information join Authorization_Information on Record_Information.RecordID=Authorization_Information.RecordID and Record_Information.PatientID=Authorization_Information.PatientID join Member_Information on Record_Information.DoctorID=Member_Information.MemberID where Authorization_Information.AuthorizationID='" + Convert.ToString(Session["IDLogin"]) + "'"; DataSet ds = new DataSet(); ds = dataOperate.getDataset(sqlallMember, "Record_Information"); if (ds.Tables["Record_Information"].Rows.Count > 0) { DataRowView rowview = ds.Tables["Record_Information"].DefaultView[0]; this.Label11.Text = "All Record"; this.Label10.Visible = true; this.Label11.Visible = true; ds.Clear(); } this.GridView1.Visible = true; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Record_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; } else { RegisterStartupScript("", "<script>alert('Sorry,add member failed!')</script>"); string sqlallMember = "select * from Record_Information join Authorization_Information on Record_Information.RecordID=Authorization_Information.RecordID and Record_Information.PatientID=Authorization_Information.PatientID join Member_Information on Record_Information.DoctorID=Member_Information.MemberID where Authorization_Information.AuthorizationID='" + Convert.ToString(Session["IDLogin"]) + "'"; DataSet ds = new DataSet(); ds = dataOperate.getDataset(sqlallMember, "Record_Information"); if (ds.Tables["Record_Information"].Rows.Count > 0) { DataRowView rowview = ds.Tables["Record_Information"].DefaultView[0]; this.Label11.Text = "ALL Record"; this.Label10.Visible = true; this.Label11.Visible = true; ds.Clear(); } this.GridView1.Visible = true; this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Record_Information"); this.GridView1.DataBind(); Session["search"] = sqlallMember; } mid.Text = ""; xingming.Text = ""; this.DropDownList1.DataBind(); this.DropDownList2.DataBind(); string sql3 = " select distinct(PatientID) from Record_Information join Member_Information on Record_Information.PatientID=Member_Information.MemberID where Record_Information.DoctorID='" + Convert.ToString(Session["IDLogin"]) + "' and Member_Information.MemberDepartment='Patient'"; DataSet ds3 = new DataSet(); ds3 = dataOperate.getDataset(sql3, "Record_Information"); DataView rowview3 = ds3.Tables["Record_Information"].DefaultView; DropDownList1.DataSource = rowview3; DropDownList1.DataValueField = "PatientID"; DropDownList1.DataBind(); string sql2 = " select MemberID from Member_Information where MemberDepartment='Patient'"; DataSet ds2 = new DataSet(); ds2 = dataOperate.getDataset(sql2, "Record_Information"); DataView rowview2 = ds2.Tables["Record_Information"].DefaultView; DropDownList2.DataSource = rowview2; DropDownList2.DataValueField = "MemberID"; DropDownList2.DataBind(); }
public void CopyTo() { //create the source datatable DataTable dt = DataProvider.CreateChildDataTable(); //create the dataview for the table DataView dv = new DataView(dt); DataRowView[] drvExpected = null; DataRowView[] drvResult = null; // ------- Copy from Index=0 drvExpected = new DataRowView[dv.Count]; for (int i = 0; i < dv.Count; i++) { drvExpected[i] = dv[i]; } drvResult = new DataRowView[dv.Count]; // CopyTo from index 0 dv.CopyTo(drvResult, 0); Assert.Equal(drvResult, drvExpected); // ------- Copy from Index=3 drvExpected = new DataRowView[dv.Count + 3]; for (int i = 0; i < dv.Count; i++) { drvExpected[i + 3] = dv[i]; } drvResult = new DataRowView[dv.Count + 3]; // CopyTo from index 3 dv.CopyTo(drvResult, 3); Assert.Equal(drvResult, drvExpected); // ------- Copy from Index=3,larger array drvExpected = new DataRowView[dv.Count + 9]; for (int i = 0; i < dv.Count; i++) { drvExpected[i + 3] = dv[i]; } drvResult = new DataRowView[dv.Count + 9]; // CopyTo from index 3,larger array dv.CopyTo(drvResult, 3); Assert.Equal(drvResult, drvExpected); // ------- CopyTo smaller array, check exception drvResult = new DataRowView[dv.Count - 1]; // CopyTo smaller array, check exception Assert.Throws<IndexOutOfRangeException>(() => { dv.CopyTo(drvResult, 0); }); }
protected void rptSHFWCLD_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView)e.Item.DataItem; HyperLink hplTXFA = (HyperLink)e.Item.FindControl("hplTXFA"); Label CLD_SPZT1 = (Label)e.Item.FindControl("CLD_SPZT1"); Label CLD_CLZT = (Label)e.Item.FindControl("CLD_CLZT"); hplTXFA.Visible = false; if (dr["CLD_SPZT"].ToString() == "0") { CLD_SPZT1.Text = "未审批"; CLD_CLZT.Text = "未处理"; } else if (dr["CLD_SPZT"].ToString() == "1y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "审批中"; CLD_SPZT1.BackColor = Color.LightGoldenrodYellow; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "2y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "审批中"; CLD_SPZT1.BackColor = Color.LightGoldenrodYellow; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "4y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "审批中"; CLD_SPZT1.BackColor = Color.LightGoldenrodYellow; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "已通过"; CLD_SPZT1.BackColor = Color.LightGreen; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "1n" || dr["CLD_SPZT"].ToString() == "2n" || dr["CLD_SPZT"].ToString() == "4n" || dr["CLD_SPZT"].ToString() == "5n") { CLD_SPZT1.Text = "未通过"; CLD_SPZT1.BackColor = Color.Red; } else if (dr["CLD_SPZT"].ToString() == "cljg_y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "已通过"; CLD_SPZT1.BackColor = Color.LightGreen; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "fytj_y") { if (username == dr["CLD_CLFA_TXR"].ToString()) { hplTXFA.Visible = true; } CLD_SPZT1.Text = "已通过"; CLD_SPZT1.BackColor = Color.LightGreen; CLD_CLZT.Text = "处理中"; CLD_CLZT.BackColor = Color.LightGoldenrodYellow; } else if (dr["CLD_SPZT"].ToString() == "over") { CLD_SPZT1.Text = "已通过"; CLD_SPZT1.BackColor = Color.LightGreen; CLD_CLZT.Text = "已处理"; CLD_CLZT.BackColor = Color.LightGreen; } } }
private void DuplicateRecord(DataRowView SourceRow, ref DataRowView TargetRow) { _RecordState.DuplicatingData = true; TargetRow.Row.ItemArray = SourceRow.Row.ItemArray; foreach (DataColumn itm in TargetRow.Row.Table.Columns) { if (itm.ReadOnly) { if (itm.AutoIncrement) { TargetRow[itm.ColumnName] = 0; } } } _RecordState.DuplicatingData = false; }
protected void grdList_ItemDataBound(object sender, C1.Web.C1WebGrid.C1ItemEventArgs e) { try { DataRowView DRV = (DataRowView)e.Item.DataItem; HyperLink hlkUserId = ((HyperLink)e.Item.FindControl("hlkCourseNM")); hlkUserId.NavigateUrl = "javascript:;"; //open_course_id hlkUserId.Attributes.Add("onclick", "javascript:GoAppForm('" + DRV["course_id"].ToString() + "^" + DRV["open_course_id"].ToString() + "'); return false;"); HyperLink hlkMan = ((HyperLink)e.Item.FindControl("hlkMAN")); hlkMan.NavigateUrl = "javascript:;"; //open_course_id hlkMan.Attributes.Add("onclick", "javascript:GoConfirmForm('" + DRV["course_id"].ToString() + "^" + DRV["open_course_id"].ToString() + "'); return false;"); if (!Util.IsNullOrEmptyObject(Convert.ToString(DRV["ESS_DUTY_STEP"])) || !Util.IsNullOrEmptyObject(Convert.ToString(DRV["OPT_DUTY_WORK"]))) { if (iDutyStep == null) { iDutyStep = SBROKER.GetTable("CLT.WEB.BIZ.LMS.CURR.vp_c_course_md", "GetDutyStep", LMS_SYSTEM.APPLICATION, "CLT.WEB.UI.LMS.APPLICATION", null); } if (iDutyWork == null) { iDutyWork = SBROKER.GetTable("CLT.WEB.BIZ.LMS.CURR.vp_c_course_md", "GetDutyWork", LMS_SYSTEM.APPLICATION, "CLT.WEB.UI.LMS.APPLICATION", null); } string[] dutySteps = Convert.ToString(DRV["ESS_DUTY_STEP"]).Split(','); Label lblEssStepName = ((Label)e.Item.FindControl("lblEssStepName")); string dutyStep = ""; for (int i = 0; i < dutySteps.Length; i++) { DataRow[] dr = iDutyStep.Select("duty_step='" + dutySteps[i] + "'"); if (!string.IsNullOrEmpty(dutyStep) && dr.Length > 0) { dutyStep += ","; } if (dr.Length > 0) { //국영문 구분에 따른 처리 if (Thread.CurrentThread.CurrentCulture.Name.ToLower() == "ko-kr") { dutyStep += Convert.ToString(iDutyStep.Select("duty_step='" + dutySteps[i] + "'")[0]["step_name"]); } else { dutyStep += Convert.ToString(iDutyStep.Select("duty_step='" + dutySteps[i] + "'")[0]["STEP_ENAME"]); } } } lblEssStepName.Text = dutyStep; string[] dutyWorks = Convert.ToString(DRV["OPT_DUTY_WORK"]).Split(','); string dutyWork = ""; for (int i = 0; i < dutyWorks.Length; i++) { DataRow[] dr = iDutyWork.Select("duty_work='" + dutyWorks[i] + "'"); if (!string.IsNullOrEmpty(dutyWork) && dr.Length > 0) { dutyWork += ", "; } if (dr.Length > 0) { //국영문 구분에 따른 처리 if (Thread.CurrentThread.CurrentCulture.Name.ToLower() == "ko-kr") { dutyWork += Convert.ToString(iDutyWork.Select("duty_work='" + dutyWorks[i] + "'")[0]["duty_work_name"]); } else { dutyWork += Convert.ToString(iDutyWork.Select("duty_work='" + dutyWorks[i] + "'")[0]["DUTY_WORK_ENAME"]); } } } lblEssStepName.Text += dutyWork; } } catch (Exception ex) { base.NotifyError(ex); } }