private void FillData() { CustomerRepository repo = new CustomerRepository(); GridCustomer.DataSource = repo.GetCustomers(); GridCustomer.DataBind(); }
protected void CallbackTest_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { String index = e.Parameter; MFCustomer cus = (MFCustomer)GridCustomer.GetRow(int.Parse(index)); Session["CurrentParty"] = cus.Party.PartyID; }
/*Callback from name search*/ protected void likeCustomerNameCallback_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { IList <Employer> accounts = this.FindLikeByName(iSabayaContext.PersistencySession, txtFirstName.Text); Session[this.GetType().ToString() + "GridEmployer"] = GetVOEmployerList(accounts); GridCustomer.DataSource = Session[this.GetType().ToString() + "GridEmployer"]; GridCustomer.DataBind(); }
/*Callback from name search*/ protected void likeCustomerNameCallback_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { IList <Member> employees = this.FindLikeByName(ASPxRadioButtonList1.SelectedIndex, txtFirstName.Text); GridCustomer.DataSource = employees; GridCustomer.DataBind(); Session[this.GetType().ToString() + "GridEmployee"] = employees; }
protected void cbFindEmployer_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { int id = int.Parse(e.Parameter); IList <Member> employees = this.FindByEmployer(iSabayaContext.PersistencySession, id); GridCustomer.DataSource = employees; GridCustomer.DataBind(); Session[this.GetType().ToString() + "GridEmployee"] = employees; }
protected void cbTest_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Session[this.GetType().ToString() + "GridEmployer"] = cboAccountNo.DataSource; cboAccountNo.ValueField = "EmployerID"; cboAccountNo.TextField = "OrganizationCode"; cboAccountNo.DataBind(); GridCustomer.DataSource = cboAccountNo.DataSource; GridCustomer.DataBind(); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!Page.IsCallback) { InitialControl(); if (Session[this.GetType().ToString() + "GridEmployer"] != null) { try { GridCustomer.DataSource = (IList <Employer>)Session[this.GetType().ToString() + "GridEmployer"]; GridCustomer.DataBind(); cboAccountNo.DataSource = GridCustomer.DataSource; cboAccountNo.ValueField = "EmployerID"; cboAccountNo.TextField = "OrganizationCode"; cboAccountNo.DataBind(); } catch (Exception ex) { throw new Exception(ex.Message); } } else { IList <Employer> employers = Employer.ListEffectiveEmployers(iSabayaContext); cboAccountNo.DataSource = employers; cboAccountNo.ValueField = "EmployerID"; cboAccountNo.TextField = "OrganizationCode"; cboAccountNo.DataBind(); Session[this.GetType().ToString() + "GridEmployer"] = cboAccountNo.DataSource; } if (Request["__EVENTARGUMENT"] != null) { string[] parameters = Request["__EVENTARGUMENT"].Split(';'); if (parameters.Length < 2) { return; } if (parameters[0].Equals("CH_EMP")) { int employerID; try { employerID = int.Parse(parameters[1]); } catch (FormatException fx) { throw new Exception(fx.Message + "Employer id string was not in a correct format"); } ChangeEmployerTradeDate(employerID); } } } }
protected void cbSelect_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { int rowIndex = int.Parse(e.Parameter); MFCustomer customer = (MFCustomer)GridCustomer.GetRow(rowIndex); if (customer != null) { Session[this.ID + this.GetType().ToString() + "SelectedRow"] = customer.CustomerID; txtMFCustomerNo.Text = customer.CustomerNo; e.Result = customer.CustomerNo; } }
/*Callback from name search*/ protected void likeCustomerNameCallback_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { String likeCustomerName = e.Parameter; String type = (String)ComboIPartyType.SelectedItem.Value; IList <MFCustomer> customers = MFCustomer.FindLikeByName(iSabayaContext, likeCustomerName, type); GridCustomer.DataSource = customers; GridCustomer.DataBind(); Session["GridCustomerVOS"] = customers; // Session["CurrentPersonID"]=null; }
/*Callback from card search*/ protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { TreeListNode identityCategory = ComboTLNCardType.SelectedNode; String identityNo = TextCardCode.Text; String type = (String)ComboIPartyType.SelectedItem.Value; IList <Party> partys = this.FindByIdentity(identityCategory, identityNo); if (partys != null) { IList <MFCustomer> customers = new List <MFCustomer>(); foreach (Party party in partys) { MFCustomer cus = MFCustomer.FindByParty(iSabayaContext, party); if (cus != null) { customers.Add(cus); } if (party != null) { if (type.Equals("A")) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } else if (type.Equals("O")) { if (party is Organization || party is OrgUnit) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } } else if (type.Equals("P")) { if (party is Person) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } } Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"] = customers; } GridCustomer.DataSource = customers; GridCustomer.DataBind(); } if (TextLostFocus != null) { TextLostFocus(this, EventArgs.Empty); } } }
private void Export(bool optionCustomersWithOrders, bool optionNewsletterSubscribers) { List <object> exportList = new List <object>(); if (optionNewsletterSubscribers) { List <NewsLetter> newsletterMailingList = NewsLetter.NewsLetterMailingList(optionCustomersWithOrders); exportList = newsletterMailingList.ConvertAll <object>(delegate(NewsLetter g) { return((object)g); }); } else { List <GridCustomer> customerList = new List <GridCustomer>(); if (optionCustomersWithOrders) // filter to customers only with orders { var allCustomers = GridCustomer.GetCustomers(); foreach (var c in allCustomers) { Customer customer = new Customer(c.CustomerID); if (customer.HasOrders()) { customerList.Add(c); } } } else // return all customers { customerList = GridCustomer.GetCustomers(); } exportList = customerList.ConvertAll <object>(delegate(GridCustomer g) { return((object)g); }); } StringBuilder strMailingList = new StringBuilder(); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=MailingList.csv"); Response.ContentType = "text/csv"; Response.AddHeader("Pragma", "public"); strMailingList.Append(CSVExporter.ExportListToCSV(exportList)); Response.Write(strMailingList.ToString()); Response.End(); }
protected void cbpTxtMFAccountNo_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { ASPxCallbackPanel cbp = (ASPxCallbackPanel)source; FindCustomNameOrCustomNo(e.Parameter); cboAccountNo.Items.Clear(); cboAccountNo.Value = null; cboAccountNo.Text = null; lblMFCustomerName.Text = ""; cboAccountNo.DataSource = Session[this.GetType().ToString() + "GridMFAccount"]; //cboAccountNo.ValueField = "AccountID"; //cboAccountNo.TextField = "AccountNo"; cboAccountNo.DataBind(); GridCustomer.DataSource = Session[this.GetType().ToString() + "GridMFAccount"]; GridCustomer.DataBind(); cbp.JSProperties["cpResult"] = true; }
/*Callback from name search*/ protected void likeCustomerNameCallback_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { bool isFName = rdoFname.Checked; String likeCustomerName = ""; if (isFName) { likeCustomerName = txtFirstName.Text; } else { likeCustomerName = txtLastName.Text; } String type = (String)ComboIPartyType.SelectedItem.Value; IList <MFCustomer> customers = this.FindLikeByName(isFName, likeCustomerName, type); GridCustomer.DataSource = customers; GridCustomer.DataBind(); Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"] = customers; }
protected void cbTest_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { IList <MFAccount> accounts = MFAccount.List(iSabayaContext); IList <MFAccount_MFAccountControl_Vo> vos = new List <MFAccount_MFAccountControl_Vo>(); List <MFAccount> resultCanSee = new List <MFAccount>(); this.User.Person.FilterPortfolios(iSabayaContext, accounts, resultCanSee); foreach (MFAccount a in resultCanSee) { vos.Add(new MFAccount_MFAccountControl_Vo(this.LanguageCode, a)); } Session[this.GetType().ToString() + "GridMFAccount"] = vos; Session[this.GetType().ToString() + "MFAccountLists"] = GetMFAccountLists(); cboAccountNo.DataSource = GetMFAccountLists(); //cboAccountNo.ValueField = "AccountID"; //cboAccountNo.TextField = "AccountNo"; cboAccountNo.DataBind(); GridCustomer.DataSource = vos; GridCustomer.DataBind(); }
private void btn_Save_Click(object sender, EventArgs e) { Action_DbSave(); GridCustomer.Refresh(); GridOrder.Refresh(); }
private void But_connect_Click(object sender, EventArgs e) { connection = new SqlConnection(connectString); connection.Open(); //MessageBox.Show(connection.State.ToString()); ds = new DataSet("Northwind"); SqlCommand command; daState = new SqlDataAdapter(); command = new SqlCommand("Select * From State", connection); daState.SelectCommand = command; dtState = ds.Tables.Add("State"); daState.Fill(dtState); daCustomer = new SqlDataAdapter(); // - SELECT command = new SqlCommand("Select ':)' as Etykieta,* From Customer", connection); daCustomer.SelectCommand = command; // - INSERT command = new SqlCommand("INSERT INTO Customer (FirstName,LastName,Address,City,State,ZipCode,AccountNumber) VALUES (@FirstName,@LastName,@Address,@City,@State,@ZipCode,@AccountNumber)", connection); //command.Parameters.Add("@id", SqlDbType.Int, 0, "id"); command.Parameters.Add("@FirstName", SqlDbType.NVarChar, 40, "FirstName"); command.Parameters.Add("@LastName", SqlDbType.NVarChar, 40, "LastName"); command.Parameters.Add("@Address", SqlDbType.NVarChar, 40, "Address"); command.Parameters.Add("@City", SqlDbType.NVarChar, 40, "City"); command.Parameters.Add("@State", SqlDbType.NVarChar, 40, "State"); command.Parameters.Add("@ZipCode", SqlDbType.NVarChar, 40, "ZipCode"); command.Parameters.Add("@AccountNumber", SqlDbType.NVarChar, 40, "AccountNumber"); daCustomer.InsertCommand = command; // - UPDATE command = new SqlCommand("UPDATE Customer SET FirstName = @FirstName, LastName = @LastName, Address = @Address, City = @City, State = @State, ZipCode = @ZipCode, AccountNumber = @AccountNumber WHERE id = @oldid", connection); //command.Parameters.Add("@id", SqlDbType.NChar, 5, "id"); command.Parameters.Add("@FirstName", SqlDbType.NVarChar, 40, "FirstName"); command.Parameters.Add("@LastName", SqlDbType.NVarChar, 40, "LastName"); command.Parameters.Add("@Address", SqlDbType.NVarChar, 40, "Address"); command.Parameters.Add("@City", SqlDbType.NVarChar, 40, "City"); command.Parameters.Add("@State", SqlDbType.NVarChar, 40, "State"); command.Parameters.Add("@ZipCode", SqlDbType.NVarChar, 40, "ZipCode"); command.Parameters.Add("@AccountNumber", SqlDbType.NVarChar, 40, "AccountNumber"); SqlParameter parameter = command.Parameters.Add("@oldid", SqlDbType.Int, 0, "id"); parameter.SourceVersion = DataRowVersion.Original; daCustomer.UpdateCommand = command; // - DELETE command = new SqlCommand("DELETE FROM Customer WHERE id = @id", connection); // Add the parameters for the DeleteCommand. parameter = command.Parameters.Add("@id", SqlDbType.Int, 0, "id"); parameter.SourceVersion = DataRowVersion.Original; daCustomer.DeleteCommand = command; dtCustomer = ds.Tables.Add("Customer"); daCustomer.Fill(dtCustomer); bsCustomer = new BindingSource(); bsCustomer.DataSource = dtCustomer; //bsCustomer.CurrentChanged += new EventHandler(Current_Changed); GridCustomer.AutoSize = false; GridCustomer.DataSource = bsCustomer; NavigatorCustomer.BindingSource = bsCustomer; GridCustomer.Use(p => { p.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9, FontStyle.Bold); p.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black; p.ColumnHeadersDefaultCellStyle.BackColor = Color.Yellow; p.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.TopLeft; p.EnableHeadersVisualStyles = false; p.AutoGenerateColumns = false; p.Columns.Clear(); int iCol; iCol = p.Columns.Add("col_FirstName", "Imię"); p.Columns[iCol].DataPropertyName = "FirstName"; iCol = p.Columns.Add("col_LastName", "Nazwisko"); p.Columns[iCol].DataPropertyName = "LastName"; iCol = p.Columns.Add("col_Address", "Ulica"); p.Columns[iCol].DataPropertyName = "Address"; iCol = p.Columns.Add("col_City", "Miejscowość"); p.Columns[iCol].DataPropertyName = "City"; //iCol = p.Columns.Add("col_State", "Województwo"); //p.Columns[iCol].DataPropertyName = "State"; DataGridViewComboBoxColumn cb = new DataGridViewComboBoxColumn(); cb.HeaderText = "Województwo"; cb.DataPropertyName = "State"; cb.Name = "col_State"; cb.MaxDropDownItems = 4; cb.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; //cb.Items.Add("Śląskie"); //cb.Items.Add("Małopolskie"); cb.DataSource = dtState; cb.ValueMember = "name"; cb.DisplayMember = "name"; p.Columns.Add(cb); iCol = p.Columns.Add("col_ZipCode", "Kod pocztowy"); p.Columns[iCol].DataPropertyName = "ZipCode"; iCol = p.Columns.Add("col_AccountNumber", "Nr konta"); p.Columns[iCol].DataPropertyName = "AccountNumber"; //p.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }); daOrder = new SqlDataAdapter(); // - SELECT command = new SqlCommand("Select * From Orders", connection); daOrder.SelectCommand = command; // - INSERT command = new SqlCommand("INSERT INTO ORDERS (CustomerId,OrderDate,Invoice,Paymend,Price) VALUES (@CustomerId,@OrderDate,@Invoice,@Paymend,@Price)", connection); command.Parameters.Add("@CustomerId", SqlDbType.Int, 0, "CustomerId"); command.Parameters.Add("@OrderDate", SqlDbType.Date, 0, "OrderDate"); command.Parameters.Add("@Invoice", SqlDbType.NVarChar, 100, "Invoice"); command.Parameters.Add("@Paymend", SqlDbType.Int, 0, "Paymend"); command.Parameters.Add("@Price", SqlDbType.Money, 0, "Price"); daOrder.InsertCommand = command; // - UPDATE command = new SqlCommand("UPDATE ORDERS SET OrderDate = @OrderDate, Invoice = @Invoice, Paymend = @Paymend, Price = @Price WHERE id = @oldid", connection); command.Parameters.Add("@OrderDate", SqlDbType.Date, 0, "OrderDate"); command.Parameters.Add("@Invoice", SqlDbType.NVarChar, 100, "Invoice"); command.Parameters.Add("@Paymend", SqlDbType.Int, 0, "Paymend"); command.Parameters.Add("@Price", SqlDbType.Money, 0, "Price"); parameter = command.Parameters.Add("@oldid", SqlDbType.Int, 0, "id"); parameter.SourceVersion = DataRowVersion.Original; daOrder.UpdateCommand = command; // - DELETE command = new SqlCommand("DELETE FROM ORDERS WHERE id = @id", connection); // Add the parameters for the DeleteCommand. parameter = command.Parameters.Add("@id", SqlDbType.Int, 0, "id"); parameter.SourceVersion = DataRowVersion.Original; daOrder.DeleteCommand = command; dtOrder = ds.Tables.Add("Orders"); daOrder.Fill(dtOrder); DataRelation relCustOrder = new DataRelation("CustomersOrders", dtCustomer.Columns["id"], dtOrder.Columns["customerID"]); // Add the relation to the DataSet. ds.Relations.Add(relCustOrder); bsOrder = new BindingSource(); bsOrder.DataSource = bsCustomer; bsOrder.DataMember = "CustomersOrders"; // -- NavigatorOrder.BindingSource = bsOrder; GridOrder.Use(p => { p.DataSource = bsOrder; p.AutoSize = false; p.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9, FontStyle.Bold); p.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black; p.ColumnHeadersDefaultCellStyle.BackColor = Color.Yellow; p.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.TopLeft; p.EnableHeadersVisualStyles = false; p.AutoGenerateColumns = false; p.Columns.Clear(); //p.Columns.Add("OrderDate", "Data zamówienia"); DataGridViewColumn col1 = new DataGridViewTextBoxColumn(); col1.DataPropertyName = "Invoice"; col1.Name = "Invoice"; col1.HeaderText = "Nr paragonu"; col1.ValueType = typeof(string); p.Columns.Add(col1); col1.Dispose(); //DataGridViewColumn col2 = new DataGridViewTextBoxColumn(); CalendarColumn col2 = new CalendarColumn(); col2.DataPropertyName = "OrderDate"; col2.Name = "OrderDate"; col2.HeaderText = "Data zamówienia"; col2.ValueType = typeof(DateTime); p.Columns.Add(col2); col2.Dispose(); DataGridViewCheckBoxColumn chbox = new DataGridViewCheckBoxColumn(); chbox.DataPropertyName = "Paymend"; chbox.Name = "Paymend"; chbox.HeaderText = "Czy zapłacone"; chbox.ValueType = typeof(int); p.Columns.Add(chbox); DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.DataPropertyName = "Price"; col4.Name = "Price"; col4.HeaderText = "Kwota"; col4.ValueType = typeof(float); col4.DefaultCellStyle.Format = "c"; p.Columns.Add(col4); DataGridViewImageColumn img = new DataGridViewImageColumn(); img.Name = "Image"; img.HeaderText = "Ikona"; img.ValuesAreIcons = true; p.Columns.Add(img); }); ControlsStat(); }
protected void Page_Load(object sender, EventArgs e) { //remove selection row in new search GridCustomer.SelectRow(-1); }
protected void Button1_Click(object sender, EventArgs e) { GridCustomer.DataSource = _repo.GetCustomers(TxtName.Text); GridCustomer.DataBind(); }
private void FillData() { GridCustomer.DataSource = _repo.GetCustomers(); GridCustomer.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { btnEmployeeBrowse.Enabled = Enabled; #region coke 14072009 hh:mm if (IsRequiredField) { btnEmployeeBrowse.ValidationSettings.ValidationGroup = ValidationGroup; btnEmployeeBrowse.ValidationSettings.SetFocusOnError = true; btnEmployeeBrowse.ValidationSettings.ErrorText = "ErrorText"; btnEmployeeBrowse.ValidationSettings.ValidateOnLeave = true; btnEmployeeBrowse.ValidationSettings.ErrorImage.Height = Unit.Pixel(16); btnEmployeeBrowse.ValidationSettings.ErrorImage.Width = Unit.Pixel(16); btnEmployeeBrowse.ValidationSettings.ErrorImage.AlternateText = "Error"; btnEmployeeBrowse.ValidationSettings.ErrorImage.Url = "~/Images/iconError.png"; btnEmployeeBrowse.ValidationSettings.RequiredField.IsRequired = true; btnEmployeeBrowse.ValidationSettings.RequiredField.ErrorText = "กรุณากรอกข้อมูล"; btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.ForeColor = System.Drawing.Color.Red; btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.Paddings.Padding = Unit.Pixel(0); btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.Paddings.PaddingLeft = Unit.Pixel(0); btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.BackgroundImage.ImageUrl = "~/Images/bgError.png"; btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.Border.BorderColor = System.Drawing.ColorTranslator.FromHtml("#FD4D3E"); btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.Border.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid; btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.Border.BorderWidth = Unit.Pixel(0); btnEmployeeBrowse.ValidationSettings.ErrorFrameStyle.ErrorTextPaddings.PaddingRight = Unit.Pixel(0); btnEmployeeBrowse.ValidationSettings.Display = Display.Dynamic; } #endregion #region first load if (IsPostBack == false) { //if (Name == "") //{ // Name = this.ClientID; //} //load employer to combo //IList<Member> employers = loadEmployee(); Session[this.GetType().ToString() + "GridEmployee"] = null; cbpTxtEmployerNo.ClientInstanceName = this.ClientID + cbpTxtEmployerNo.ClientID; GridCustomer.ClientInstanceName = this.ClientID + GridCustomer.ClientID; txtFirstName.ClientInstanceName = this.ClientID + txtFirstName.ClientID; btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; CallbacklikeCustomerName.ClientInstanceName = this.ClientID + CallbacklikeCustomerName.ClientID; //btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; labelTitle.ClientInstanceName = this.ClientID + labelTitle.ClientID; popupAccount.ClientInstanceName = this.ClientID + popupAccount.ClientID; //cbChangeEmployer.ClientInstanceName = this.ClientID + cbChangeEmployer.ClientID; cbChangeEmployer.ClientInstanceName = "employeeControl_cbChangeEmployer"; lblEmployerID.ClientInstanceName = ControlName != null ? ControlName : this.ClientID + lblEmployerID.ClientID; cbFindEmployer.ClientInstanceName = this.ClientID + cbFindEmployer.ClientID; cbGetAccountNo.ClientInstanceName = this.ClientID + cbGetAccountNo.ClientID; btnAddAll.ClientInstanceName = this.ClientID + btnAddAll.ClientID; if (Name != "") { btnEmployeeBrowse.ClientInstanceName = "btnEmployeeBrowse" + Name; } else { btnEmployeeBrowse.ClientInstanceName = this.ClientID + btnEmployeeBrowse.ClientID; } ddDepartment.ClientInstanceName = "ddDepartment" + departmentCtrlName; //Employer employer = getPageEmployer(); //if (employer != null) //{ // IList<OrgUnit> units = employer.EmployerOrg.OrgUnits; // ddDepartment.DataSource = units; // ddDepartment.TextField = "FullName"; // ddDepartment.ValueField = "ID"; // ddDepartment.DataBind(); //} btnEmployeeBrowse.ClientSideEvents.ButtonClick = @"function(s,e){ var id = " + lblEmployerID.ClientInstanceName + @".GetText(); if(typeof id != 'undefined' && id !== null && id !== ''){ " + cbFindEmployer.ClientInstanceName + @".SendCallback(id); } if(typeof(onLoadEmployee) != 'undefined'){ onLoadEmployee.SendCallback(); } var win = " + popupAccount.ClientInstanceName + @".GetWindow(0); " + popupAccount.ClientInstanceName + @".ShowWindow(win); }"; btnEmployeeBrowse.ClientSideEvents.LostFocus = @"function(s,e){ " + cbGetAccountNo.ClientInstanceName + @".SendCallback(" + btnEmployeeBrowse.ClientInstanceName + @".GetText()); }"; cbGetAccountNo.ClientSideEvents.CallbackComplete = @"function(s,e){ var obj = eval('('+e.result+')'); if(obj.success){ " + labelTitle.ClientInstanceName + @".SetText(obj.name); }else{ " + labelTitle.ClientInstanceName + @".SetText(''); " + btnEmployeeBrowse.ClientInstanceName + @".SetText(''); } }"; String ScriptAppend = ""; if (IsUseOnComplete) { ScriptAppend = @"if(typeof(onCompleteLoadEmployee) != 'undefined'){ onCompleteLoadEmployee(); }"; } GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e){ var buttonID = e.buttonID; var visibleIndex = e.visibleIndex; if(buttonID = 'buttonSelect') { " + GridCustomer.ClientInstanceName + @".GetRowValues(visibleIndex,'AccountID;EmployeeNo;FullName', function (values){ " + btnEmployeeBrowse.ClientInstanceName + @".SetText(values[1]); " + labelTitle.ClientInstanceName + @".SetText(values[2]); " + popupAccount.ClientInstanceName + @".Hide(); if(typeof(cbSelectEmployee) != 'undefined'){ //alert(values[0]); cbSelectEmployee.PerformCallback(values[0]); } " + ScriptAppend + @" } ); }//end if }"; btnFindName.ClientSideEvents.Click = @"function(s,e){ " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback(); }"; CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s,e){ " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; cbChangeEmployer.ClientSideEvents.CallbackComplete = @"function(s,e){ //alert(e.result); //" + lblEmployerID.ClientInstanceName + @".Set('empId',e.result); " + lblEmployerID.ClientInstanceName + @".SetText(e.result); //alert(" + lblEmployerID.ClientInstanceName + @".Get('empId')); //alert(" + lblEmployerID.ClientInstanceName + @".GetText()); " + lblEmployerID.ClientInstanceName + @".SetVisible(false); }"; cbFindEmployer.ClientSideEvents.CallbackComplete = @"function(s,e){ " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; btnAddAll.ClientSideEvents.Click = @"function(s,e){ var grid = " + GridCustomer.ClientInstanceName + @"; grid.GetSelectedFieldValues('EmployeeNo', function (values){ //alert('select'+values.length); var ids=''; for(var i = 0;i < values.length;i++){ ids+='\''+values[i]+'\','; } ids=ids.substring(0, ids.length-1) " + btnEmployeeBrowse.ClientInstanceName + @".SetText(ids); " + popupAccount.ClientInstanceName + @".Hide(); } ); }"; }//end postback false #endregion if (Session[this.GetType().ToString() + "GridEmployee"] != null) { GridCustomer.DataSource = (IList <Member>)Session[this.GetType().ToString() + "GridEmployee"]; GridCustomer.DataBind(); } String[] divs = GetDivisionCodes(); if (divs != null) { List <VODivisionCode> vos = new List <VODivisionCode>(); foreach (String s in divs) { VODivisionCode vo = new VODivisionCode(); vo.DivisionCode = s; vos.Add(vo); } ddDepartment.DataSource = vos; ddDepartment.ValueField = "DivisionCode"; ddDepartment.TextField = "DivisionCode"; ddDepartment.DataBind(); ddDepartment.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { #region first load if (IsPostBack == false) { if (Name == "") { Name = this.ClientID; } //load employer to combo IList <Employer> employers = Employer.ListAll(iSabayaContext); cboAccountNo.ClientInstanceName = this.ClientID + cboAccountNo.ClientID; cbpTxtEmployerNo.ClientInstanceName = this.ClientID + cbpTxtEmployerNo.ClientID; btnBrowse.ClientInstanceName = this.ClientID + btnBrowse.ClientID; GridCustomer.ClientInstanceName = this.ClientID + GridCustomer.ClientID; txtFirstName.ClientInstanceName = this.ClientID + txtFirstName.ClientID; btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; CallbacklikeCustomerName.ClientInstanceName = this.ClientID + CallbacklikeCustomerName.ClientID; btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; labelTitle.ClientInstanceName = this.ClientID + labelTitle.ClientID; popupAccount.ClientInstanceName = this.ClientID + popupAccount.ClientID; /*Create json for store MAP<EmployerID, Name>*/ JsonObjectCollection json = null; if (Session[this.ClientID + "ctrls_MFAccountControlNew_employers"] == null) { json = new JsonObjectCollection(); foreach (Employer employer in employers) { json.Add(new JsonStringValue(employer.EmployerID + "", employer.Name.ToString(iSabayaContext.CurrentCurrency.Code))); } Session[this.ClientID + "ctrls_MFAccountControlNew_employers"] = json.ToString(); } /*Create json for store MAP<EmployerID, Name>*/ String mfaccountMap = (String)Session[this.ClientID + "ctrls_MFAccountControlNew_employers"]; cboAccountNo.ClientSideEvents.Init = @" function(s,e){ document.emploterMap = eval(" + mfaccountMap + @"); } "; cboAccountNo.ClientSideEvents.SelectedIndexChanged = @"function(s,e){ " + labelTitle.ClientInstanceName + @".SetText(document.emploterMap[s.GetValue()]); if(typeof(" + JSEmployerChangedFName + @") != 'undefined') { " + JSEmployerChangedFName + @"(s.GetValue()); }else { if(typeof(oncompleteLoadEmployer) != 'undefined'){ oncompleteLoadEmployer(); } if(typeof(employeeControl_cbChangeEmployer) != 'undefined'){ employeeControl_cbChangeEmployer.SendCallback(s.GetValue()); } if(typeof(selectreport2_cbpChangeEmployer) != 'undefined'){ //alert(s.GetValue()); //selectreport2_cbpChangeEmployer.PerformCallback(); } } } "; CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) { " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; btnFindName.ClientSideEvents.Click = @"function(s, e) { " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback(); }"; btnBrowse.ClientSideEvents.Click = @"function(s,e){ var win = " + popupAccount.ClientInstanceName + @".GetWindow(0); " + popupAccount.ClientInstanceName + @".ShowWindow(win); }"; GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e){ var buttonID = e.buttonID; var visibleIndex = e.visibleIndex; if(buttonID = 'buttonSelect') { " + GridCustomer.ClientInstanceName + @".GetRowValues(visibleIndex,'EmployerID;EmployerNo', function (values){ " + labelTitle.ClientInstanceName + @".SetText(document.emploterMap[values[0]]); for(var i = 0;i<" + employers.Count + @";i++){ var id = " + cboAccountNo.ClientInstanceName + @".GetItem(i).value; if(parseInt(id)==parseInt(values[0])){ " + cboAccountNo.ClientInstanceName + @".SetSelectedIndex(i); break; } } " + popupAccount.ClientInstanceName + @".Hide(); } ); }//end if }"; }//end postback false #endregion if (Session[this.GetType().ToString() + "GridEmployer"] != null) { GridCustomer.DataSource = Session[this.GetType().ToString() + "GridEmployer"]; GridCustomer.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { cboAccountNo.SetValidation(ValidationGroup, IsRequiredField); lblMFCustomerName.ClientInstanceName = (lblAccountDetail != null ? lblAccountDetail : lblMFCustomerName.ClientID); Session[this.GetType().ToString() + "GridMFAccount"] = null; Session[this.GetType().ToString() + "MFAccountLists"] = null; //game lblMFCustomerName.Cursor = "pointer"; } if (Session[this.GetType().ToString() + "GridMFAccount"] != null) { IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"]; GridCustomer.DataSource = vos; GridCustomer.DataBind(); cboAccountNo.DataSource = Session[this.GetType().ToString() + "MFAccountLists"]; cboAccountNo.DataBind(); } else { if (IsPostBack == false) { IList <MFAccount> mfaccounts = MFAccount.List(iSabayaContext); List <MFAccount> resultCanSee = new List <MFAccount>(); this.User.Person.FilterPortfolios(iSabayaContext, mfaccounts, resultCanSee); if (Session["ctrls_MFAccountControlNew_mfaccounts"] == null) { JsonObjectCollection json = new JsonObjectCollection(); foreach (MFAccount account in resultCanSee) { json.Add(new JsonStringValue(account.AccountID + "", account.Name.ToString())); } Session["ctrls_MFAccountControlNew_mfaccounts"] = json.ToString(); } IList <MFAccount_MFAccountControl_Vo> vos = new List <MFAccount_MFAccountControl_Vo>(); foreach (MFAccount a in resultCanSee) { vos.Add(new MFAccount_MFAccountControl_Vo(this.LanguageCode, a)); } Session[this.GetType().ToString() + "GridMFAccount"] = vos; GridCustomer.DataSource = vos; GridCustomer.DataBind(); Session[this.GetType().ToString() + "MFAccountLists"] = GetMFAccountLists(); cboAccountNo.DataSource = GetMFAccountLists(); //cboAccountNo.ValueField = "AccountID"; //cboAccountNo.TextField = "AccountNo"; cboAccountNo.DataBind(); } } if (!Page.IsCallback) { cbTest.ClientSideEvents.CallbackComplete = @"function(s, e) { this.MyResult=e.result; " + cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback(); }"; CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) { this.MyResult=e.result; " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; btnFindName.ClientSideEvents.Click = @"function(s, e) { var a = " + txtFirstName.ClientInstanceName + @".GetText(); if(a != '') " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback(); }"; if (cboAccountNo.Buttons[0] != null) { cboAccountNo.ClientSideEvents.ButtonClick = @"function(s,e) { if(e.buttonIndex == 0) { var win = " + popupAccount.ClientInstanceName + @".GetWindow(0); " + popupAccount.ClientInstanceName + @".ShowWindow(win); } }"; } ; IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"]; GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e) { var buttonID = e.buttonID; var visibleIndex = parseInt(e.visibleIndex); if(buttonID = 'buttonSelect') { " + GridCustomer.ClientInstanceName + @".GetRowValues(visibleIndex,'AccountID;AccountNo', function (values) { " + lblMFCustomerName.ClientInstanceName + @".SetText(document.mfaccountMap[values[0]]); for(var i = 0;i<" + vos.Count + @";i++){ var id = " + cboAccountNo.ClientInstanceName + @".GetItem(i).value; if(parseInt(id)==parseInt(values[0])){ " + cboAccountNo.ClientInstanceName + @".SetSelectedIndex(i); break; } } " + popupAccount.ClientInstanceName + @".Hide(); } ); } }"; btnViewSignature.Visible = this.showOwnerSignature; //game popupViewSignature.PopupElementID = btnViewSignature.ClientID; string ifPageForTransaction = ""; if (isTransaction) { ifPageForTransaction = cbCheckOwner.ClientInstanceName + @".SendCallback();"; } //game cbCheckOwner.ClientSideEvents.CallbackComplete = @"function(s, e){ var a = e.result; if(a != ''){ //alert( a ); document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = ''; }else{ document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = 'none'; } }"; cboAccountNo.ClientSideEvents.SelectedIndexChanged = @"function(s,e) { var value = s.GetValue(); var str = document.mfaccountMap[s.GetValue()]; " + lblMFCustomerName.ClientInstanceName + @".SetText(str); if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined') { " + btnViewSignature.ClientInstanceName + @".SetVisible(str != ''); " + cbpViewSignature.ClientInstanceName + @".PerformCallback(); } if(typeof(oncompleteLoadMFAccount) != 'undefined'){ oncompleteLoadMFAccount(); } if(typeof(loadMFAccountFund) != 'undefined'){ loadMFAccountFund(" + cboAccountNo.ClientInstanceName + @".GetValue()); } if(typeof(loadMFAccountBankAccount) != 'undefined'){ loadMFAccountBankAccount(" + cboAccountNo.ClientInstanceName + @".GetValue()); }" + ifPageForTransaction + @"var name = str; " + ClientSideEvents.AfterSelectedChanged + @" //document.getElementById('trComboAccount').style.display = 'none'; //document.getElementById('trCustomerName').style.display = ''; }"; lblMFCustomerName.ClientSideEvents.Click = @"function(s, e){ //document.getElementById('trComboAccount').style.display = ''; //document.getElementById('trCustomerName').style.display = 'none'; }"; cbTest.ClientSideEvents.CallbackComplete = @"function(s,e) { " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; String mfaccountMap = (String)Session["ctrls_MFAccountControlNew_mfaccounts"]; cboAccountNo.ClientSideEvents.Init = @"function(s,e) { if(" + cboAccountNo.ClientInstanceName + @".GetItemCount()<=0){ " + cbTest.ClientInstanceName + @".SendCallback(); } document.mfaccountMap = eval(" + mfaccountMap + @"); }"; btnViewSignature.ClientSideEvents.Init = @"function(s,e) { document.getElementById('" + divBiewSignature.ClientID + @"').style.visibility = 'visible'; if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined') " + btnViewSignature.ClientInstanceName + @".SetVisible(" + lblMFCustomerName.ClientInstanceName + @".GetText() != ''); }"; btnViewSignature.ClientSideEvents.Click = @"function(s,e) { " + popupViewSignature.ClientInstanceName + @".Show(); }"; cbpTxtMFAccountNo.ClientSideEvents.EndCallback = @"function(s,e) { if(typeof(s.cpResult) != 'undefined' && s.cpResult) { " + lblMFCustomerName.ClientInstanceName + @".SetText(''); s.cpResult = null; } }"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { initControl("th", PersistenceLayer.WebSessionManager.PersistenceSession); ComboTLNCardType.ParentNode = TreeListNode.FindByCode(iSabayaContext, "cardtype"); ComboTLNCardType.DataBind(); ASPxPopupControl1.ClientInstanceName = ASPxPopupControl1.ClientID; LabelCustomerName.ClientInstanceName = LabelCustomerName.ClientID; cbpGridAccountOutput.ClientInstanceName = cbpGridAccountOutput.ClientID; CallbackSearchByCard.ClientInstanceName = CallbackSearchByCard.ClientID; CallbacklikeCustomerName.ClientInstanceName = CallbacklikeCustomerName.ClientID; Callback1FromPopup.ClientInstanceName = Callback1FromPopup.ClientID; GridCustomer.ClientInstanceName = GridCustomer.ClientID; TextSearchString.ClientInstanceName = TextSearchString.ClientID; ButtonSearch.ClientInstanceName = ButtonSearch.ClientID; buttonApplyAndClose.ClientInstanceName = buttonApplyAndClose.ClientID; buttonClose.ClientInstanceName = buttonClose.ClientID; /*LostFocus*/ TextCardCode.ClientSideEvents.LostFocus = @"function(s, e) {"; TextCardCode.ClientSideEvents.LostFocus += CallbackSearchByCard.ClientInstanceName + ".SendCallback(s.GetValue()); }"; /*Search by card complete*/ CallbackSearchByCard.ClientSideEvents.CallbackComplete = @"function(s, e) { document.getElementById('" + LabelCustomerName.ClientInstanceName + @"').innerHTML=e.result; " + cbpGridAccountOutput.ClientInstanceName + @".PerformCallback(); setTimeout('" + GridName + ".PerformCallback()', 5000); "; CallbackSearchByCard.ClientSideEvents.CallbackComplete += @" var params = new Array(1); params['source']='completeSearch'; //alert(eventCallback); //if(eventCallback!= undefined){ // eventCallback(params); //} }"; /*Click search from name*/ String script = "function(s, e) { var likeCustomerName = " + TextSearchString.ClientInstanceName + ".GetValue();"; script += " " + CallbacklikeCustomerName.ClientInstanceName + ".SendCallback(likeCustomerName);"; script += "var win = " + ASPxPopupControl1.ClientInstanceName + ".GetWindow(0);"; script += ASPxPopupControl1.ClientInstanceName + ".ShowWindow(win);"; script += "}"; ButtonSearch.ClientSideEvents.Click = script; /*show grid name like criteria*/ CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) { " + cbpGridAccountOutput.ClientInstanceName + @".PerformCallback(); " + GridCustomer.ClientInstanceName + ".PerformCallback(); " + GridCustomer.ClientInstanceName + ".SetFocusedRowIndex(0); }"; /*grid FocusedRowChanged*/ GridCustomer.ClientSideEvents.FocusedRowChanged = @"function(s, e) { if(" + GridCustomer.ClientInstanceName + ".GetFocusedRowIndex()!=-1){"; GridCustomer.ClientSideEvents.FocusedRowChanged += CallbackTest.ClientInstanceName + ".SendCallback(" + GridCustomer.ClientInstanceName + ".GetFocusedRowIndex());} }"; /*click select from popup*/ String scriptString1 = "function(s, e) { "; scriptString1 += Callback1FromPopup.ClientInstanceName + ".SendCallback();"; scriptString1 += cbpGridAccountOutput.ClientInstanceName + ".PerformCallback();"; scriptString1 += ASPxPopupControl1.ClientInstanceName + ".Hide();"; scriptString1 += " }"; buttonApplyAndClose.ClientSideEvents.Click = scriptString1; String scriptStringClose = "function(s, e) { "; scriptString1 += ASPxPopupControl1.ClientInstanceName + ".Hide();"; scriptString1 += " }"; buttonClose.ClientSideEvents.Click = scriptStringClose; /*Search by name complete after selected from grid*/ Callback1FromPopup.ClientSideEvents.CallbackComplete = @"function(s, e) { document.getElementById('" + LabelCustomerName.ClientInstanceName + "').innerHTML=e.result; setTimeout('" + GridName + ".PerformCallback()', 5000); "; Callback1FromPopup.ClientSideEvents.CallbackComplete += @" var params = new Array(1); params['source']='completeSearch'; if(typeof(eventCallback)!='undefined'){ eventCallback(params); } }"; gridAccountOutput.ClientInstanceName = gridAccountOutput.ClientID; cbSelectedIndexChnage.ClientInstanceName = cbSelectedIndexChnage.ClientID; gridAccountOutput.ClientSideEvents.FocusedRowChanged = @"function(s, e) { /*alert('hi');*/ var rowIndex = " + gridAccountOutput.ClientInstanceName + @".GetFocusedRowIndex(); " + cbSelectedIndexChnage.ClientInstanceName + @".SendCallback(rowIndex); }"; } if (Session[this.ID + "cbpGridAccountOutput"] != null) { IList <MFAccount> accounts = (IList <MFAccount>)Session[this.ID + "cbpGridAccountOutput"]; gridAccountOutput.DataSource = accounts; gridAccountOutput.DataBind(); } if (Session["GridCustomerVOS"] != null) { GridCustomer.DataSource = (IList <MFCustomer>)Session["GridCustomerVOS"]; GridCustomer.DataBind(); } if (Session[this.ID + "ctrls_CustomerControl_CurrentParty"] != null) { partyId = (int)Session[this.ID + "ctrls_CustomerControl_CurrentParty"]; } }
private void GridCustomer_CellValueChanged(object sender, DataGridViewCellEventArgs e) { GridCustomer.CommitEdit(DataGridViewDataErrorContexts.Commit); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ComboTLNCardType.ParentNode = TreeListNode.FindByCode(iSabayaContext, "cardtype"); ComboTLNCardType.DataBind(); CallbackSearchByCard.ClientInstanceName = this.ClientID + CallbackSearchByCard.ClientID; CallbacklikeCustomerName.ClientInstanceName = this.ClientID + CallbacklikeCustomerName.ClientID; cbSelect.ClientInstanceName = this.ClientID + cbSelect.ClientID; cbLostFocus.ClientInstanceName = this.ClientID + cbLostFocus.ClientID; GridCustomer.ClientInstanceName = this.ClientID + GridCustomer.ClientID; txtFirstName.ClientInstanceName = this.ClientID + txtFirstName.ClientID; btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; btnFindCard.ClientInstanceName = this.ClientID + btnFindCard.ClientID; btnFindName.ClientInstanceName = this.ClientID + btnFindName.ClientID; GridCustomer.ClientSideEvents.Init = @"function(s, e) { s.SetFocusedRowIndex(-1); }"; CallbackSearchByCard.ClientSideEvents.CallbackComplete = @"function(s, e) { " + GridCustomer.ClientInstanceName + @".SetFocusedRowIndex(-1); " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) { " + GridCustomer.ClientInstanceName + @".SetFocusedRowIndex(-1); " + GridCustomer.ClientInstanceName + @".PerformCallback(); }"; btnFindCard.ClientSideEvents.Click = @"function(s, e) { " + CallbackSearchByCard.ClientInstanceName + @".SendCallback(); }"; btnFindName.ClientSideEvents.Click = @"function(s, e) { " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback(); }"; //-------------------------------------------------------- lblMFCustomerName.ClientInstanceName = this.ClientID + lblMFCustomerName.ClientID; txtMFCustomerNo.ClientInstanceName = this.ClientID + txtMFCustomerNo.ClientID; popupAccount.ClientInstanceName = this.ClientID + popupAccount.ClientID; cbpTxtMFAccountNo.ClientInstanceName = this.ClientID + cbpTxtMFAccountNo.ClientID; String lostFocus = @"function(s,e){ " + cbLostFocus.ClientInstanceName + ".SendCallback(" + txtMFCustomerNo.ClientInstanceName + @".GetValue()); }"; txtMFCustomerNo.ClientSideEvents.LostFocus = lostFocus; String buttonClick = @"function(s,e){ var win = " + popupAccount.ClientInstanceName + @".GetWindow(0); " + popupAccount.ClientInstanceName + @".ShowWindow(win); }"; txtMFCustomerNo.ClientSideEvents.ButtonClick = buttonClick; //+ cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback(); cbSelect.ClientSideEvents.CallbackComplete = @"function(s,e){ " + txtMFCustomerNo.ClientInstanceName + @".SetValue(e.result); if(typeof(oncompleteLoadCustomer)!='undefined'){ oncompleteLoadCustomer(); } var value = e.result; " + ClientSideEvents.AfterSelectedChanged + @" }"; cbLostFocus.ClientSideEvents.CallbackComplete = @"function(s,e){ if(e.result=='hit'){ " + cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback(); if(typeof(oncompleteLoadCustomer)!='undefined'){ oncompleteLoadCustomer(); } var value = " + txtMFCustomerNo.ClientInstanceName + @".GetText(); " + ClientSideEvents.AfterSelectedChanged + @" }else{ " + txtMFCustomerNo.ClientInstanceName + @".SetValue(''); " + lblMFCustomerName.ClientInstanceName + @".SetValue(''); var value = ''; " + ClientSideEvents.AfterSelectedChanged + @" } }"; GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e){ var buttonID = e.buttonID; var visibleIndex = e.visibleIndex; if(buttonID = 'buttonSelect') { " + cbSelect.ClientInstanceName + @".SendCallback(visibleIndex); " + popupAccount.ClientInstanceName + @".Hide(); } }"; } if (IsRequiredField) { txtMFCustomerNo.SetValidation(ValidationGroup); } if (Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"] != null) { GridCustomer.DataSource = (IList <MFCustomer>)Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"]; GridCustomer.DataBind(); } }
/// <summary> /// Handles the send button OnClick event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSend_Click(object sender, EventArgs e) { bool testOnly = (rbTestOnly.SelectedValue == "1"); bool withOrdersOnly = (rbCustomersWithOrder.SelectedValue == "1"); bool listOnly = (rbListCustomers.SelectedValue == "1"); bool newsLetter = (rbNewsletter.SelectedValue == "1"); string mailSubject = txtSubject.Text; string mailBody = radDescription.Content; string mailFooter = new Topic("mailfooter").Contents; StringBuilder emailListText = new StringBuilder(); List <EMail> mailingList = new List <EMail>(); if (newsLetter) { mailingList = EMail.NewsLetterMailingList(); } else { mailingList = EMail.MailingList(BulkMailTypeEnum.EmailBlast, withOrdersOnly, mailSubject); } if (listOnly) { List <GridCustomer> l = GridCustomer.GetCustomers(); //List<GridProductVariant> l = GridProductVariant.GetAllVariants(false, AppLogic.EntityType.Unknown, 0); List <object> newList = l.ConvertAll <object>(delegate(GridCustomer g) { return((object)g); }); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=MailingList.csv"); Response.ContentType = "text/csv"; Response.AddHeader("Pragma", "public"); Response.Write(CSVExporter.ExportListToCSV(newList)); Response.End(); } else { //Send a single message to the currently logged in user if (testOnly) { EMail objEmail = new EMail(); objEmail.RecipientID = ThisCustomer.CustomerID; objEmail.RecipientGuid = ThisCustomer.CustomerGUID; objEmail.EmailAddress = ThisCustomer.EMail; objEmail.MailSubject = mailSubject; objEmail.MailContents = mailBody; objEmail.MailFooter = (new Topic("mailfooter").Contents); objEmail.IncludeFooter = true; objEmail.LogMessage = true; objEmail.Send(); } //Sending Emails else { BulkMailing bm = new BulkMailing(mailingList, mailBody, mailSubject, mailFooter, true, Session.SessionID); if (bm.MailingList.Count > 0) { BulkMailing.ExecuteAsyncBulkSend executeAsyncSend = new BulkMailing.ExecuteAsyncBulkSend(bm.ExecuteBulkSend); //We will check status in case the operation finishes and we need to re-enable buttons, etc. AsyncCallback cb = new AsyncCallback(MailingComplete); IAsyncResult result = executeAsyncSend.BeginInvoke(cb, null); ifrStatus.Attributes["src"] = "asyncstatus.aspx?id=" + Session.SessionID; ifrStatus.Visible = true; ltError.Text = AppLogic.GetString("admin.mailingmgr.BulkMailSending", ThisCustomer.LocaleSetting); btnRemoveEmail.Enabled = false; btnSend.Enabled = false; } else { btnRemoveEmail.Enabled = true; btnSend.Enabled = true; ifrStatus.Visible = false; ltError.Text = AppLogic.GetString("admin.mailingmgr.NoEmails", ThisCustomer.LocaleSetting); } } } }