public void ClearComboData(RadComboBox combo) { if(combo != null && combo.Items != null) { combo.Items.Clear(); } }
public string GetSpreadsheets(Hashtable State, RadComboBox Spreadsheets) { try { SpreadsheetsService service = new SpreadsheetsService(State["SelectedApp"].ToString()); GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("wise", "MobiFlex"); requestFactory.ConsumerKey = ConfigurationManager.AppSettings["GoogleAppsKey"]; requestFactory.ConsumerSecret = ConfigurationManager.AppSettings["GoogleAppsSecret"]; service.RequestFactory = requestFactory; //get all spreadsheets Google.GData.Spreadsheets.SpreadsheetQuery query = new Google.GData.Spreadsheets.SpreadsheetQuery(); query.OAuthRequestorId = State["CustomerEmail"].ToString(); query.Uri = new Uri("https://spreadsheets.google.com/feeds/spreadsheets/private/full?xoauth_requestor_id=" + State["CustomerEmail"].ToString()); SpreadsheetFeed feed = service.Query(query); Spreadsheets.Items.Clear(); Spreadsheets.Items.Add(new RadComboBoxItem("Select Spreadsheet ->", "->")); foreach (SpreadsheetEntry entry in feed.Entries) { string spreadsheet_name = entry.Title.Text; Spreadsheets.Items.Add(new RadComboBoxItem(spreadsheet_name, spreadsheet_name)); } return "OK"; } catch (Exception ex) { Util util = new Util(); util.LogError(State, ex); return ex.Message; } }
// public void cmbCustomerProducts_OnLoad(object sender, EventArgs e) public void cmbCustomerProducts_OnLoad(RadComboBox Box) { using (DataClasses1DataContext dbContext = new DataClasses1DataContext()) { try { if (Session["editableProductId"] != null && !String.IsNullOrEmpty(Session["editableProductId"].ToString())) { string myProductId = Session["editableProductId"].ToString(); Box.Visible = true; var myCustomers = from cust in dbContext.Customer join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId orderby cust.Name ascending select new { CustomerId = cust.Id, CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")", IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == Int32.Parse(myProductId) && q.CustomerId == cust.Id) != null ? true : false }; Box.DataSource = myCustomers; Box.DataBind(); } } catch (Exception ex) { dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product"); throw new Exception(ex.Message); } } }
/// <summary> /// Creates a new <see cref="Home"/> instance. /// </summary> public Home() { InitializeComponent(); this.Title = ApplicationStrings.HomePageTitle; this.domainContext = new SchedulerDomainContext(); this.SelectResource = (Application.Current.RootVisual as MainPage).SelectResource; this.LoadResources(); Scheduler.AppointmentEdited += Scheduler_AppointmentEdited; Scheduler.AppointmentDeleted += Scheduler_AppointmentDeleted; Scheduler.AppointmentCreating += Scheduler_AppointmentCreating; Scheduler.AppointmentEditing += (s, a) => { if (!WebContext.Current.User.IsAuthenticated) { a.Cancel = true; MessageBox.Show("PLease login and try again"); } }; Scheduler.AppointmentDeleting += (s, a) => { if (!WebContext.Current.User.IsAuthenticated) { a.Cancel = true; MessageBox.Show("PLease login and try again"); } }; SelectResource.SelectionChanged += SelectResource_SelectionChanged; this.SelectResource.Visibility = System.Windows.Visibility.Visible; }
public static void FillApstDDL(RadComboBox ddlApst, List<TouristApstInfo> lstTouristApst, int intSelected, int intTerritoryID) { ddlApst.DataSource = lstTouristApst; ddlApst.DataTextField = "TuristApstakli"; ddlApst.DataValueField = "TuristApstakli_ID"; ddlApst.DataBind(); ddlApst.SelectedValue = intSelected.ToString(); }
public int GetSelectedValueOfCombo(RadComboBox combo) { if (combo.Items.Count > 0 && combo.SelectedIndex > 0) { return int.Parse(combo.SelectedValue); } return 0; }
protected void bindComboBox(RadComboBox r, DataSet d) { r.Items.Clear(); r.DataTextField = "AutoSearchResult"; r.DataSource = d; r.DataBind(); r.Items.Insert(0, new RadComboBoxItem("", "0")); r.SelectedValue = "0"; }
private SolidColorBrush GetBrushFromCombo(RadComboBox comboBox) { ColorStringConverter converter = new ColorStringConverter(); SolidColorBrush brush = converter.Convert(comboBox.SelectedItem, typeof(SolidColorBrush), null, System.Globalization.CultureInfo.CurrentUICulture) as SolidColorBrush; return brush; }
protected void onitemrequest(RadComboBox r, DataTable dt, int noofitems) { ipr = dt.Rows.Count; int io = noofitems; int eo = Math.Min(io + ipr, dt.Rows.Count); r.Items.Clear(); for (int i = io; i < eo; i++) { r.Items.Add(new RadComboBoxItem(dt.Rows[i]["AutoSearchResult"].ToString(), dt.Rows[i]["AutoSearchResult"].ToString())); } }
//public override string EvaluateFilterExpression(GridFilteringItem filteringItem) //{ // return base.DataField + "="; //} protected override void SetupFilterControls(TableCell cell) { RadComboBox rcBox = new RadComboBox(); rcBox.ID = "cbxFilter" + base.UniqueName; rcBox.Width = this.ControlWidth; rcBox.AutoPostBack = true; rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged; rcBox.Items.Add(XCombo.CreateEmptyItem()); rcBox.Items.AddRange(this.ItemSource.ToRadComboBoxList()); cell.Controls.Add(rcBox); }
public void PopulateMasterSpeciality(RadComboBox rcbSpeciality) { DataSet dsSpeciality = objSpecialityBAL.SelectMasterSpeciality(); if (dsSpeciality.Tables.Count > 0 && dsSpeciality.Tables[0].Rows.Count > 0) { rcbSpeciality.DataSource = dsSpeciality; rcbSpeciality.DataTextField = "DepartmentName"; rcbSpeciality.DataValueField = "DepartmentId"; rcbSpeciality.DataBind(); } RadComboBoxItem CountryListItem = new RadComboBoxItem("--Select--", "--Select--"); rcbSpeciality.Items.Insert(0, CountryListItem); }
// public void cmbCustomerProducts_OnLoad(object sender, EventArgs e) public void cmbCustomerProducts_OnLoad(RadComboBox Box) { using (DataClasses1DataContext dbContext = new DataClasses1DataContext()) { try { //RadComboBox cmbCustomerProducts = ((RadComboBox)sender); //cmbCustomerProducts.Items.Clear(); //cmbCustomerProducts.Text = string.Empty; if (Session["editableProductId"] != null && Session["editableProductId"].ToString() != string.Empty) { string myProductId = Session["editableProductId"].ToString(); Box.Visible = true; //var myCustomers = from cust in dbContext.Customer // join custProd in dbContext.CustomerProduct on cust.Id equals custProd.CustomerId into JoinedCustProd // from custProd in JoinedCustProd.DefaultIfEmpty() // orderby cust.Name ascending // select new // { // CustomerId = cust.Id, // CustomerName = cust.Name, // IsChecked = custProd.ProductId == new Guid(Session["selectedProductId"].ToString()) ? true : false // }; var myCustomers = from cust in dbContext.Customer join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId orderby cust.Name ascending select new { CustomerId = cust.Id, CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")", IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == new Guid(myProductId) && q.CustomerId == cust.Id) != null ? true : false }; Box.DataSource = myCustomers; Box.DataBind(); //cmbCustomerProducts.DataSource = myCustomers; //cmbCustomerProducts.DataBind(); } } catch (Exception ex) { dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product"); throw new Exception(ex.Message); } } }
//RadGrid will call this method when it initializes the controls inside the filtering item cells protected override void SetupFilterControls(TableCell cell) { base.SetupFilterControls(cell); cell.Controls.RemoveAt(0); RadComboBox combo = new RadComboBox(); combo.ID = ("RadComboBox1" + this.UniqueName); combo.ShowToggleImage = false; combo.EnableLoadOnDemand = true; combo.AutoPostBack = true; combo.MarkFirstMatch = true; combo.Height = Unit.Pixel(100); combo.ItemsRequested += this.list_ItemsRequested; combo.SelectedIndexChanged += this.list_SelectedIndexChanged; cell.Controls.AddAt(0, combo); cell.Controls.RemoveAt(1); }
public void getPaymentCurrency(RadComboBox cbx) { sqlStr = "SELECT * FROM Currency WHERE Active=1 ORDER BY CurrencyID ASC"; sqlCon = new SqlConnection(cnStr); sqlCon.Open(); sqlDA = new SqlDataAdapter(sqlStr, sqlCon); dTable = new DataTable(); sqlDA.Fill(dTable); cbx.DataSource = dTable; cbx.DataTextField = "CurrencyName"; cbx.DataValueField = "CurrencyID"; cbx.DataBind(); sqlCon.Close(); sqlCon.Dispose(); }
public void getComboList_ID_Name(empStatus eStatus, RadComboBox cbx) { sqlStr = "EXEC proc_Get_EmpInfoIdName '" + (int)eStatus + "'"; sqlCon = new SqlConnection(cnStr); sqlCon.Open(); sqlDA = new SqlDataAdapter(sqlStr, sqlCon); dTable = new DataTable(); sqlDA.Fill(dTable); cbx.DataSource = dTable; cbx.DataTextField = "FullName"; cbx.DataValueField = "EmpId"; cbx.DataBind(); sqlCon.Close(); sqlCon.Dispose(); }
public void InitAppPages(Hashtable State, RadComboBox AppPages, bool includeCurrentPage) { AppPages.Items.Clear(); if(State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->")) return; XmlUtil x_util = new XmlUtil(); string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString()); foreach (string page in pages) { if (!includeCurrentPage && State["SelectedAppPage"] != null && State["SelectedAppPage"].ToString() == page) continue; AppPages.Items.Add(new RadComboBoxItem(page, page)); } AppPages.SelectedIndex = 0; }
public void InitAccountList(Hashtable State, RadComboBox Accounts, bool Initialize) { string sql = "SELECT username FROM customers ORDER BY username"; DB db = new DB(); DataRow[] rows = db.ViziAppsExecuteSql(State, sql); Accounts.Items.Clear(); int index = 0; foreach (DataRow row in rows) { string username = row["username"].ToString(); Accounts.Items.Add(new RadComboBoxItem(username,username)); if (Initialize) { if (username == State["Username"].ToString()) Accounts.SelectedIndex = index; index++; } } if (!Initialize) Accounts.Items.Insert(0, new RadComboBoxItem("Select Account ->","Select Account ->")); db.CloseViziAppsDatabase(State); }
protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) { string sql = "SELECT [SupplierID], [CompanyName], [ContactName], [City] FROM [Suppliers] WHERE CompanyName LIKE @CompanyName + '%'"; SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString); adapter.SelectCommand.Parameters.AddWithValue("@CompanyName", e.Text); DataTable dt = new DataTable(); adapter.Fill(dt); RadComboBox comboBox = (RadComboBox)sender; // Clear the default Item that has been re-created from ViewState at this point. comboBox.Items.Clear(); foreach (DataRow row in dt.Rows) { RadComboBoxItem item = new RadComboBoxItem(); item.Text = row["CompanyName"].ToString(); item.Value = row["SupplierID"].ToString(); item.Attributes.Add("ContactName", row["ContactName"].ToString()); comboBox.Items.Add(item); item.DataBind(); } }
protected void Radcombo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { if (ViewState[listOfChanges] != null) { ChangeList = (List <ChangedInfoDTO>)ViewState[listOfChanges]; } else { throw new Exception("Empty ViewState!"); } if (sender is RadComboBox) { RadComboBox drp = (RadComboBox)sender; var olditem = ChangeList.Where(i => i.ControlId == drp.ID + "Value") .First(); olditem.NewValue = drp.SelectedValue; enableScan(olditem.ControlToFieldId); } else { throw new Exception("Invalid Control Binded to Event!"); } }
/// <summary> /// Search for template parts and initialize them. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.combo = this.GetTemplateChild(ComboBoxName) as RadComboBox; var window = this.GetParent <RadWindow>(); if (this.combo != null && window != null) { StyleManager.SetThemeFromParent(this.combo, window); this.combo.ApplyTemplate(); var textBox = this.combo.Template.FindName("PART_EditableTextBox", this.combo) as TextBox; if (textBox != null) { textBox.LostFocus -= this.OnEditableTextBoxLostFocus; textBox.LostFocus += this.OnEditableTextBoxLostFocus; } } this.RebindCombo(); }
public static List<TouristInfo> GetTouristList(int intPolNumber, int intTerritoryID) { var lstTourists = (from oneRow in linqContext.pusT_PolTuristiSaraksts where oneRow.Polises_ID == intPolNumber orderby oneRow.PolTuristiSaraksts select new TouristInfo() { PolTuristiSaraksts = 0, Vards = oneRow.Vards, Uzvards = oneRow.Uzvards, PersKods = oneRow.PersKods, ApdrNemajs = oneRow.ApdrNemajs.Value, Apstaklis_ID = oneRow.Apstaklis_ID.Value, SpecDatumsNo = oneRow.SpecDatumsNo, SpecDatumsLi = oneRow.SpecDatumsLi, Fransize = oneRow.Fransize.Value, PolDarbDienas = oneRow.PolDarbDienas.Value, DzDatums = oneRow.DzDatums, IsResident = oneRow.IsResident, HomeAddress = oneRow.HomeAddress, GuestAddress = oneRow.GuestAddress, IsLegal = oneRow.IsLegal.Value, PassID = oneRow.PassID }).ToList(); int intCount = 0; var ddlAp = new RadComboBox(); foreach (TouristInfo n in lstTourists) { if (!n.Apstaklis_ID.HasValue) n.Apstaklis_ID = 0; var lstTouristApst = GetTouristApstList(intTerritoryID); n.Apstaklis = lstTouristApst.Find(g => g.TuristApstakli_ID == n.Apstaklis_ID).TuristApstakli; n.PolTuristiSaraksts = intCount++; } return lstTourists; }
private void CargarProductos(RadComboBox cmb) { try { List <Producto> listaProducto = new List <Producto>(); Producto prd = new Producto(); prd.Id_Prd = -1; prd.Prd_Descripcion = "-- Seleccionar --"; listaProducto.Add(prd); foreach (DataRow item in dt_detalles.Rows) { prd = new Producto(); prd.Id_Prd = Convert.ToInt32(item["Id_Prd"]); prd.Prd_Descripcion = item.ItemArray[9].ToString(); listaProducto.Add(prd); } cmb.DataSource = listaProducto; cmb.DataBind(); } catch (Exception ex) { throw ex; } }
protected void grdNivelEscolaridades_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; } if (e.Item is GridPagerItem) { RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); PageSizeCombo.Items.Clear(); PageSizeCombo.Items.Add(new RadComboBoxItem("10")); PageSizeCombo.FindItemByText("10").Attributes.Add("ownerTableViewId", grdNivelEscolaridades.MasterTableView.ClientID); PageSizeCombo.Items.Add(new RadComboBoxItem("50")); PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", grdNivelEscolaridades.MasterTableView.ClientID); PageSizeCombo.Items.Add(new RadComboBoxItem("100")); PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", grdNivelEscolaridades.MasterTableView.ClientID); PageSizeCombo.Items.Add(new RadComboBoxItem("500")); PageSizeCombo.FindItemByText("500").Attributes.Add("ownerTableViewId", grdNivelEscolaridades.MasterTableView.ClientID); PageSizeCombo.Items.Add(new RadComboBoxItem("1000")); PageSizeCombo.FindItemByText("1000").Attributes.Add("ownerTableViewId", grdNivelEscolaridades.MasterTableView.ClientID); PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true; } }
private static string ShowCheckedItems(RadComboBox comboBox) { string str = ""; var sb = new StringBuilder(); var collection = comboBox.CheckedItems; if (collection.Count != 0) { // sb.Append("<h3>Checked Items:</h3><ul class=\"results\">"); foreach (var item in collection) { sb.Append(item.Value + ","); } str = sb.ToString(); str = str.Remove(str.Length - 1); } else { str = ""; //comboBox.Items.Clear(); } return(str); }
protected void rdcDispositivoSustituto_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) { if (e.Text == "") { return; } if (rdcDispositivoOriginal.SelectedValue == "") { return; } Dispositivo dispositivoOriginal = CntLainsaSci.GetDispositivo(int.Parse(rdcDispositivoOriginal.SelectedValue), ctx); if (dispositivoOriginal == null) { return; } RadComboBox combo = (RadComboBox)sender; combo.Items.Clear(); foreach (Dispositivo dsp in CntLainsaSci.GetPosiblesSustitutos(e.Text, usuario, dispositivoOriginal, ctx)) { combo.Items.Add(new RadComboBoxItem(CntLainsaSci.GetNomLargoModelo(dsp), dsp.DispositivoId.ToString())); } }
//private void rcbRejectReasonFilter_OnSelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) //{ // ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair()); //} protected void gvWERPTrans_ItemCreated(object sender, GridItemEventArgs e) { string strALL; if (e.Item is GridFilteringItem && dsRejectedRecords != null) { BoundColumn bc = new BoundColumn(); //GridFilteringItem filterItem = (GridFilteringItem)e.Item; RadComboBox rcb = new RadComboBox(); RadComboBoxItem rcbi = new RadComboBoxItem("Select Reject Reason", "0"); rcb = (RadComboBox)e.Item.FindControl("rcbRejectReasonFilter"); rcb.DataSource = dsRejectedRecords.Tables[1]; rcb.DataTextField = "RejectReason"; rcb.DataValueField = "RejectReasonCode"; rcb.DataBind(); rcb.Items.Insert(0, rcbi); } }
private void setCurrency(ref RadComboBox cboCurrency, string Currency) { for (int i = 0; i < cboCurrency.Items.Count; i++) { if (cboCurrency.Items[i].Text.Equals(Currency)) { cboCurrency.SelectedIndex = i; break; } } }
protected void RadButton1_Click(object sender, EventArgs e) { IPediatric PediatricManager; PediatricManager = (IPediatric)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BPediatric, BusinessProcess.Pharmacy"); List <IPharmacyFields> PharmacyList = new List <IPharmacyFields>(); IPharmacyFields objPharmacyFields = new IPharmacyFields(); List <DrugDetails> objlist = new List <DrugDetails>(); DrugDetails objDetails = new DrugDetails(); objPharmacyFields.Ptn_pk = Convert.ToInt32(Request.QueryString["PatientID"]); objPharmacyFields.LocationID = Int32.Parse(Session["AppLocationId"].ToString()); objPharmacyFields.userid = Int32.Parse(Session["AppUserId"].ToString()); objPharmacyFields.ptn_pharmacy_pk = 0; if (PharmWeight.Text != "") { objPharmacyFields.Weight = Convert.ToDecimal(PharmWeight.Text); } if (PharmHeight.Text != "") { objPharmacyFields.Height = Convert.ToDecimal(PharmHeight.Text); } if (ddregimenline.SelectedItem.Value.ToString() != "") { objPharmacyFields.RegimenLine = Convert.ToInt32(ddregimenline.SelectedItem.Value); } objPharmacyFields.PharmacyRefillDate = DateGiven(appdate.SelectedDate.ToString()); if (PharmNotes.Text != "") { objPharmacyFields.PharmacyNotes = PharmNotes.Text; } if (rcbprescribed.SelectedItem.Value != "") { objPharmacyFields.OrderedBy = Convert.ToInt32(rcbprescribed.SelectedItem.Value); } if (prescribedbydate.SelectedDate.ToString() != "") { objPharmacyFields.OrderedByDate = DateGiven(prescribedbydate.SelectedDate.ToString()); } if (rcbdispensed.SelectedItem.Value.ToString() != "") { objPharmacyFields.DispensedBy = Convert.ToInt32(rcbdispensed.SelectedItem.Value.ToString()); } if (dispensedbydate.SelectedDate.ToString() != "") { objPharmacyFields.DispensedByDate = DateGiven(dispensedbydate.SelectedDate.ToString()); } foreach (GridNestedViewItem nestedView in rgdrugmain.MasterTableView.GetItems(GridItemType.NestedView)) { RadGrid gridOrdersGrid = (RadGrid)nestedView.FindControl("OrdersGrid"); DataTable dtupdateOrder = (DataTable)ViewState["TableOrder"]; foreach (GridDataItem item in gridOrdersGrid.Items) { string drugID = item.GetDataKeyValue("DrugID").ToString(); RadTextBox txtdose = (RadTextBox)item.FindControl("txtDose"); RadComboBox ddlfrequency = (RadComboBox)item.FindControl("rdcmbfrequency"); RadTextBox txtduration = (RadTextBox)item.FindControl("txtDuration"); RadTextBox txtqtyprec = (RadTextBox)item.FindControl("txtQtyPrescribed"); CheckBox chkProphylaxis = (CheckBox)item.FindControl("chkProphylaxis"); RadTextBox txtnooffile = (RadTextBox)item.FindControl("txtRefill"); for (int i = 0; i < dtupdateOrder.Rows.Count; i++) { if (dtupdateOrder.Rows[i]["DrugID"].ToString() == drugID) { objDetails.GenericId = Convert.ToInt32(dtupdateOrder.Rows[i]["GenericID"].ToString()); if (txtdose.Text != "") { dtupdateOrder.Rows[i]["Dose"] = Convert.ToDecimal(txtdose.Text); objDetails.SingleDose = Convert.ToDecimal(txtdose.Text); } if (ddlfrequency.SelectedItem.Value.ToString() != "") { dtupdateOrder.Rows[i]["Frequency"] = Convert.ToInt32(ddlfrequency.SelectedItem.Value); objDetails.FrequencyID = Convert.ToInt32(ddlfrequency.SelectedItem.Value);; } if (txtduration.Text != "") { dtupdateOrder.Rows[i]["Duration"] = Convert.ToDecimal(txtduration.Text); objDetails.Duration = Convert.ToDecimal(txtduration.Text); } if (txtqtyprec.Text != "") { dtupdateOrder.Rows[i]["QtyPrescribed"] = Convert.ToDecimal(txtqtyprec.Text); objDetails.OrderedQuantity = Convert.ToDecimal(txtqtyprec.Text); } dtupdateOrder.Rows[i]["Prophylaxis"] = Convert.ToInt32(chkProphylaxis.Checked); if (txtnooffile.Text != "") { dtupdateOrder.Rows[i]["Refill"] = Convert.ToInt32(txtnooffile.Text); } dtupdateOrder.AcceptChanges(); } } } ViewState["TableOrder"] = dtupdateOrder; RadGrid gridDispense = (RadGrid)nestedView.FindControl("Dispense"); DataTable dtDispense = (DataTable)ViewState["TableDispense"]; foreach (GridDataItem item in gridDispense.Items) { string drugID = item.GetDataKeyValue("DrugID").ToString(); RadComboBox ddlbatch = (RadComboBox)item.FindControl("rdcmbbatch"); RadTextBox txtqtydispensed = (RadTextBox)item.FindControl("txtQtyDispensed"); RadTextBox txtsellingprice = (RadTextBox)item.FindControl("txtSellingPrice"); RadTextBox txtbillamt = (RadTextBox)item.FindControl("txtBillAmount"); for (int i = 0; i < dtDispense.Rows.Count; i++) { if (dtDispense.Rows[i]["DrugID"].ToString() == drugID) { if (ddlbatch.SelectedItem.Value.ToString() != "") { dtDispense.Rows[i]["Batch"] = Convert.ToInt32(ddlbatch.SelectedItem.Value); objDetails.BatchNo = Convert.ToInt32(ddlbatch.SelectedItem.Value); } if (txtqtydispensed.Text != "") { dtDispense.Rows[i]["QtyDispensed"] = Convert.ToDecimal(txtqtydispensed.Text); objDetails.DispensedQuantity = Convert.ToDecimal(txtqtydispensed.Text); } if (txtsellingprice.Text != "") { dtDispense.Rows[i]["SellingPrice"] = Convert.ToDecimal(txtsellingprice.Text); } if (txtbillamt.Text != "") { dtDispense.Rows[i]["BillAmount"] = Convert.ToDecimal(txtbillamt.Text); } } } } ViewState["TableDispense"] = dtDispense; objlist.Add(objDetails); } objPharmacyFields.Druginfo = objlist; PharmacyList.Add(objPharmacyFields); //int result = PediatricManager.SaveUpdatePharmacyTouch(PharmacyList); }
protected void rgdrugmain_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem) { ((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible = !e.Item.Expanded; } if (e.CommandName == RadGrid.ExpandCollapseCommandName && !e.Item.Expanded) { GridDataItem parentItem = e.Item as GridDataItem; RadGrid griddispense = parentItem.ChildItem.FindControl("Dispense") as RadGrid; DataTable dtDispense = (DataTable)ViewState["TableDispense"]; foreach (GridDataItem item in griddispense.Items) { string drugID = item.GetDataKeyValue("DrugID").ToString(); RadComboBox ddlbatch = (RadComboBox)item.FindControl("rdcmbbatch"); RadTextBox txtqtydispensed = (RadTextBox)item.FindControl("txtQtyDispensed"); RadTextBox txtsellingprice = (RadTextBox)item.FindControl("txtSellingPrice"); RadTextBox txtbillamt = (RadTextBox)item.FindControl("txtBillAmount"); for (int i = 0; i < dtDispense.Rows.Count; i++) { if (dtDispense.Rows[i]["DrugID"].ToString() == drugID) { if (ddlbatch.SelectedItem.Value.ToString() != "") { dtDispense.Rows[i]["Batch"] = Convert.ToInt32(ddlbatch.SelectedItem.Value); } if (txtqtydispensed.Text != "") { dtDispense.Rows[i]["QtyDispensed"] = Convert.ToDecimal(txtqtydispensed.Text); } if (txtsellingprice.Text != "") { dtDispense.Rows[i]["SellingPrice"] = Convert.ToDecimal(txtsellingprice.Text); } if (txtbillamt.Text != "") { dtDispense.Rows[i]["BillAmount"] = Convert.ToDecimal(txtbillamt.Text); } } } } ViewState["TableDispense"] = dtDispense; griddispense.Rebind(); RadGrid gridorder = parentItem.ChildItem.FindControl("OrdersGrid") as RadGrid; DataTable dtupdateOrder = (DataTable)ViewState["TableOrder"]; foreach (GridDataItem item in gridorder.Items) { string drugID = item.GetDataKeyValue("DrugID").ToString(); RadTextBox txtdose = (RadTextBox)item.FindControl("txtDose"); RadComboBox ddlfrequency = (RadComboBox)item.FindControl("rdcmbfrequency"); RadTextBox txtduration = (RadTextBox)item.FindControl("txtDuration"); RadTextBox txtqtyprec = (RadTextBox)item.FindControl("txtQtyPrescribed"); CheckBox chkProphylaxis = (CheckBox)item.FindControl("chkProphylaxis"); RadTextBox txtnooffile = (RadTextBox)item.FindControl("txtRefill"); for (int i = 0; i < dtupdateOrder.Rows.Count; i++) { if (dtupdateOrder.Rows[i]["DrugID"].ToString() == drugID) { if (txtdose.Text != "") { dtupdateOrder.Rows[i]["Dose"] = Convert.ToDecimal(txtdose.Text); } if (ddlfrequency.SelectedItem.Value.ToString() != "") { dtupdateOrder.Rows[i]["Frequency"] = Convert.ToInt32(ddlfrequency.SelectedItem.Value); } if (txtduration.Text != "") { dtupdateOrder.Rows[i]["Duration"] = Convert.ToDecimal(txtduration.Text); } if (txtqtyprec.Text != "") { dtupdateOrder.Rows[i]["QtyPrescribed"] = Convert.ToDecimal(txtqtyprec.Text); } dtupdateOrder.Rows[i]["Prophylaxis"] = Convert.ToInt32(chkProphylaxis.Checked); if (txtnooffile.Text != "") { dtupdateOrder.Rows[i]["Refill"] = Convert.ToInt32(txtnooffile.Text); } dtupdateOrder.AcceptChanges(); } } } ViewState["TableOrder"] = dtupdateOrder; gridorder.Rebind(); } RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "JumpToGrid", "document.location = '#sGrid';", true); }
//*** //*** RadGridBoxes_ItemCreated protected void RadGridBoxes_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { string role_id = getRoleID(); CheckSession(); if (e.Item is GridEditableItem && e.Item.IsInEditMode) { RadGridBoxes.MasterTableView.GetColumn("nextStep").Display = false; RadGridBoxes.MasterTableView.GetColumn("Print").Display = false; GridEditableItem item = (GridEditableItem)e.Item; RadComboBox item_idRCB = (RadComboBox)item.FindControl("item_idRCB"); RequiredFieldValidator item_idRFV = (RequiredFieldValidator)item.FindControl("item_idRFV"); Label item_idLBL1 = (Label)item.FindControl("item_idLBL1"); Label startLBL = (Label)item.FindControl("startLBL"); if (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem) { // insert item item_idRCB.Visible = true; item_idRFV.Enabled = true; item_idLBL1.Visible = false; startLBL.Visible = false; ArrayList fields = new ArrayList(); fields.Add("item_id"); fields.Add("item_name"); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("active", "true"); using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); item_idRCB.DataSource = Controller.SelectFrom(cmd, con, "CNRS_Item", fields, conditions, new ArrayList(), false, false, ""); } } } else { // edit item GridEditableItem editItem = (GridEditableItem)e.Item; RadDatePicker edit_po_dateRDP = ((RadDatePicker)editItem.FindControl("po_dateRDPTXT")); item_idRCB.Visible = false; item_idRFV.Enabled = false; item_idLBL1.Visible = true; startLBL.Visible = true; if (role_id != "1" && role_id != "2") // != admin and != client { edit_po_dateRDP.Enabled = false; } else { edit_po_dateRDP.Enabled = true; } } //RadDatePicker po_dateRDP = (RadDatePicker)item.FindControl("po_dateRDP"); //po_dateRDP.SelectedDate = DateTime.Now; } if (e.Item is GridDataItem) { if (role_id == "6") // Technical Officer { GridDataItem ditem = (GridDataItem)e.Item; Label po_date_end_technicalOfficerLBL = (Label)ditem.FindControl("po_date_end_technicalOfficerLBL"); CheckBox po_date_end_technicalOfficerRCB = (CheckBox)ditem.FindControl("po_date_end_technicalOfficerRCB"); if (po_date_end_technicalOfficerLBL.Text != "") { po_date_end_technicalOfficerLBL.Visible = true; po_date_end_technicalOfficerRCB.Visible = false; } else { po_date_end_technicalOfficerLBL.Visible = false; po_date_end_technicalOfficerRCB.Visible = true; } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
protected void orderItemGrid_ItemDataBound(object sender, GridItemEventArgs e) { RadComboBox reasons = null; if (e.Item is GridEditableItem) { GridEditableItem editedItem = e.Item as GridEditableItem; DataRowView r = (DataRowView)editedItem.DataItem; Label lbllastActivity = (Label)editedItem.FindControl("last_activity"); reasons = (RadComboBox)editedItem.FindControl("Action_RadComboBox"); if (r["last_changed_dtm"] != DBNull.Value) { DateTime statusChanged = Convert.ToDateTime(r["last_changed_dtm"]); TimeSpan ts = DateTime.Now.Subtract(statusChanged); string timeInStatus = ""; if (ts.Days == 0 && ts.Hours == 0) { timeInStatus = string.Format("{0} minutes", ts.Minutes); } else if (ts.Days == 0) { timeInStatus = string.Format("{0}h {1}m", ts.Hours, ts.Minutes); } else { timeInStatus = string.Format("{0}d {1}h {2}m", ts.Days, ts.Hours, ts.Minutes); } lbllastActivity.Text = timeInStatus; } reasons.Items.Insert(0, new RadComboBoxItem("Please select", "0")); if (r["editable"].ToString() == "N") { ImageButton editLink = (ImageButton)editedItem["EditCommandColumn"].Controls[0]; editLink.Visible = false; reasons.Visible = false; } } if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) { GridEditableItem editedItem = e.Item as GridEditableItem; reasons = (RadComboBox)editedItem.FindControl("Action_RadComboBox"); DataView reasonsSource = _orderDao.GetReasons((int)EventType.Cancellation); reasons.DataSource = reasonsSource; reasons.DataTextField = "short_description"; reasons.DataValueField = "reason_id"; reasons.DataBind(); reasons.Items.Insert(0, new RadComboBoxItem("", "0")); } }
public static RadComboBox SetLocationList(RadComboBox ddl, List <BusinessLocation> locationList, decimal plantID) { return(SetLocationList(ddl, locationList, plantID, false)); }
private void loadChargeAcc(string PartyCharged, string ChargeCurrency, ref RadComboBox cboChargeAcc) { if (PartyCharged.ToUpper().Equals("A") || PartyCharged.ToUpper().Equals("AC")) { bc.Commont.initRadComboBox(ref cboChargeAcc, "Display", "Id", bd.IssueLC.ImportLCPaymentChargeAcc(PartyCharged, txtCustomerID.Value, ChargeCurrency)); cboChargeAcc.Text = ""; } else { RadComboBoxItem it = cboNostroAcct.Items[cboNostroAcct.SelectedIndex]; cboChargeAcc.Items.Clear();//"Description", "AccountNo" cboChargeAcc.Items.Add(new RadComboBoxItem(it.Text, it.Value)); } }
protected void btnSubmitForm_Click(object sender, EventArgs e) { if (Page.IsValid) { // Check for Financial Year Lock <<<<<<<<<<<<<<< iBiz.FinPro.FinYears finyear = new iBiz.FinPro.FinYears(); if (!finyear.isLock(Convert.ToDateTime(tbDate.Text))) { iBiz.FinPro.Transactions.Groups bTransGroup = new iBiz.FinPro.Transactions.Groups(); iBiz.FinPro.Transactions.Transact bTrans = new iBiz.FinPro.Transactions.Transact(); iBiz.FinPro.Transactions.Transact.objTransaction objTrans; iBiz.FinPro.Transactions.Groups.objGroup objTransGroup = new iBiz.FinPro.Transactions.Groups.objGroup(); iBiz.FinPro.Accounts bAcc = new iBiz.FinPro.Accounts(); int defaultDept = Convert.ToInt32(ddlDefautlDept.SelectedValue); int itemsCount = 0; decimal totalAmount = 0; //decimal totalCredit = 0; //decimal uTotalDebit = 0; //decimal uTotalCredit = 0; bool hasNoDepartment = false; int finYear = DateTime.Now.Year; DateTime selectedDate = DateTime.Now; if (selectedDate.Month < 6) { finYear = finYear - 1; } DateTime financialYear = Convert.ToDateTime("07/01/" + finYear.ToString()); bTrans.Delete_Untagged(thisUser); if (rptVoucherItems.Items.Count > 0) { foreach (RepeaterItem item in rptVoucherItems.Items) { foreach (Control ctrlItem in item.Controls) { if (ctrlItem is HiddenField) { if (ctrlItem.ClientID.ToLower().Contains("hfitemno")) { string itemNo, transId, drAccountId, crAccountId, deptId, description, additionalTransId, amount; HiddenField hfINo = (HiddenField)ctrlItem; RadComboBox ddlDebitAccounts = (RadComboBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlDebitAccounts")); RadComboBox ddlCreditAccounts = (RadComboBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlCreditAccount")); DropDownList ddlDepts = (DropDownList)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlDept")); TextBox tbDescription = (TextBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "tbDescription")); TextBox tbAmount = (TextBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "tbAmount")); HiddenField hfTransId = (HiddenField)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "hfTransID")); HiddenField hfAdditionalTransId = (HiddenField)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "hfAdditionalTransId")); iBiz.FinPro.Accounts.objAccount objAcc = new iBiz.FinPro.Accounts.objAccount(); itemNo = hfINo.Value; transId = hfTransId.Value; drAccountId = ddlDebitAccounts.SelectedValue != null ? ddlDebitAccounts.SelectedValue : ""; crAccountId = ddlCreditAccounts.SelectedValue != null ? ddlCreditAccounts.SelectedValue : ""; deptId = ddlDepts.SelectedValue; description = tbDescription.Text; amount = tbAmount.Text; additionalTransId = hfAdditionalTransId.Value; decimal transAmount = 0; decimal.TryParse(amount, out transAmount); if (transAmount > 0) { if (transId != "0") { // Delete existing trans if (iBiz.FinPro.Rights.edit_vouchar) { bTrans.Delete(Convert.ToInt32(transId)); } } if (hasNoDepartment || (Convert.ToInt32(deptId) <= 0 && defaultDept == 0)) { hasNoDepartment = true; } //Check for Additional Trans if (!string.IsNullOrEmpty(additionalTransId)) { if (additionalTransId != "0") { iBiz.FinPro.Modules.AdditionalTransactions bAdditionalTrans = new iBiz.FinPro.Modules.AdditionalTransactions(); bAdditionalTrans.Do_Transactions_For_Predefined(0, Convert.ToInt32(additionalTransId), transAmount, "Description", transAmount, moduleId, financialYear, selectedDate, thisUser, Convert.ToInt32(deptId)); } } if (!string.IsNullOrEmpty(drAccountId)) { if (Convert.ToInt32(drAccountId) > 0) { //Debit Transaction objTrans = new iBiz.FinPro.Transactions.Transact.objTransaction(); objTrans.transAmount = transAmount; objTrans.transDrAccount = Convert.ToInt32(drAccountId); objTrans.transCrAccount = null; objTrans.transSystemRestrict = false; objTrans.transCreatedBy = thisUser; objTrans.transCreatedOn = DateTime.Now; objTrans.transGroupID = 0; objTrans.transIsCompound = true; objTrans.transNarration = description; objTrans.transStatus = 1; objTrans.transSystemIndex = 1; objTrans.deptId = Convert.ToInt32(deptId); if (deptId == "0") { objTrans.deptId = defaultDept; } objTrans.transType = 1; objTrans.transUpdatedBy = thisUser; objTrans.transUpdatedOn = DateTime.Now; bTrans.Add(objTrans); itemsCount++; } } if (!string.IsNullOrEmpty(crAccountId)) { if (Convert.ToInt32(crAccountId) > 0) { //Credit Transaction objTrans = new iBiz.FinPro.Transactions.Transact.objTransaction(); objTrans.transAmount = transAmount; objTrans.transDrAccount = null; objTrans.transCrAccount = Convert.ToInt32(crAccountId); objTrans.transSystemRestrict = false; objTrans.transCreatedBy = thisUser; objTrans.transCreatedOn = DateTime.Now; objTrans.transGroupID = 0; objTrans.transIsCompound = true; objTrans.transNarration = description; objTrans.transStatus = 1; objTrans.transSystemIndex = 1; objTrans.deptId = Convert.ToInt32(deptId); if (deptId == "0") { objTrans.deptId = defaultDept; } objTrans.transType = 1; objTrans.transUpdatedBy = thisUser; objTrans.transUpdatedOn = DateTime.Now; bTrans.Add(objTrans); totalAmount += Convert.ToDecimal(amount); itemsCount++; } } } else { // Delete existing trans if (iBiz.FinPro.Rights.edit_vouchar) { bTrans.Delete(Convert.ToInt32(transId)); } } } } } } if (itemsCount > 0) { int groupID = 0; if (true) { if (!hasNoDepartment) { string fullVoucharNo = "N/A"; objTransGroup.transGroupCreatedBy = thisUser; objTransGroup.transGroupCreatedOn = selectedDate; objTransGroup.transGroupForeNumber = bTransGroup.New_Group_Fore_Number(moduleId, short_Title, objTransGroup.transGroupCreatedOn); objTransGroup.transGroupPrefixNo = moduleId; objTransGroup.transGroupPrefixString = short_Title; objTransGroup.transGroupStatus = 1; objTransGroup.transGroupTitle = tbDescription.Text.Trim(); objTransGroup.transGroupTotalAmount = totalAmount; objTransGroup.transTransCount = itemsCount; objTransGroup.transGroupIsOfficial = 1; objTransGroup.transGroupOfficialTotalAmount = totalAmount; objTransGroup.transGroupRefId = tbRefId.Text; objTransGroup.transCField1 = tbCustomValue1.Text; objTransGroup.transCField2 = tbCustomValue2.Text; objTransGroup.transCField3 = tbCustomValue3.Text; objTransGroup.transCField4 = tbCustomValue4.Text; fullVoucharNo = objTransGroup.transGroupPrefixNo.ToString() + short_Title + objTransGroup.transGroupForeNumber.ToString(); groupID = bTransGroup.Add(objTransGroup).Value; // Upload Attachments iBiz.FinPro.Transactions.Attachments bTransAtt = new iBiz.FinPro.Transactions.Attachments(); if (groupID > 0) { if (radSyncAttachments.UploadedFiles.Count > 0) { for (int i = 0; i < radSyncAttachments.UploadedFiles.Count; i++) { string guid = Guid.NewGuid().ToString(); string fileExt = radSyncAttachments.UploadedFiles[i].GetExtension(); radSyncAttachments.UploadedFiles[i].SaveAs(Server.MapPath("~/Attachments/") + guid + fileExt, true); iBiz.FinPro.Transactions.Attachments.objAttachment objTranAtt = new iBiz.FinPro.Transactions.Attachments.objAttachment(); objTranAtt.attachmentMaskedFileName = guid + fileExt; objTranAtt.attachmentOriginalFileName = radSyncAttachments.UploadedFiles[i].FileName; objTranAtt.transGroupID = groupID; bTransAtt.Add(objTranAtt); } } } bTrans.Update_Group(thisUser, 0, groupID); bTrans.Update_Group(thisUser, -1, groupID); rnNotify.Show("Vouchar has been Created.<br /><br />Vouchar No. is " + fullVoucharNo + "<br /><br />"); // Look for Additional Items iBiz.FinPro.Modules.AdditionalTransactions bAT = new iBiz.FinPro.Modules.AdditionalTransactions(); ControlCollection ctrlAdditionalItems = rptVoucherItems.Controls[rptVoucherItems.Controls.Count - 1].Controls; foreach (Control ctrlItem in ctrlAdditionalItems) { if (ctrlItem.ClientID.Contains("rptAdditionalItems")) { Repeater rptAdditionalItems = (Repeater)ctrlItem; foreach (RepeaterItem item in rptAdditionalItems.Items) { foreach (Control ctrlHFID in item.Controls) { if (ctrlHFID is HiddenField) { if (ctrlHFID.ClientID.Contains("hfAdditionalTransId")) { HiddenField hfAdditionalItem = (HiddenField)ctrlHFID; TextBox tbAdditionalDescription = (TextBox)Form.FindControl(hfAdditionalItem.UniqueID.Replace("hfAdditionalTransId", "tbAdditionalDescription")); TextBox tbAdditionalAmount = (TextBox)Form.FindControl(hfAdditionalItem.UniqueID.Replace("hfAdditionalTransId", "tbAddiotionalAmount")); decimal additionalAmount; if (decimal.TryParse(tbAdditionalAmount.Text.Trim().Replace("%", ""), out additionalAmount)) { bAT.Do_Transactions(groupID, Convert.ToInt32(hfAdditionalItem.Value), additionalAmount, tbAdditionalDescription.Text, totalAmount, selectedDate, thisUser); } } } } } } } } else { bTrans.Delete_Untagged(thisUser); rnNotify.Show("You must assign department to all items."); } } } else { //imbalanced Debit and Credit bTrans.Delete_Untagged(thisUser); if (itemsCount == 0) { bTrans.Delete_Untagged(thisUser); rnNotify.Show("No valid transaction found."); } else { bTrans.Delete_Untagged(thisUser); rnNotify.Show("Debit and Credit sides are not equal."); } } } } else { rnNotify.Show("Financial year is locked."); } } }
protected void Page_Load(object sender, EventArgs e) { foreach (Control cntrl in this.Controls) { string ControlName = cntrl.GetType().Name; if (ControlName == "RadTextBox") { RadTextBox TheCont = (RadTextBox)cntrl; if (!TheCont.ID.Contains("ZZZ")) { if (int.Parse(TheCont.Width.Value.ToString()) < 200) { TheCont.Width = 200; } } } else if (ControlName == "RadComboBox") { RadComboBox TheCont = (RadComboBox)cntrl; if (int.Parse(TheCont.Width.Value.ToString()) < 200) { TheCont.Width = 200; } } else if (ControlName == "RadDatePicker") { RadDatePicker TheCont = (RadDatePicker)cntrl; TheCont.Calendar.ShowRowHeaders = false; if (int.Parse(TheCont.Width.Value.ToString()) < 200) { TheCont.Width = 200; } } else if (ControlName == "UpdatePanel") { UpdatePanel TheCont = (UpdatePanel)cntrl; CheckControlCollection(TheCont); } else if (ControlName == "RadSplitter") { RadSplitter TheCont = (RadSplitter)cntrl; foreach (Control radpane in TheCont.Controls) { if (radpane.GetType().Name == "RadPane") { RadPane thePane = (RadPane)radpane; foreach (Control paneItiem in thePane.Controls) { if (paneItiem.GetType().Name == "UpdatePanel") { UpdatePanel ThePanel = (UpdatePanel)paneItiem; CheckControlCollection(ThePanel); } } } } //UpdatePanel TheCont = (UpdatePanel)cntrl; //CheckControlCollection(TheCont); } } System.Threading.Thread.Sleep(1000); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "loadpharm", "$(function(){parent.CloseLoading(); });", true); }
protected void LoadChargeAcct(ref RadComboBox cboChargeAcct, string ChargeCcy) { bc.Commont.initRadComboBox(ref cboChargeAcct, "Display", "Id", bd.SQLData.B_BDRFROMACCOUNT_GetByCurrency(txtBeneficiaryName.Text, ChargeCcy)); }
protected void UpdateCustomerProductsTabel(RadComboBox cmbCustomerProduct, string productId) { using (DataClasses1DataContext dbContext = new DataClasses1DataContext(((Guid)Session["CurrentUserId"]))) { foreach (RadComboBoxItem Item in cmbCustomerProduct.Items) { if (!String.IsNullOrEmpty(Item.Value)) { var CustProdRelation = dbContext.CustomerProduct.SingleOrDefault(q => q.CustomerId == new Guid(Item.Value) && q.ProductId == new Guid(productId)); if (CustProdRelation != null) // exists { if (Item.Checked) //checked and exists - nothing { } else // exits, but not checked - delete { dbContext.CustomerProduct.DeleteOnSubmit(CustProdRelation); } } else //not exists { if (Item.Checked) //checked and not exists - insert { CustomerProduct newCustProd = new CustomerProduct { CustomerId = new Guid(Item.Value), ProductId = new Guid(productId) }; dbContext.CustomerProduct.InsertOnSubmit(newCustProd); } else // not exists and not checked - nothing { // dbContext.CustomerProduct.DeleteOnSubmit(CustProdRelation); } } dbContext.SubmitChanges(); } } } }
public static void EnableControls(ControlCollection controlCollection, bool enable) { string controlName; string controlType; foreach (Control control in controlCollection) { controlName = control.ID; controlType = control.GetType().ToString(); controlType = controlType.Substring(controlType.LastIndexOf('.') + 1); if (controlName != null) { switch (controlType) { case "LinkButton": LinkButton lbtn = (LinkButton)control; if (enable) { lbtn.CssClass = "buttonLink"; } else { lbtn.CssClass = "optNavDisable"; } lbtn.Enabled = enable; break; case "Button": Button btn = (Button)control; btn.Enabled = enable; break; case "TextBox": TextBox tb = (TextBox)control; // tb.Enabled = enable; if (!enable) { tb.ReadOnly = true; } else { tb.ReadOnly = false; tb.Enabled = true; } break; case "CheckBox": CheckBox cb = (CheckBox)control; cb.Enabled = enable; break; case "RadComboBox": RadComboBox cdl = (RadComboBox)control; cdl.Enabled = enable; break; case "RadDatePicker": RadDatePicker rd = (RadDatePicker)control; //rd.Calendar.Visible = false; // rd.DateInput.ReadOnly = true; rd.Enabled = enable; break; case "DropDownList": DropDownList ddl = (DropDownList)control; ddl.Enabled = enable; break; case "ListBox": ListBox lx = (ListBox)control; if (enable) { lx.Attributes.Remove("disabled"); } else { lx.Attributes.Add("disabled", "true"); } break; case "GridView": GridView gv = (GridView)control; // gv.Enabled = enable; EnableControls(gv.Controls, enable); break; case "rb": RadioButtonList rb = (RadioButtonList)control; rb.Enabled = enable; break; default: break; } } if (control.HasControls()) { EnableControls(control.Controls, enable); } } }
private void calculateTaxAmt(RadNumericTextBox txtChargeAmt, RadComboBox cboPartyCharged, ref RadNumericTextBox txtTaxAmt, ref RadTextBox txtTaxCode) { txtTaxAmt.Text = ""; txtTaxCode.Text = ""; if (txtChargeAmt.Value.HasValue) { //Khong tinh VAT theo y/c nghiep vu ! //[9/10/2014 10:01:06 PM] Nguyen - Viet Victory: Neu Party Charge la: A hoac B thi Xuat phieu VAT (Charge Phi + 10%VAT) //[9/10/2014 10:01:27 PM] Nguyen - Viet Victory: Neu Party Charge la: AC hoac BC thi KHONG Xuat phieu VAT (Charge Phi) /*switch (cboPartyCharged.SelectedValue) { case "A": case "B": txtTaxAmt.Text = String.Format("{0:C}", txtChargeAmt.Value.Value * VAT).Replace("$", ""); txtTaxCode.Text = "81 10% VAT on Charge"; break; default: //txtTaxAmt.Text = String.Format("{0:C}", txtChargeAmt.Value.Value).Replace("$", ""); break; }*/ } //Tính toán lại Amount Credited if (txtDrawingAmount.Value.HasValue) { double AmountCredited = txtDrawingAmount.Value.Value; calculateAmountCredited(tabCableCharge_txtChargeAmt.Value, tabCableCharge_cboPartyCharged.SelectedValue, tabCableCharge_txtTaxAmt.Text, ref AmountCredited); calculateAmountCredited(tabPaymentCharge_txtChargeAmt.Value, tabPaymentCharge_cboPartyCharged.SelectedValue, tabPaymentCharge_txtTaxAmt.Text, ref AmountCredited); calculateAmountCredited(tabHandlingCharge_txtChargeAmt.Value, tabHandlingCharge_cboPartyCharged.SelectedValue, tabHandlingCharge_txtTaxAmt.Text, ref AmountCredited); calculateAmountCredited(tabDiscrepenciesCharge_txtChargeAmt.Value, tabDiscrepenciesCharge_cboPartyCharged.SelectedValue, tabDiscrepenciesCharge_txtTaxAmt.Text, ref AmountCredited); calculateAmountCredited(tabOtherCharge_txtChargeAmt.Value, tabOtherCharge_cboPartyCharged.SelectedValue, tabOtherCharge_txtTaxAmt.Text, ref AmountCredited); txtAmountCredited.Value = AmountCredited; numAmount.Value = AmountCredited; numAmount_MT400.Value = AmountCredited; } }
public static void Search(RadComboBox rcb_search, String SearchExpr, String UserID, bool CompaniesOnly = false, String CustomOnClientClick = "", bool FromLeads = false) { if (HttpContext.Current.User.Identity.IsAuthenticated) { rcb_search.Items.Clear(); // Get and clean search term String search_term = SearchExpr; search_term = search_term.Replace("+", String.Empty); // for phone number search if (search_term == String.Empty) { // Add empty separator RadComboBoxItem break_item = new RadComboBoxItem(); break_item.IsSeparator = true; break_item.Controls.Add(new System.Web.UI.WebControls.Label() { Text = "Type to search for Companies and Contacts.." }); rcb_search.Items.Add(break_item); } else { String radopen = "rwm_master_radopen"; if (FromLeads) { radopen = "rwm_radopen"; } String qry = "SELECT cpy.CompanyID, cpy.Country, cpy.Industry, CONCAT(cpy.CompanyName,' (',COUNT(ctc.ContactID),')') as 'CompanyName' FROM (SELECT CompanyID, CompanyName, Country, Industry " + "FROM db_company WHERE ((CONCAT(CompanyName,' ',IFNULL(Country,'')) LIKE @s AND CompanyName IS NOT NULL AND TRIM(CompanyName) != '' AND CompanyNameClean!='unknown') OR (CONCAT(TRIM(IFNULL(PhoneCode,'')),TRIM(REPLACE(Phone,' ',''))) LIKE @s)) " + "AND Source NOT LIKE 'db_tmp%' LIMIT 10) as cpy LEFT JOIN db_contact ctc ON cpy.CompanyID = ctc.CompanyID GROUP BY cpy.CompanyID ORDER BY cpy.CompanyName, cpy.Country"; DataTable dt_companies = SQL.SelectDataTable(qry, "@s", search_term + "%"); //"%" + search_term + "%" qry = "SELECT ContactID, TRIM(CONCAT(CASE WHEN FirstName IS NULL THEN '' ELSE CONCAT(TRIM(FirstName), ' ') END, CASE WHEN NickName IS NULL THEN '' ELSE CONCAT('\"',TRIM(NickName),'\" ') END, CASE WHEN LastName IS NULL THEN '' ELSE TRIM(LastName) END)) as 'contact', " + "CompanyName, JobTitle, DontContactReason, DontContactUntil, DontContactDateSet, DontContactSetByUserID " + "FROM db_contact ctc, db_company cpy WHERE ctc.CompanyID=cpy.CompanyID AND " + "(TRIM(CONCAT(TRIM(FirstName),' ',TRIM(LastName))) LIKE @s OR CONCAT(TRIM(REPLACE(ctc.Phone,' ','')),TRIM(REPLACE(Mobile,' ',''))) LIKE @s OR CONCAT(TRIM(Email)) LIKE @s OR CONCAT(TRIM(PersonalEmail)) LIKE @s) " + "AND Visible=1 ORDER BY FirstName, LastName LIMIT 6"; DataTable dt_contacts = SQL.SelectDataTable(qry, "@s", search_term + "%"); // Add Company separator if (dt_companies.Rows.Count > 0) { RadComboBoxItem break_item = new RadComboBoxItem(); break_item.IsSeparator = true; System.Web.UI.WebControls.Label lbl_cpy = new System.Web.UI.WebControls.Label(); lbl_cpy.Text = "Companies"; lbl_cpy.Font.Bold = true; break_item.Controls.Add(lbl_cpy); System.Web.UI.WebControls.Label lbl_cpy_info = new System.Web.UI.WebControls.Label(); lbl_cpy_info.Text = "Hover over a company name to see industry"; lbl_cpy_info.Font.Size = 8; lbl_cpy_info.Attributes.Add("style", "position:absolute; right:0; margin-right:4px;"); break_item.Controls.Add(lbl_cpy_info); rcb_search.Items.Add(break_item); } for (int i = 0; i < dt_companies.Rows.Count; i++) { String cpy_id = dt_companies.Rows[i]["CompanyID"].ToString(); String country = dt_companies.Rows[i]["Country"].ToString(); if (country == String.Empty) { country = "?"; } country = " " + country; HtmlGenericControl ul = new HtmlGenericControl("ul"); HtmlGenericControl li = new HtmlGenericControl("li"); ul.Controls.Add(li); li.Attributes.Add("class", "CompanyBullet"); RadComboBoxItem cpy_item = new RadComboBoxItem(); cpy_item.ToolTip = dt_companies.Rows[i]["industry"].ToString(); cpy_item.Style.Add("cursor", "pointer"); LinkButton lb_cpy = new LinkButton(); lb_cpy.Text = Util.TruncateText(dt_companies.Rows[i]["CompanyName"].ToString(), 40); System.Web.UI.WebControls.Label lbl_cpy_country = new System.Web.UI.WebControls.Label(); lbl_cpy_country.Text = country; if (CustomOnClientClick == String.Empty) { cpy_item.Attributes.Add("onclick", "$find('" + rcb_search.ClientID + "').hideDropDown(); var rw=" + radopen + "('/dashboard/leads/viewcompanyandcontact.aspx?cpy_id=" + HttpContext.Current.Server.UrlEncode(cpy_id) + "', 'rw_view_cpy_ctc'); rw.autoSize(); rw.center(); return false;"); } else { String ThisCustomOnClientClick = CustomOnClientClick.Replace("[cpy_id]", cpy_id) + " return false;"; cpy_item.Attributes.Add("onclick", ThisCustomOnClientClick); } li.Controls.Add(lb_cpy); li.Controls.Add(lbl_cpy_country); cpy_item.Controls.Add(ul); rcb_search.Items.Add(cpy_item); } // Add Contact separator if (!CompaniesOnly) { if (dt_contacts.Rows.Count > 0) { RadComboBoxItem break_item = new RadComboBoxItem(); break_item.IsSeparator = true; System.Web.UI.WebControls.Label lbl_ctc = new System.Web.UI.WebControls.Label(); lbl_ctc.Text = "Contacts"; lbl_ctc.Font.Bold = true; break_item.Controls.Add(lbl_ctc); System.Web.UI.WebControls.Label lbl_ctc_info = new System.Web.UI.WebControls.Label(); lbl_ctc_info.Text = "Hover over a name to see job title"; lbl_ctc_info.Font.Size = 8; lbl_ctc_info.Attributes.Add("style", "position:absolute; right:0; margin-right:4px;"); break_item.Controls.Add(lbl_ctc_info); rcb_search.Items.Add(break_item); } qry = "SELECT LeadID FROM dbl_lead WHERE Active=1 AND ContactID=@ctc_id AND (ProjectID IN (SELECT ProjectID FROM dbl_project WHERE UserID=@user_id) OR ProjectID IN (SELECT ProjectID FROM dbl_project_share WHERE UserID=@user_id)) ORDER BY DateUpdated DESC LIMIT 1"; for (int i = 0; i < dt_contacts.Rows.Count; i++) { String ctc_id = dt_contacts.Rows[i]["ContactID"].ToString(); HtmlGenericControl ul = new HtmlGenericControl("ul"); HtmlGenericControl li = new HtmlGenericControl("li"); ul.Controls.Add(li); li.Attributes.Add("class", "CompanyBullet"); RadComboBoxItem ctc_item = new RadComboBoxItem(); ctc_item.Style.Add("cursor", "pointer"); LinkButton lb_ctc = new LinkButton(); lb_ctc.Text = Util.TruncateText(dt_contacts.Rows[i]["contact"].ToString(), 25) + " @ <b>" + Util.TruncateText(dt_contacts.Rows[i]["CompanyName"].ToString(), 30) + "</b>"; ctc_item.ToolTip = dt_contacts.Rows[i]["JobTitle"].ToString(); lb_ctc.Attributes.Add("onclick", "$find('" + rcb_search.ClientID + "').hideDropDown(); var rw = " + radopen + "('/dashboard/leads/viewcompanyandcontact.aspx?ctc_id=" + HttpContext.Current.Server.UrlEncode(ctc_id) + "', 'rw_view_cpy_ctc'); rw.autoSize(); rw.center(); return false;"); CheckAndSetDoNotContact(dt_contacts.Rows[i], ctc_item, lb_ctc, null, null); // Check to see if this contact is in this user's Leads list DataTable dt_lead = SQL.SelectDataTable(qry, new String[] { "@ctc_id", "@user_id" }, new Object[] { ctc_id, UserID }); ImageButton imbtn_view_overview = null; ImageButton imbtn_view_project = null; if (dt_lead.Rows.Count > 0) { String lead_id = dt_lead.Rows[0]["LeadID"].ToString(); imbtn_view_overview = new ImageButton(); imbtn_view_overview.ImageUrl = "~/images/leads/ico_details.png"; imbtn_view_overview.ToolTip = "View Lead overview"; imbtn_view_overview.Attributes.Add("style", "margin-right:4px;"); imbtn_view_overview.OnClientClick = "$find('" + rcb_search.ClientID + "').hideDropDown(); " + radopen + "('/dashboard/leads/leadoverview.aspx?lead_id=" + HttpContext.Current.Server.UrlEncode(lead_id) + "', 'rw_lead_overview'); return false;"; imbtn_view_project = new ImageButton(); imbtn_view_project.ID = "imbtn_view_" + ctc_id; imbtn_view_project.ImageUrl = "~/images/leads/ico_go_to.png"; imbtn_view_project.ToolTip = "Go to Lead in my Project"; imbtn_view_project.CommandName = lead_id; imbtn_view_project.OnClientClick = "$find('" + rcb_search.ClientID + "').hideDropDown(); SetViewLeadID(" + lead_id + "); return false;"; } li.Controls.Add(lb_ctc); if (dt_lead.Rows.Count > 0) { Panel p = new Panel(); p.CssClass = "ViewLeadOptions"; p.Controls.Add(imbtn_view_overview); p.Controls.Add(imbtn_view_project); li.Controls.Add(p); } ctc_item.Controls.Add(ul); rcb_search.Items.Add(ctc_item); } } } rcb_search.ClearSelection(); rcb_search.DataBind(); } }
private void loadCharge(DataRow drCharge, ref RadComboBox cboChargeCode, ref RadComboBox cboChargeCcy, ref RadComboBox cboChargeAcc, ref RadNumericTextBox txtChargeAmt , ref RadComboBox cboPartyCharged, ref RadComboBox cboAmortCharge, ref RadTextBox txtTaxCode, ref RadNumericTextBox txtTaxAmt) { cboChargeCode.SelectedValue = drCharge["ChargeCode"].ToString(); cboChargeCcy.SelectedValue = drCharge["ChargeCcy"].ToString(); cboPartyCharged.SelectedValue = drCharge["PartyCharged"].ToString(); //bc.Commont.initRadComboBox(ref cboChargeAcc, "Display", "Id", bd.SQLData.B_BDRFROMACCOUNT_GetByCurrency(txtCustomerName.Value, cboChargeCcy.SelectedValue)); loadChargeAcc(cboPartyCharged.SelectedValue, cboChargeCcy.SelectedValue, ref cboChargeAcc); cboChargeAcc.SelectedValue = drCharge["ChargeAcct"].ToString(); if (drCharge["ChargeAmt"] != DBNull.Value) txtChargeAmt.Value = Convert.ToDouble(drCharge["ChargeAmt"]); cboAmortCharge.SelectedValue = drCharge["AmortCharge"].ToString(); txtTaxCode.Text = drCharge["TaxCode"].ToString(); if (drCharge["TaxAmt"] != DBNull.Value) txtTaxAmt.Value = Convert.ToDouble(drCharge["TaxAmt"]); }
private void cargarReportSOD() { RadComboBox cmb_año = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_año") as RadComboBox; RadComboBox cmb_mes = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_mes") as RadComboBox; RadComboBox cmb_ciudad = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_ciudad") as RadComboBox; RadComboBox cmb_marca = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_marca") as RadComboBox; RadComboBox cmb_categoria = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_categoria") as RadComboBox; RadComboBox cmb_region = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_region") as RadComboBox; Informes_validacion.UC_ValidarPeriodos UC_ValidarPeriodos1 = RadPanelBar_menu.FindChildByValue <RadPanelItem>("validar").FindControl("UC_ValidarPeriodos1") as Informes_validacion.UC_ValidarPeriodos; iidcompany = Convert.ToInt32(this.Session["companyid"].ToString()); sidcanal = this.Session["Canal"].ToString(); Report = Convert.ToInt32(this.Session["Reporte"]); iservicio = Convert.ToInt32(this.Session["Service"]); string sidperdil = this.Session["Perfilid"].ToString(); string año, mes, periodo; string validacion; año = cmb_año.SelectedValue; mes = cmb_mes.SelectedValue; if (cmb_año.SelectedValue == "0" && cmb_mes.SelectedValue == "0") { P.Servicio = iservicio; P.Canal = sidcanal; P.Cliente = iidcompany; P.SetPeriodoInicial_SOD(); año = P.Año; mes = P.Mes; cmb_año.SelectedIndex = cmb_año.Items.FindItemIndexByValue(año); cmb_mes.SelectedIndex = cmb_mes.Items.FindItemIndexByValue(mes); } if (sidperdil == ConfigurationManager.AppSettings["PerfilAnalista"]) { RadPanelBar_menu.FindChildByValue <RadPanelItem>("itemValidacion").Visible = true; UC_ValidarPeriodos1.SetValidacion(iservicio, sidcanal, iidcompany, Report, año, mes, "1"); validacion = "0"; } else { RadPanelBar_menu.FindChildByValue <RadPanelItem>("itemValidacion").Visible = false; validacion = "1"; } Reporte_contenido.Visible = true; Reporte_contenido.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; Reporte_contenido.ZoomMode = Microsoft.Reporting.WebForms.ZoomMode.Percent; Reporte_contenido.ServerReport.ReportPath = "/Reporte_Precios_V1/Evolucion_SOD_Mayorista"; String strConnection = ConfigurationManager.AppSettings["SERVIDOR_REPORTING_SERVICES"]; Reporte_contenido.ServerReport.ReportServerUrl = new Uri(strConnection); Reporte_contenido.ServerReport.ReportServerCredentials = new CFG.Tools.ReportServerNetCredentials(); List <Microsoft.Reporting.WebForms.ReportParameter> parametros = new List <Microsoft.Reporting.WebForms.ReportParameter>(); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("AÑO", cmb_año.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MES", cmb_mes.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("OFICINA", "0")); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CATEGORIA", (cmb_categoria.SelectedValue == "0" ? "12" : cmb_categoria.SelectedValue))); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MARCA", cmb_marca.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PDV", "0")); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CANAL", sidcanal)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CLIENTE", iidcompany.ToString())); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SERVICIO", iservicio.ToString())); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("ValidAnalyst", validacion)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("id_mallas", (cmb_region.SelectedValue == "0" ? "2" : cmb_region.SelectedValue))); Reporte_contenido.ServerReport.SetParameters(parametros); }
void comboSelectionChanged(object sender, SelectionChangedEventArgs args) { //(RadComboBox)args.OriginalSource. if (((System.Windows.FrameworkElement)args.OriginalSource).Name != "PART_Clock") { RadComboBox comboBox = (RadComboBox)args.OriginalSource; if (comboBox.SelectedValue == null || comboBox.SelectedValuePath != "Code") // we take action only if the continent combo is changed { return; } // Location location = null; string EmpresaCode = (string)comboBox.SelectedValue; if (EmpresaCode == "1") { this.cboSucursal.ItemsSource = null; this.cboSucursal.ItemsSource = Locations.DepartamentosLRG; this.cboSucursal.SelectedValue = (object)info.SucursalID; } if (EmpresaCode == "2") { this.cboSucursal.ItemsSource = null; this.cboSucursal.ItemsSource = Locations.DepartamentosCLT; this.cboSupplierName.SelectedValue = (object)info.CompanyID; this.cboSucursal.SelectedValue = (object)info.SucursalID; this.cboUsuario.SelectedValue = (object)info.CustomerID; this.cboVehicle.SelectedValue = (object)info.VehiculoID; } if (EmpresaCode == "3") { this.cboSucursal.ItemsSource = null; this.cboSucursal.ItemsSource = Locations.DepartamentosConsejo; this.cboSupplierName.SelectedValue = (object)info.CompanyID; this.cboSucursal.SelectedValue = (object)info.SucursalID; } if (EmpresaCode == "4") { this.cboSucursal.ItemsSource = null; this.cboSucursal.ItemsSource = Locations.Departamentos; this.cboSupplierName.SelectedValue = (object)info.CompanyID; this.cboSucursal.SelectedValue = (object)info.SucursalID; } } else { info.Date = Convert.ToDateTime(this.dteFecha.SelectedValue); } //Location location = comboBox.DataContext as Location; //location.EmpresaCode = (string)comboBox.SelectedValue;//we submit the value immediately rather than waiting the cell to lose focus. }
protected void GridUser_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { //插入状态 if (e.Item.OwnerTableView.IsItemInserted) { //***********************************Role 下拉列表加载数据 RoleBLL RoleBLLs = new RoleBLL(); List <View_Role> query = null; query = RoleBLLs.GetAll("", " it.RoleName desc"); if (query != null && query.Count() > 0) { GridEditFormItem edittedItem = (GridEditFormItem)e.Item; RadComboBox ComBoxRole = edittedItem.FindControl("ComBoxRole") as RadComboBox; ComBoxRole.DataSource = query; ComBoxRole.DataTextField = "RoleName"; ComBoxRole.DataValueField = "RoleID"; ComBoxRole.DataBind(); } //***********************************Role 下拉列表加载数据 } //编辑状态 else { //获取Grid的主键值 this.strKeyID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserID"].ToString(); //判断主键是否为空 if (this.strKeyID != string.Empty) { //装换Guid类型 System.Guid Guid = new Guid(this.strKeyID); //实例化Entity实体 using (MWDatabaseEntities MWDB = new MWDatabaseEntities()) { //通过主键查询数据表获取外键字段 control tblUser tblUsers = MWDB.tblUser.FirstOrDefault(d => d.UserID == Guid); if (tblUsers != null) { //加载d_DicType GridEditFormItem edittedItem = (GridEditFormItem)e.Item; //获取控件 RadTextBox textUserName = edittedItem.FindControl("textUserName") as RadTextBox; RadTextBox textLoginName = edittedItem.FindControl("textLoginName") as RadTextBox; RadTextBox textUserCode = edittedItem.FindControl("textUserCode") as RadTextBox; RadTextBox textEmail = edittedItem.FindControl("textEmail") as RadTextBox; RadTextBox textDesc = edittedItem.FindControl("textDesc") as RadTextBox; RadComboBox ComBoxState = edittedItem.FindControl("ComBoxState") as RadComboBox; RadComboBox ComBoxRole = edittedItem.FindControl("ComBoxRole") as RadComboBox; RoleBLL RoleBLLs = new RoleBLL(); //***********************************Role 下拉列表加载数据 List <View_Role> query = null; query = RoleBLLs.GetAll("", " it.RoleName desc"); if (query != null && query.Count() > 0) { ComBoxRole.DataSource = query; ComBoxRole.DataTextField = "RoleName"; ComBoxRole.DataValueField = "RoleID"; ComBoxRole.DataBind(); } //***********************************Role 下拉列表加载数据 RoleUserBLL Role_UserBLLs = new RoleUserBLL(); tblRole_User tblRole_UserObj = null; tblRole_UserObj = Role_UserBLLs.GetByID(this.strKeyID); if (tblRole_UserObj != null) { ComBoxRole.SelectedIndex = ComBoxRole.Items.IndexOf(ComBoxRole.Items.FindItemByValue(tblRole_UserObj.RoleID.ToString(), true)); } //为控件赋值 textUserName.Text = tblUsers.UserName; textLoginName.Text = tblUsers.LoginName; textUserCode.Text = tblUsers.UserCode; textEmail.Text = tblUsers.Email; textDesc.Text = tblUsers.Desc; //下拉列表编辑时选择 ComBoxState.SelectedIndex = ComBoxState.Items.IndexOf(ComBoxState.Items.FindItemByValue(tblUsers.State.ToString())); } } } } } }
public static void ProcessEnableVisible(Page wpage, string control_name, string control_type, string control_state_status, int iAction) { if (control_type.Equals("TextBox")) { TextBox txt = Bas_Utility.Utilities.GetTextBox(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; txt.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- Panel if (control_type.Equals("Panel")) { Panel pnl = Bas_Utility.Utilities.GetPanel(wpage, control_name); if (pnl != null) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: pnl.Enabled = true; break; case 2: pnl.Visible = true; break; } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: pnl.Enabled = false; pnl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: pnl.Visible = false; break; } } } } return; } // --------------------------- DropDownList if (control_type.Equals("DropDownList")) { DropDownList ddl = Bas_Utility.Utilities.GetDropDown(wpage, control_name); if (ddl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ddl.Enabled = true; break; case 2: ddl.Visible = true; break; } } } else { switch (iAction) { case 1: ddl.Enabled = false; ddl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ddl.Visible = false; break; } } } return; } // --------------------------- ListBox if (control_type.Equals("ListBox")) { ListBox ddl = Bas_Utility.Utilities.GetListBox(wpage, control_name); if (ddl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ddl.Enabled = true; break; case 2: ddl.Visible = true; break; } } } else { switch (iAction) { case 1: ddl.Enabled = false; ddl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ddl.Visible = false; break; } } } return; } // --------------------------- RadioButton if (control_type.Equals("RadioButton")) { RadioButton ddl = Bas_Utility.Utilities.GetRadioButton(wpage, control_name); if (ddl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ddl.Enabled = true; break; case 2: ddl.Visible = true; break; } } } else { switch (iAction) { case 1: ddl.Enabled = false; ddl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ddl.Visible = false; break; } } } return; } // --------------------------- CheckBoxList if (control_type.Equals("CheckBoxList")) { CheckBoxList ddl = Bas_Utility.Utilities.GetCheckBoxList(wpage, control_name); if (ddl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ddl.Enabled = true; break; case 2: ddl.Visible = true; break; } } } else { switch (iAction) { case 1: ddl.Enabled = false; ddl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ddl.Visible = false; break; } } } return; } // --------------------------- CheckBox if (control_type.Equals("CheckBox")) { CheckBox ddl = Bas_Utility.Utilities.GetCheckBox(wpage, control_name); if (ddl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ddl.Enabled = true; break; case 2: ddl.Visible = true; break; } } } else { switch (iAction) { case 1: ddl.Enabled = false; ddl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ddl.Visible = false; break; } } } return; } // --------------------------- LinkButton if (control_type.Equals("LinkButton")) { LinkButton cntrl = Bas_Utility.Utilities.GetLinkButton(wpage, control_name); if (cntrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: cntrl.Enabled = true; break; case 2: cntrl.Visible = true; break; } } } else { switch (iAction) { case 1: cntrl.Enabled = false; cntrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: cntrl.Visible = false; break; } } } return; } // --------------------------- LinkButton if (control_type.Equals("LinkButton")) { LinkButton cntrl = Bas_Utility.Utilities.GetLinkButton(wpage, control_name); if (cntrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: cntrl.Enabled = true; break; case 2: cntrl.Visible = true; break; } } } else { switch (iAction) { case 1: cntrl.Enabled = false; cntrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: cntrl.Visible = false; break; } } } return; } // --------------------------- ImageButton if (control_type.Equals("ImageButton")) { ImageButton cntrl = Bas_Utility.Utilities.GetImageButton(wpage, control_name); if (cntrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: cntrl.Enabled = true; break; case 2: cntrl.Visible = true; break; } } } else { switch (iAction) { case 1: cntrl.Enabled = false; cntrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: cntrl.Visible = false; break; } } } return; } // --------------------------- HyperLink if (control_type.Equals("HyperLink")) { HyperLink cntrl = Bas_Utility.Utilities.GetHyperLink(wpage, control_name); if (cntrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: cntrl.Enabled = true; break; case 2: cntrl.Visible = true; break; } } } else { switch (iAction) { case 1: cntrl.Enabled = false; cntrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: cntrl.Visible = false; break; } } } return; } // --------------------------- HyperLink if (control_type.Equals("HyperLink")) { HyperLink cntrl = Bas_Utility.Utilities.GetHyperLink(wpage, control_name); if (cntrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: cntrl.Enabled = true; break; case 2: cntrl.Visible = true; break; } } } else { switch (iAction) { case 1: cntrl.Enabled = false; cntrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: cntrl.Visible = false; break; } } } return; } // --------------------------- RadioButton if (control_type.Equals("RadioButton")) { RadioButton ctrl = Bas_Utility.Utilities.GetRadioButton(wpage, control_name); if (ctrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ctrl.Enabled = true; break; case 2: ctrl.Visible = true; break; } } } else { switch (iAction) { case 1: ctrl.Enabled = false; ctrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ctrl.Visible = false; break; } } } return; } // --------------------------- RadioButton if (control_type.Equals("RadioButton")) { RadioButton ctrl = Bas_Utility.Utilities.GetRadioButton(wpage, control_name); if (ctrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ctrl.Enabled = true; break; case 2: ctrl.Visible = true; break; } } } else { switch (iAction) { case 1: ctrl.Enabled = false; ctrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ctrl.Visible = false; break; } } } return; } // --------------------------- CheckBoxList if (control_type.Equals("CheckBoxList")) { CheckBoxList ctrl = Bas_Utility.Utilities.GetCheckBoxList(wpage, control_name); if (ctrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ctrl.Enabled = true; break; case 2: ctrl.Visible = true; break; } } } else { switch (iAction) { case 1: ctrl.Enabled = false; ctrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ctrl.Visible = false; break; } } } return; } // --------------------------- CheckBox if (control_type.Equals("CheckBox")) { CheckBox ctrl = Bas_Utility.Utilities.GetCheckBox(wpage, control_name); if (ctrl != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: ctrl.Enabled = true; break; case 2: ctrl.Visible = true; break; } } } else { switch (iAction) { case 1: ctrl.Enabled = false; ctrl.BackColor = System.Drawing.Color.FromName("ffffcc"); break; case 2: ctrl.Visible = false; break; } } } return; } // --------------------------- RadMaskedTextBox if (control_type.Equals("RadMaskedTextBox")) { RadMaskedTextBox txt = Bas_Utility.Utilities.GetRadMaskedTextBox(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadTextBox if (control_type.Equals("RadTextBox")) { RadTextBox txt = Bas_Utility.Utilities.GetRadTextBox(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadComboBox if (control_type.Equals("RadComboBox")) { RadComboBox txt = Bas_Utility.Utilities.GetRadComboBox(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadDateInput if (control_type.Equals("RadDateInput")) { RadDateInput txt = Bas_Utility.Utilities.GetRadDateInput(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadDatePicker if (control_type.Equals("RadDatePicker")) { RadDatePicker txt = Bas_Utility.Utilities.GetRadDatePicker(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadEditor if (control_type.Equals("RadEditor")) { RadEditor txt = Bas_Utility.Utilities.GetRadEditor(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } // --------------------------- RadMaskedTextBox if (control_type.Equals("RadMaskedTextBox")) { RadMaskedTextBox txt = Bas_Utility.Utilities.GetRadMaskedTextBox(wpage, control_name); if (txt != null) { if (control_state_status.Equals("1")) { if (control_state_status.Equals("1")) { switch (iAction) { case 1: txt.Enabled = true; break; case 2: txt.Visible = true; break; } } } else { if (control_state_status.Equals("0")) { switch (iAction) { case 1: txt.Enabled = false; break; case 2: txt.Visible = false; break; } } } } return; } }
protected void Load_Items(bool addMore, bool doReset) { int moduleParameterId = 0; if (!string.IsNullOrEmpty(ddlBranch.SelectedValue)) { moduleParameterId = Convert.ToInt32(ddlBranch.SelectedValue); } if (doReset) { rptVoucherItems.DataSourceID = null; rptVoucherItems.DataBind(); } if (Request.QueryString["gid"] != null && addMore == false) { int groupId = Convert.ToInt32(Request.QueryString["gid"]); iBiz.FinPro.Transactions.Transact bTrans = new iBiz.FinPro.Transactions.Transact(); iBiz.FinPro.Transactions.Groups bTransG = new iBiz.FinPro.Transactions.Groups(); iBiz.FinPro.Transactions.Groups.objGroup objTransG = new iBiz.FinPro.Transactions.Groups.objGroup(); objTransG = bTransG.Select(groupId); if (objTransG != null) { //if (objTransG.transGroupIsOfficial != isOfficial) //{ // Response.Redirect("~/", false); //} //tbDescription.Text = objTransG.transGroupTitle; //radVoucharDate.SelectedDate = objTransG.transGroupCreatedOn; //tbRefId.Text = objTransG.transGroupRefId; //tbCustomValue1.Text = objTransG.transCField1; //tbCustomValue2.Text = objTransG.transCField2; //tbCustomValue3.Text = objTransG.transCField3; //tbCustomValue4.Text = objTransG.transCField4; rptVoucherItems.DataSource = bTrans.Select_Grp(groupId, Convert.ToBoolean(isOfficial)); rptVoucherItems.DataBind(); //hplPrintVouchar.Visible = true; //hplPrintVouchar.NavigateUrl = hplPrintVouchar.NavigateUrl + "?id=" + objTransG.transGroupID.ToString(); //tr_lbtnUpdate.Visible = objTransG.transGroupApprovedBy.HasValue ? false : true; //tr_lbtnDelete.Visible = objTransG.transGroupApprovedBy.HasValue ? false : true; //lbtnAddRow.Visible = objTransG.transGroupApprovedBy.HasValue ? false : true; //tr_TotalRow.Visible = true; //ltrTotalCredit.Text = Comma_Amount(objTransG.Get_Total_Credit()); //ltrTotalDebit.Text = Comma_Amount(objTransG.Get_Total_Debit()); } } DataTable dt = new DataTable(); dt.Columns.Add("additionalTransId"); dt.Columns.Add("itemNo"); dt.Columns.Add("chkShowOff"); dt.Columns.Add("transID"); dt.Columns.Add("drAccountId"); dt.Columns.Add("crAccountId"); dt.Columns.Add("deptId"); dt.Columns.Add("description"); dt.Columns.Add("amount"); int iNo = 0; foreach (RepeaterItem item in rptVoucherItems.Items) { foreach (Control ctrlItem in item.Controls) { if (ctrlItem is HiddenField) { if (ctrlItem.ClientID.ToLower().Contains("hfitemno")) { iNo++; string itemNo, showOff, transId, drAccountId, crAccountId, deptId, description, amount; HiddenField hfINo = (HiddenField)ctrlItem; RadComboBox ddlDebitAccounts = (RadComboBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlDebitAccounts")); RadComboBox ddlCreditAccounts = (RadComboBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlCreditAccount")); DropDownList ddlDepts = (DropDownList)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "ddlDept")); TextBox tbDescription = (TextBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "tbDescription")); TextBox tbAmount = (TextBox)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "tbAmount")); HiddenField hfTransId = (HiddenField)Form.FindControl(hfINo.UniqueID.Replace("hfItemNo", "hfTransID")); itemNo = hfINo.Value; //showOff = Convert.ToInt32(chkShowOff.Checked).ToString(); showOff = "1"; transId = hfTransId.Value; //accountId = ddlAccounts.SelectedValue; drAccountId = ddlDebitAccounts.SelectedValue; crAccountId = ddlCreditAccounts.SelectedValue; deptId = ddlDepts.SelectedValue; description = tbDescription.Text; amount = tbAmount.Text.Length > 0 ? tbAmount.Text.Replace(",", "") : ""; dt.Rows.Add(null, itemNo, showOff, transId, drAccountId, crAccountId, deptId, description, Comma_Amount(amount)); } } } } //get Preset Accounts iBiz.FinPro.Modules.fin_Modules bModules = new iBiz.FinPro.Modules.fin_Modules(); IDataReader idr; if (isOfficial == 0) { idr = bModules.Get_Preselected_Items(moduleId, moduleParameterId, false); } else { idr = bModules.Get_Preselected_Items(moduleId, moduleParameterId, true); } if (idr != null && !addMore && string.IsNullOrEmpty(Request.QueryString["gid"])) { while (idr.Read()) { int additionalTransId = Convert.ToInt32(idr["additionalTransId"]); int selectedAccountId = Convert.ToInt32(idr["autoTransAccountId"]); string transDescription = idr["autoTransNarration"].ToString(); dt.Rows.Add(additionalTransId, iNo + 1, 1, 0, selectedAccountId, 0, transDescription, "", ""); } } if (addMore || rptVoucherItems.Items.Count == 0) { dt.Rows.Add(null, iNo + 1, 1, 0, 0, 0, "", "", ""); dt.Rows.Add(null, iNo + 2, 1, 0, 0, 0, "", "", ""); hfTotalItems.Value = Convert.ToString(iNo + 2); } else { hfTotalItems.Value = Convert.ToString(iNo); } rptVoucherItems.DataSource = dt; rptVoucherItems.DataBind(); }
private void LoadTreeview() { AutoComboBox auto = new AutoComboBox(); List <string> lstDieuKien = new List <string>(); RadComboBox cb = new RadComboBox(); lstDieuKien.Add(DatabaseConstant.DanhMuc.NHOM_NO.getValue()); lstSourceNhomNo = new List <AutoCompleteEntry>(); auto.GenAutoComboBox(ref lstSourceNhomNo, ref cb, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DMUC.getValue(), lstDieuKien); RadTreeViewItem rootItem = new RadTreeViewItem(); rootItem.Header = LLanguage.SearchResourceByKey("Nhóm nợ ") + " (" + lstSourceNhomNo.Count.ToString() + ")"; rootItem.Tag = string.Empty; rootItem.IsExpanded = true; rootItem.IsChecked = false; tvwTreeNhomNo.Items.Add(rootItem); BuildTree(rootItem, lstSourceNhomNo); auto = new AutoComboBox(); lstDieuKien = new List <string>(); cb = new RadComboBox(); lstDieuKien.Add(ClientInformation.MaDonVi); lstSourceLoaiTSDB = new List <AutoCompleteEntry>(); auto.GenAutoComboBox(ref lstSourceLoaiTSDB, ref cb, "COMBOBOX_SAN_PHAM_TD", lstDieuKien); rootItem = new RadTreeViewItem(); rootItem.Header = LLanguage.SearchResourceByKey("Sản phẩm tím dụng") + " (" + lstSourceLoaiTSDB.Count.ToString() + ")"; rootItem.Tag = string.Empty; rootItem.IsExpanded = true; rootItem.IsChecked = false; tvwTreeLoaiTSDB.Items.Add(rootItem); BuildTree(rootItem, lstSourceLoaiTSDB); auto = new AutoComboBox(); lstDieuKien = new List <string>(); cb = new RadComboBox(); lstDieuKien.Add(DatabaseConstant.DanhMuc.NGUON_VON_VAY.getValue()); lstSourceNguonVonChoVay = new List <AutoCompleteEntry>(); auto.GenAutoComboBox(ref lstSourceNguonVonChoVay, ref cb, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DMUC.getValue(), lstDieuKien); rootItem = new RadTreeViewItem(); rootItem.Header = LLanguage.SearchResourceByKey("Nguồn vốn vay") + " (" + lstSourceNguonVonChoVay.Count.ToString() + ")"; rootItem.Tag = string.Empty; rootItem.IsExpanded = true; rootItem.IsChecked = false; tvwTreeNguonVonChoVay.Items.Add(rootItem); BuildTree(rootItem, lstSourceNguonVonChoVay); auto = new AutoComboBox(); lstDieuKien = new List <string>(); cb = new RadComboBox(); lstDieuKien.Add(DatabaseConstant.DanhMuc.MUC_DICH_VAY_VON.getValue()); lstSourceMucDichVay = new List <AutoCompleteEntry>(); auto.GenAutoComboBox(ref lstSourceMucDichVay, ref cb, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DMUC.getValue(), lstDieuKien); rootItem = new RadTreeViewItem(); rootItem.Header = LLanguage.SearchResourceByKey("Mục đích vay vốn") + " (" + lstSourceMucDichVay.Count.ToString() + ")"; rootItem.Tag = string.Empty; rootItem.IsExpanded = true; rootItem.IsChecked = false; tvwTreeMucDichVay.Items.Add(rootItem); BuildTree(rootItem, lstSourceMucDichVay); }
private void loadCharge(BEXPORT_LC_DOCS_PROCESSING_CHARGES ExLCCharge, ref RadTextBox txtChargeCode, ref RadComboBox cbChargeCcy, ref RadComboBox cbChargeAcc, ref RadNumericTextBox txtChargeAmt, ref RadComboBox cbChargeParty, ref RadComboBox cbChargeAmort, ref RadComboBox cbChargeStatus, ref Label lblTaxCode, ref Label lblTaxAmt) { txtChargeCode.Text = ExLCCharge.ChargeCode; cbChargeCcy.SelectedValue = ExLCCharge.ChargeCcy; cbChargeAcc.SelectedValue = ExLCCharge.ChargeAcc; txtChargeAmt.Value = ExLCCharge.ChargeAmt; cbChargeParty.SelectedValue = ExLCCharge.PartyCharged; cbChargeAmort.SelectedValue = ExLCCharge.AmortCharge; cbChargeStatus.SelectedValue = ExLCCharge.ChargeStatus; lblTaxCode.Text = ExLCCharge.TaxCode; if (ExLCCharge.TaxAmt.HasValue) lblTaxAmt.Text = ExLCCharge.TaxAmt.ToString(); }
public static RadComboBox SetPersonList(RadComboBox ddl, List <PERSON> personSelectList, string personID) { return(SetPersonList(ddl, personSelectList, personID, 0)); }
/// <summary> /// /// </summary> /// <param name="rcObject"></param> public static void LlenarRCEnBlanco(RadComboBox rcObject) { rcObject.Items.Clear(); rcObject.Items.Add(new RadComboBoxItem("[Seleccione]", string.Empty)); rcObject.DataBind(); }
public static object DisplayControlValue(object oCtl, string value, PageUseMode mode, string cssClass, string literalControl) { Label lbl = null; string lblText = value; try { Control ctl = (Control)oCtl; Control parent = ctl.Parent; int idx = parent.Controls.IndexOf(ctl); if (oCtl is TextBox) { TextBox tb = (TextBox)oCtl; tb.Text = lblText = value; } if (oCtl is DropDownList) { DropDownList ddl = (DropDownList)oCtl; if (!string.IsNullOrEmpty(value)) { ddl.SelectedValue = value; } lblText = ddl.SelectedItem.Text; } if (oCtl is RadComboBox) { RadComboBox rddl = (RadComboBox)oCtl; if (rddl.CheckBoxes == true) { foreach (RadComboBoxItem item in rddl.CheckedItems) { lblText += (lblText.Length == 0 ? item.Text : (", " + item.Text)); } } else { if (rddl.Items.FindItemByValue(value) != null) { rddl.SelectedValue = value; lblText = rddl.SelectedItem.Text; } else { lblText = ""; } } } if (oCtl is RadDatePicker) { RadDatePicker rd = (RadDatePicker)oCtl; rd.SelectedDate = null; if (!string.IsNullOrEmpty(value)) { DateTime dt = Convert.ToDateTime(value); if (dt > DateTime.MinValue) { rd.SelectedDate = dt; } } if (rd.SelectedDate != null) { lblText = FormatDate((DateTime)rd.SelectedDate, "d", false); } } if (oCtl is RadSearchBox) { ((RadSearchBox)oCtl).Text = value; } if (mode != PageUseMode.EditEnabled) { lbl = new Label(); lbl.Text = lblText; lbl.CssClass = cssClass; parent.Controls.AddAt(idx, lbl); ctl.Visible = false; } if (!string.IsNullOrEmpty(literalControl)) { parent.Controls.AddAt(idx, new LiteralControl(literalControl)); } } catch (Exception ex) { // SQMLogger.LogException(ex); ; } return((object)lbl); }
protected void grdAreaSetup_InsertCommand(object sender, GridCommandEventArgs e) { // insert area record in the database GridEditableItem editedItem = e.Item as GridEditableItem; GridEditManager editMan = editedItem.EditManager; string area_desc = null; Int32 area_typ_int; string handle_split_str; string act_ind_str; string displayname = User.Identity.Name; decimal warehouseid; string allow_admin_release_ind_str; RadTextBox areadesc = (RadTextBox)editedItem.FindControl("Area_desc_TextBox"); area_desc = areadesc.Text.ToString(); RadComboBox areatype = (RadComboBox)editedItem.FindControl("Area_type_RadComboBox"); RadComboBox areasplit = (RadComboBox)editedItem.FindControl("handle_split_RadComboBox"); RadComboBox areaactind = (RadComboBox)editedItem.FindControl("Act_ind_RadComboBox"); RadComboBox warehousecb = (RadComboBox)editedItem.FindControl("rcbWarehouse"); RadComboBox allowadminreleaseind = (RadComboBox)editedItem.FindControl("allow_admin_release_ind_RadComboBox"); area_typ_int = Int32.Parse(areatype.SelectedValue); handle_split_str = areasplit.SelectedValue.ToString(); act_ind_str = areaactind.SelectedValue.ToString(); warehouseid = decimal.Parse(warehousecb.SelectedValue); allow_admin_release_ind_str = allowadminreleaseind.SelectedValue.ToString(); AreaDAO areainsert = new AreaDAO(); try { decimal areaid = areainsert.Create_Area(area_typ_int, warehouseid, area_desc, handle_split_str, act_ind_str, displayname, allow_admin_release_ind_str); if (areaid == 0) { // display error string err_msg = "Area that handles Split already exist"; HandleError(err_msg, 1); } else { HandleError("Area Added", 0); } } catch (Exception ex_ins) { string err = ex_ins.Message; HandleError(err, 1); } BindData(); }
private Grid CreateGrid(string aParameterName, Property aProperty) { try { Grid _result = new Grid(); _result.Width = double.NaN; ColumnDefinition _cd1 = new ColumnDefinition(); //cd1.Width = new GridLength(1,GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd1); ColumnDefinition _cd2 = new ColumnDefinition(); //cd2.Width = new GridLength(1, GridUnitType.Auto); _result.ColumnDefinitions.Add(_cd2); TextBlock _tblk = new TextBlock(); _tblk.FontFamily = new FontFamily("Segoe UI"); _tblk.FontWeight = FontWeights.Bold; //tblk.FontSize = 14; _tblk.Text = aParameterName; _tblk.Margin = new Thickness(5, 10, 2, 0); Grid.SetColumn(_tblk, 0); _result.Children.Add(_tblk); InControl _InControl = new InControl(); if (!aProperty.IsMultipleSelection) { TextBox _tbx = new TextBox(); _tbx.Tag = aProperty; _tbx.HorizontalAlignment = HorizontalAlignment.Right; _tbx.Width = 50; _tbx.Text = "1"; _tbx.Margin = new Thickness(0, 10, 10, 0); Grid.SetColumn(_tbx, 1); _InControl.TextBox = _tbx; _InControl.ControlType = ControlType.TextBox; _result.Children.Add(_tbx); } else { RadComboBox _combbx = new RadComboBox(); _combbx.ItemsSource = aProperty.Value_Converters; _combbx.DisplayMemberPath = "Value"; _combbx.SelectedIndex = 0; _combbx.Tag = aProperty; _combbx.Margin = new Thickness(0, 10, 10, 0); _combbx.HorizontalAlignment = HorizontalAlignment.Right; Grid.SetColumn(_combbx, 1); _InControl.ComboBox = _combbx; _InControl.ControlType = ControlType.ComboBox; _result.Children.Add(_combbx); } if (InTextBoxs != null) InTextBoxs.Add(_InControl); return _result; } catch (Exception _ex) { GeneralTools.Tools.WriteToLog(_ex); return null; } }
protected void grdAreaSetup_UpdateCommand(object sender, GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; string area_desc = null; Int32 area_typ_int; string handle_split_str; string act_ind_str; string displayname = User.Identity.Name; decimal areaid; decimal warehouseid; string allow_admin_release_ind_str; areaid = decimal.Parse(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Area_id"].ToString()); RadTextBox areadesc = (RadTextBox)editedItem.FindControl("Area_desc_TextBox"); area_desc = areadesc.Text.ToString(); RadComboBox areatype = (RadComboBox)editedItem.FindControl("Area_type_RadComboBox"); RadComboBox areasplit = (RadComboBox)editedItem.FindControl("handle_split_RadComboBox"); RadComboBox areaactind = (RadComboBox)editedItem.FindControl("Act_ind_RadComboBox"); RadComboBox warehousecb = (RadComboBox)editedItem.FindControl("rcbWarehouse"); RadComboBox allowadminreleaseind = (RadComboBox)editedItem.FindControl("allow_admin_release_ind_RadComboBox"); area_typ_int = Int32.Parse(areatype.SelectedValue); handle_split_str = areasplit.SelectedValue.ToString(); act_ind_str = areaactind.SelectedValue.ToString(); warehouseid = decimal.Parse(warehousecb.SelectedValue); allow_admin_release_ind_str = allowadminreleaseind.SelectedValue.ToString(); AreaDAO areaedit = new AreaDAO(); try { decimal areaidupd = areaedit.Update_Area(areaid, warehouseid, area_typ_int, area_desc, handle_split_str, act_ind_str, displayname, allow_admin_release_ind_str); string err_msg = null; if (areaidupd == 0) { // display error err_msg = "Area that handles Split already exist"; HandleError(err_msg, 1); } else if (areaidupd == -1) { err_msg = "Area Type cannot be changed - Chutes Attached"; HandleError(err_msg, 1); } else { HandleError("Area Updated", 0); } } catch (Exception ex_upd) { string err = ex_upd.Message; HandleError(err, 1); } BindData(); }
private void cargarReporte() { RadComboBox cmb_periodo = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_periodo") as RadComboBox; RadComboBox cmb_año = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_año") as RadComboBox; RadComboBox cmb_mes = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_mes") as RadComboBox; RadComboBox cmb_cadena = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_cadena") as RadComboBox; RadComboBox cmb_ciudad = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_ciudad") as RadComboBox; RadComboBox cmb_cobertura = RadPanelBar_menu.FindChildByValue <RadPanelItem>("filtro").FindControl("cmb_cobertura") as RadComboBox; Informes_validacion.UC_ValidarPeriodos UC_ValidarPeriodos1 = RadPanelBar_menu.FindChildByValue <RadPanelItem>("validar").FindControl("UC_ValidarPeriodos1") as Informes_validacion.UC_ValidarPeriodos; iidcompany = Convert.ToInt32(this.Session["companyid"].ToString()); sidcanal = this.Session["Canal"].ToString(); Report = Convert.ToInt32(this.Session["Reporte"]); iservicio = Convert.ToInt32(this.Session["Service"]); string sidperdil = this.Session["Perfilid"].ToString(); string id_categoria, año, mes, periodo; bool validacion; id_categoria = Request.QueryString["cod"]; año = cmb_año.SelectedValue; mes = cmb_mes.SelectedValue; periodo = cmb_periodo.SelectedValue; if (cmb_año.SelectedValue == "0" && cmb_mes.SelectedValue == "0") { P.Servicio = iservicio; P.Canal = sidcanal; P.Cliente = iidcompany; P.SetPeriodoInicial_Presencia(); año = P.Año; mes = P.Mes; periodo = P.PeriodoId; cmb_año.SelectedIndex = cmb_año.Items.FindItemIndexByValue(año); cmb_mes.SelectedIndex = cmb_mes.Items.FindItemIndexByValue(mes); cargarPeriodo(); cmb_periodo.SelectedIndex = cmb_periodo.Items.FindItemIndexByValue(periodo); } if (sidperdil == ConfigurationManager.AppSettings["PerfilAnalista"]) { RadPanelBar_menu.FindChildByValue <RadPanelItem>("itemValidacion").Visible = true; RadPanelBar_menu.FindChildByValue <RadPanelItem>("configuracion").Visible = true; UC_ValidarPeriodos1.SetValidacion(iservicio, sidcanal, iidcompany, Report, año, mes, periodo); validacion = false; } else { RadPanelBar_menu.FindChildByValue <RadPanelItem>("itemValidacion").Visible = false; RadPanelBar_menu.FindChildByValue <RadPanelItem>("configuracion").Visible = false; validacion = true; } Reporte.Visible = true; Reporte.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; Reporte.ZoomMode = Microsoft.Reporting.WebForms.ZoomMode.Percent; Reporte.ServerReport.ReportPath = "/Reporte_Precios_V1/Reporte_IndexPriceDetail"; string strConnection = ConfigurationManager.AppSettings["SERVIDOR_REPORTING_SERVICES"]; Reporte.ServerReport.ReportServerUrl = new Uri(strConnection); Reporte.ServerReport.ReportServerCredentials = new CFG.Tools.ReportServerNetCredentials(); List <Microsoft.Reporting.WebForms.ReportParameter> parametros = new List <Microsoft.Reporting.WebForms.ReportParameter>(); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("AÑO", año)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MES", mes)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PERIODO", periodo)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CIUDAD", cmb_ciudad.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CADENA", cmb_cadena.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("TIPOCIUDAD", cmb_cobertura.SelectedValue)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CANAL", sidcanal)); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CLIENTE", iidcompany.ToString())); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SERVICIO", iservicio.ToString())); parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("VALIDANALYST", validacion.ToString())); Reporte.ServerReport.SetParameters(parametros); }
protected void grdAreaSetup_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) { GridEditableItem editedItem = e.Item as GridEditableItem; GridEditFormInsertItem insert = e.Item as GridEditFormInsertItem; AreaDAO area_dao = new AreaDAO(); // area type drop down DataSet ds_areatype = new DataSet(); ds_areatype = area_dao.GetAreaType(); RadComboBox areatype = (RadComboBox)editedItem .FindControl("Area_type_RadComboBox"); areatype.DataSource = ds_areatype.Tables["AT"]; areatype.DataTextField = "type_short_name"; areatype.DataValueField = "area_type_id"; areatype.DataBind(); areatype.Items.Insert(0, new RadComboBoxItem("", "0")); DataSet dsWarehouse = new DataSet(); dsWarehouse = area_dao.Get_Warehouses(); RadComboBox warehousecb = (RadComboBox)editedItem.FindControl("rcbWarehouse"); warehousecb.DataSource = dsWarehouse.Tables[0]; warehousecb.DataTextField = "warehouse_name"; warehousecb.DataValueField = "warehouse_id"; warehousecb.DataBind(); // area handle split drop down DataSet ds_handlesplit = new DataSet(); ds_handlesplit = area_dao.GetAreaHandleSplit(); RadComboBox areahandlesplit = (RadComboBox)editedItem .FindControl("handle_split_RadComboBox"); areahandlesplit.DataSource = ds_handlesplit.Tables["HS"]; areahandlesplit.DataTextField = "handle_split_short_name"; areahandlesplit.DataValueField = "handle_split_code"; areahandlesplit.DataBind(); //areahandlesplit.Items.Insert(0, new RadComboBoxItem("", "0")); // allow admin release drop down - use the same dataset for the handle split RadComboBox allowadminrelease = (RadComboBox)editedItem.FindControl("allow_admin_release_ind_RadComboBox"); allowadminrelease.DataSource = ds_handlesplit.Tables["HS"]; allowadminrelease.DataTextField = "handle_split_short_name"; allowadminrelease.DataValueField = "handle_split_code"; allowadminrelease.DataBind(); // area active indicator drop down DataSet ds_actind = new DataSet(); ds_actind = area_dao.GetActiveInd(); RadComboBox areaactiveind = (RadComboBox)editedItem .FindControl("Act_ind_RadComboBox"); areaactiveind.DataSource = ds_actind.Tables["AI"]; areaactiveind.DataTextField = "act_ind_short_name"; areaactiveind.DataValueField = "act_ind_code"; areaactiveind.DataBind(); areaactiveind.Items.Insert(0, new RadComboBoxItem("", "0")); if (e.Item.ItemIndex != -1) { Int32 AreaID = Int32.Parse( editedItem .OwnerTableView .DataKeyValues[e.Item.ItemIndex]["Area_id"] .ToString()); DataSet ds_areadtls = new DataSet(); ds_areadtls = area_dao.Get_Area_for_ID(AreaID); DataTable dt_areadtls = ds_areadtls.Tables[0]; Int32 area_type = 0; string area_desc = null; string area_sl = null; string area_status = null; string warehouse_id = string.Empty; string area_allow_admin_release = null; foreach (DataRow row in dt_areadtls.Rows) { area_type = Int32.Parse(row["Area_type"].ToString()); area_desc = row["Area_desc"].ToString(); area_sl = row["Handle_Split_load_ind"].ToString(); area_status = row["Active_ind_cd"].ToString(); warehouse_id = row["warehouse_id"].ToString(); area_allow_admin_release = row["allow_admin_release_ind_cd"].ToString(); } RadTextBox areadesc = (RadTextBox)editedItem.FindControl("Area_desc_TextBox"); areadesc.Text = area_desc; areatype.SelectedValue = area_type.ToString(); areahandlesplit.SelectedValue = area_sl; areaactiveind.SelectedValue = area_status; RadComboBox rcbWarehouse = (RadComboBox)editedItem.FindControl("rcbWarehouse"); rcbWarehouse.SelectedValue = warehouse_id; allowadminrelease.SelectedValue = area_allow_admin_release; } } }
private void saveCharge(RadTextBox txtChargeCode, RadComboBox cbChargeCcy, RadComboBox cbChargeAcc, RadNumericTextBox txtChargeAmt, RadComboBox cbChargeParty, RadComboBox cbChargeAmort, RadComboBox cbChargeStatus, Label lblTaxCode, Label lblTaxAmt, ref BEXPORT_LC_DOCS_SETTLEMENT_CHARGES ExLCCharge) { ExLCCharge.PaymentCode = tbLCCode.Text; ExLCCharge.ChargeCode = txtChargeCode.Text; ExLCCharge.ChargeCcy = cbChargeCcy.SelectedValue; ExLCCharge.ChargeAcc = cbChargeAcc.SelectedValue; ExLCCharge.ChargeAmt = txtChargeAmt.Value; ExLCCharge.PartyCharged = cbChargeParty.SelectedValue; ExLCCharge.AmortCharge = cbChargeAmort.SelectedValue; ExLCCharge.ChargeStatus = cbChargeStatus.SelectedValue; ExLCCharge.TaxCode = lblTaxCode.Text; if (!string.IsNullOrEmpty(lblTaxAmt.Text)) ExLCCharge.TaxAmt = Convert.ToDouble(lblTaxAmt.Text); }
private bool ApplicationInit(Hashtable State, RadComboBox AppsList, string AppID, string AppCGCustomerCode) { Util util = new Util(); string app = AppsList.SelectedValue; if (app.Contains("->")) return false; State["SelectedApp"] = app; State["SelectedAppType"] = util.GetAppType(State); State["application_id"] = util.GetAppID(State); AppID = State["application_id"].ToString(); BillingUtil billingutil = new BillingUtil(); AppCGCustomerCode = billingutil.getAppPaidSKU(State); if (State["SelectedDeviceType"] == null) { State["SelectedDeviceView"] = State["SelectedDeviceType"] = Constants.IPHONE; } XmlUtil x_util = new XmlUtil(); State["SelectedDeviceView"] = State["SelectedDeviceType"] = x_util.GetAppDeviceType(State); string username = State["Username"].ToString(); State["customer_id"] = util.GetCustomerIDFromUsername(State, username); return true; }
private static RadWindow CreatePreviewWindow(RadRichTextBox rtb) { var printButton = new RadButton { Content = "Print", Margin = new Thickness(10, 0, 10, 0), FontWeight = FontWeights.Bold, Width = 80 }; printButton.Click += (s, e) => rtb.Print("MyDocument", Telerik.Windows.Documents.UI.PrintMode.Native); var sp = new StackPanel { Height = 26, Orientation = Orientation.Horizontal, Margin = new Thickness(10) }; sp.Children.Add(new RadRichTextBoxStatusBar { AssociatedRichTextBox = rtb, Margin = new Thickness(20, 0, 10, 0) }); sp.Children.Add(new TextBlock { Text = "Orientation:", Margin = new Thickness(10, 0, 3, 0), VerticalAlignment = VerticalAlignment.Center }); var radComboBoxPageOrientation = new RadComboBox { ItemsSource = new[] { "Portrait", "Landscape" }, SelectedIndex = 0 }; sp.Children.Add(radComboBoxPageOrientation); radComboBoxPageOrientation.SelectionChanged += (s, e) => rtb.ChangeSectionPageOrientation((PageOrientation)Enum.Parse(typeof(PageOrientation), radComboBoxPageOrientation.Items [ radComboBoxPageOrientation .SelectedIndex] .ToString(), true)); sp.Children.Add(new TextBlock { Text = "Size:", Margin = new Thickness(10, 0, 3, 0), VerticalAlignment = VerticalAlignment.Center }); var radComboBoxPageSize = new RadComboBox { ItemsSource = new[] { "A0", "A1", "A2", "A3", "A4", "A5", "Letter" }, Height = 25, SelectedIndex = 4, }; sp.Children.Add(radComboBoxPageSize); radComboBoxPageSize.SelectionChanged += (s, e) => rtb.ChangeSectionPageSize(PaperTypeConverter.ToSize((PaperTypes)Enum.Parse(typeof(PaperTypes), radComboBoxPageSize.Items[ radComboBoxPageSize .SelectedIndex] .ToString(), true))); sp.Children.Add(printButton); var g = new Grid(); g.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); g.RowDefinitions.Add(new RowDefinition()); g.Children.Add(sp); g.Children.Add(rtb); Grid.SetRow(rtb, 1); return new RadWindow { Content = g, Width = 900, Height = 600, Header = "Print Preview", WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen }; }
// Modified from original viziapps code with the additional checks so only valid ones are added to the ComboBox. private bool InitAppsList(Hashtable State, RadComboBox AppsList) { Util util = new Util(); try { if (AppsList == null) return false; // string sql = "SELECT DISTINCT application_name FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name"; //Get only native Apps to load onto this ComboBox. string sql = "SELECT DISTINCT application_name,application_id FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' AND application_type <> 'web'" + " ORDER BY application_name"; DB db = new DB(); DataRow[] rows = db.ViziAppsExecuteSql(State, sql); AppsList.Items.Clear(); foreach (DataRow row in rows) { string app_name = row["application_name"].ToString(); string application_id = row["application_id"].ToString(); BillingUtil billingutil = new BillingUtil(); //Inserting only Apps which meet all these criteria. if ((billingutil.IsAppStoreSubmissionPaid(State, app_name) == false) && // + never submitted for App preparation as yet. (billingutil.IsAppPaid(State, app_name) == false) && // + not yet paid for anything (util.IsFreeProductionValid(State, application_id) == true) && // + completed the Production Form Submission (billingutil.IsAppCancelled(State, app_name) == false)) // + never cancelled any service. { AppsList.Items.Add(new RadComboBoxItem(app_name, app_name)); } } if (AppsList.IsEmpty) return false; AppsList.Items.Insert(0, new RadComboBoxItem("Select App ->", "Select App ->")); AppsList.Items[0].Selected = true; return true; } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } return false; }