protected void gridFondMove_OnHtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            if (!gridFondMove.IsNewRowEditing)
            {
                if (gridFondMove.GetDataRow(gridFondMove.EditingRowVisibleIndex)["IdTypeOperation"] != null)
                {
                    int operationTypeId =
                        Convert.ToInt32(gridFondMove.GetDataRow(gridFondMove.EditingRowVisibleIndex)["IdTypeOperation"]);

                    CmbOperationSetValues(operationTypeId);
                }
            }
        }
 protected void ASPxGridView1_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
 }
 void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
     ASPxComboBox cmbAccount = (ASPxComboBox)e.EditForm.Controls[0].FindControl("cmbAccount");
     ASPxComboBox cmbProject = (ASPxComboBox)e.EditForm.Controls[0].FindControl("cmbProject");
     //cmbProject.DataSource = this.timeEntryService.GetProjects(null, (String)cmbAccount.Value, null);
     //cmbProject.DataBind();
 }
        private static void FIX_PROBLEM_TARGET_FOR_THE_CALLBACK_COULD_NOT_BE_FOUND(object sender, ASPxGridViewEditFormEventArgs e)
        {
            // Если в качестве способа редактирования грида используется EditForm, при этом для EditForm задан template, то на callback,
            // приходящий из контрола EditForm'ы, для грида создается EditForm с ID отличным от присвоенного ранее ("efnew" вместо к примеру "ef1"):
            // по всей видимости отсутсвует возможность восстановить calbackstate у грида либо вообще либо в полном объеме,
            // что приводит к "потере" DataProxy.EditingRowVisibleIndex у самого грида - как следствие происходит "потеря" значения
            // VisibleIndex/ItemIndex у GridViewEditFormTemplateContainer (см.метод GetID в базовой имплементации данного класса)
            //
            // Таким образом, при попытке обработать данный callback возникает исключение:
            // [The target "ctl00$MainContent$gridView$DXPEForm$ef4$TC$pcEditFormPages$DXEditor3" for the callback could not be found
            // or did not implement ICallbackEventHandler.]"
            //
            // При создании EditForm из шаблона имеем следующую иерархию контролов:
            // [инстанция шаблона EditForm] -> GridViewEditFormTemplateContainer -> ClientIDHelper.TemplateHierarchyContainer -> [ContentDiv у GridViewHtmlEditFormPopup]
            // ИЛИ
            // [инстанция шаблона EditForm] -> GridViewEditFormTemplateContainer -> ClientIDHelper.TemplateContainerHolder -> ClientIDHelper.TemplateHierarchyContainer -> [ContentDiv у GridViewHtmlEditFormPopup]
            // Иерархия контролов зависит от ClientIDMode у TemplateHierarchyContainer. При этом значение ID из GridViewEditFormTemplateContainer.GetID()
            // получает контрол вложенный в ClientIDHelper.TemplateHierarchyContainer:
            // * в первом случае - GridViewEditFormTemplateContainer
            // * во втором случае - ClientIDHelper.TemplateContainerHolder
            //
            // Учитывая, что с очень большой вероятностью конкретная инстанция шаблона EditForm всегда одна и отсутвует возможность перегрузить
            // метод AddEditFormTemplateControl у ASPxGridViewRenderHelper, то мы постараемся недопустить появления описанного исключения
            // просто изменив ID у соответствующего контрола с "efnew"/"ef[visibleindex]" на "ef" сразу после создания
            //
            // ВНИМАНИЕ! СТОИТ УЧИТЫВАТЬ, ЧТО СОБЫТИЯ Init У КОНТРОЛОВ ВХОДЯЩИХ В СОСТАВ TEMPLATE'А EDITFORM БУДУТ ВОЗНИКАТЬ ДО ВНЕСЕНИЯ
            // ИЗМЕНЕНИЙ В ID СООТВЕТСТВУЮЩЕГО КОНТРОЛА

            var aspxGridView = (ASPxGridView)sender;

            if (aspxGridView.Templates.EditForm != null)
            {
                var requiredControl = e.EditForm.FindControlSmart(expression: @"\Aef(\d+|new)\z");

                if (requiredControl != null)
                {
                    requiredControl.SetID("ef")
                    .ResetChildControlsHierarchy <ASPxLabel>();    // Данная манипуляция необходима по причине того, что AssociatedControlID у ASPxLabel интерпритируются некорректно - фактически с учетом "efnew"/"ef[visibleindex]". Другого способа, кроме как "адресно" произвести ResetControlHierarchy найти не получилось.
                }
            }
        }
 protected void grid_CostDet_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
 }
 protected void ASPxGridView1_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
     if (this.ASPxGridView1.EditingRowVisibleIndex > -1)
         FillCityCombo(SafeValue.SafeString(this.ASPxGridView1.GetRowValues(this.ASPxGridView1.EditingRowVisibleIndex, new string[] { "AcType" })));
 }
Exemple #7
0
        protected void gridUsers_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            // this.LocalizeEditForm(e.EditForm);

            ASPxTextBox username = (ASPxTextBox)gridUsers.FindEditFormTemplateControl("txtEfUsername");
            if (username != null)
                username.Focus();

            if ((!SessionManager.IsEditFormCreated) || (EditFormHasErrors))
            {
                CanonDataContext db = Cdb.Instance;

                //init user rights checkbox list
                CheckBoxList cbl = (CheckBoxList)gridUsers.FindEditFormTemplateControl("chblUserRights");
                if (cbl != null)
                {
                    int counter = 0;
                    cbl.Items.Clear();
                    SessionManager.CheckBoxListHelper = new Dictionary<int, int>(5);
                    Dictionary<UserRightsEnum, string> list = BuUser.GetAllRightsList();
                    foreach (KeyValuePair<UserRightsEnum, string> pair in list)
                    {
                        int pairKey = (int)pair.Key;
                        cbl.Items.Add(new ListItem(pair.Value, pairKey.ToString()));
                        SessionManager.CheckBoxListHelper.Add(counter, pairKey);
                        counter++;
                    }
                }

                //initialize listbox and checkboxlist if anything exists
                if ((!gridUsers.IsNewRowEditing) && (!EditFormHasErrors))
                {
                    //combo/list initialization if needed
                    object value = gridUsers.GetRowValues(gridUsers.EditingRowVisibleIndex, new String[] { "UserId" });
                    int idToEdit = int.Parse(value.ToString());

                    //checkbox list init
                    if (cbl != null)
                    {
                        Dictionary<UserRightsEnum, string> list = BuUser.GetRightsList(idToEdit);
                        foreach (ListItem li in cbl.Items)
                            foreach (KeyValuePair<UserRightsEnum, string> pair in list)
                                if (li.Value == ((int)pair.Key).ToString())
                                    li.Selected = true;
                    }
                }
                if (EditFormHasErrors)
                {
                    //rights
                    if (cbl != null)
                    {
                        string[] values = SelectedRights.Split(';');
                        foreach (string val in values)
                        {
                            string[] item = val.Split('=');
                            if (item.Length != 2) continue;
                            foreach (ListItem li in cbl.Items)
                                if ((li.Value == item[0]) && (item[1] == "1"))
                                    li.Selected = true;
                        }
                    }
                }

                Control popupCtrl = gridUsers.FindEditFormTemplateControl("popupChangePassword");
                if (popupCtrl != null)
                {
                    Control changeCtrl = popupCtrl.FindControl("changePasswordCtrl");
                    if (changeCtrl != null && changeCtrl is AdminChangePassword)
                    {
                        object row = gridUsers.GetRow(gridUsers.EditingRowVisibleIndex);
                        if(row != null && row is User)
                        {
                            int userID = (row as User).UserId;

                            (changeCtrl as AdminChangePassword).SetUserId(userID);
                        }
                    }
                }

                SessionManager.IsEditFormCreated = true;
            }
        }
    }//end html row prepared

    /// <summary>
    /// copy combobox values to non-updateable labels
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgridDeliveries_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        try
        {
            string _s = this.dxhfOrder.Contains("subdecks") ? this.dxhfOrder.Get("subdecks").ToString() : "";
            if (!string.IsNullOrEmpty(_s))
            {
                string[] _labels = { "DeliveryAddressSub", "DeliveryAddressSub", "DeliveryAddressSub", "DeliveryAddressSub", "DeliveryAddressSub", "PalletSpecSub", "PalletWeightSub", "PalletHeightSub", "InstructionsSub" };
                string[] _elements = _s.Split("|".ToCharArray());

                //don't need element 0 company name as we have the combo there
                for (int _ix = 1; _ix < _labels.Length; _ix++)
                {
                    if (_elements[_ix] != "")
                    {
                        string test = "dxlbl" + _labels[_ix];
                        //find label at ix -1 as we want to start labels at element 0
                        ASPxLabel _lbl = (ASPxLabel)this.dxgridDeliveries.FindEditFormTemplateControl("dxlbl" + _labels[_ix - 1]);
                        if (_lbl != null)
                        {
                            _lbl.Text += _elements[_ix] + Environment.NewLine;
                        }
                    }
                }//end loop
            }
        }
        catch (Exception ex)
        {
            this.dxlblErr.Text = ex.Message.ToString();
            this.dxpnlErr.ClientVisible = true;
        }
    }
 protected void grid_Trip_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
     ASPxGridView grd = sender as ASPxGridView;
 }
Exemple #10
0
    protected void ASPxGridView1_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        ASPxTextBox invNCtr = this.ASPxGridView1.FindEditFormTemplateControl("txt_Oid") as ASPxTextBox;

        PayTab(SafeValue.SafeInt(invNCtr.Text, 0));
    }
Exemple #11
0
        protected void gridChannels_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            this.LocalizeEditForm(e.EditForm);

            if (!SessionManager.IsEditFormCreated)
            {
                if (!gridChannels.IsNewRowEditing)
                {
                    //initialize channel type combobox
                    ASPxComboBox cbo = (ASPxComboBox)gridChannels.FindEditFormTemplateControl("cmbEfType");
                    if (cbo != null)
                    {
                        object value = gridChannels.GetRowValues(gridChannels.EditingRowVisibleIndex, new String[] { "ChannelType" });
                        foreach (ListEditItem lei in cbo.Items)
                            if (lei.Value.ToString() == value.ToString())
                                cbo.SelectedItem = lei;
                    }
                    //initialize info type combobox
                    ASPxComboBox cbo2 = (ASPxComboBox)gridChannels.FindEditFormTemplateControl("cmbEfInfoType");
                    if (cbo2 != null)
                    {
                        object value = gridChannels.GetRowValues(gridChannels.EditingRowVisibleIndex, new String[] { "InfoType" });
                        foreach (ListEditItem lei in cbo2.Items)
                            if (lei.Value.ToString() == value.ToString())
                                cbo2.SelectedItem = lei;
                    }
                }
                SessionManager.IsEditFormCreated = true;
            }
        }
Exemple #12
0
        protected void gridUsers_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            // this.LocalizeEditForm(e.EditForm);

            ASPxTextBox username = (ASPxTextBox)gridUsers.FindEditFormTemplateControl("txtEfUsername");

            if (username != null)
            {
                username.Focus();
            }

            if ((!SessionManager.IsEditFormCreated) || (EditFormHasErrors))
            {
                CanonDataContext db = Cdb.Instance;

                //init user rights checkbox list
                CheckBoxList cbl = (CheckBoxList)gridUsers.FindEditFormTemplateControl("chblUserRights");
                if (cbl != null)
                {
                    int counter = 0;
                    cbl.Items.Clear();
                    SessionManager.CheckBoxListHelper = new Dictionary <int, int>(5);
                    Dictionary <UserRightsEnum, string> list = BuUser.GetAllRightsList();
                    foreach (KeyValuePair <UserRightsEnum, string> pair in list)
                    {
                        int pairKey = (int)pair.Key;
                        cbl.Items.Add(new ListItem(pair.Value, pairKey.ToString()));
                        SessionManager.CheckBoxListHelper.Add(counter, pairKey);
                        counter++;
                    }
                }

                //initialize listbox and checkboxlist if anything exists
                if ((!gridUsers.IsNewRowEditing) && (!EditFormHasErrors))
                {
                    //combo/list initialization if needed
                    object value    = gridUsers.GetRowValues(gridUsers.EditingRowVisibleIndex, new String[] { "UserId" });
                    int    idToEdit = int.Parse(value.ToString());

                    //checkbox list init
                    if (cbl != null)
                    {
                        Dictionary <UserRightsEnum, string> list = BuUser.GetRightsList(idToEdit);
                        foreach (ListItem li in cbl.Items)
                        {
                            foreach (KeyValuePair <UserRightsEnum, string> pair in list)
                            {
                                if (li.Value == ((int)pair.Key).ToString())
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                }
                if (EditFormHasErrors)
                {
                    //rights
                    if (cbl != null)
                    {
                        string[] values = SelectedRights.Split(';');
                        foreach (string val in values)
                        {
                            string[] item = val.Split('=');
                            if (item.Length != 2)
                            {
                                continue;
                            }
                            foreach (ListItem li in cbl.Items)
                            {
                                if ((li.Value == item[0]) && (item[1] == "1"))
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                }

                Control popupCtrl = gridUsers.FindEditFormTemplateControl("popupChangePassword");
                if (popupCtrl != null)
                {
                    Control changeCtrl = popupCtrl.FindControl("changePasswordCtrl");
                    if (changeCtrl != null && changeCtrl is AdminChangePassword)
                    {
                        object row = gridUsers.GetRow(gridUsers.EditingRowVisibleIndex);
                        if (row != null && row is User)
                        {
                            int userID = (row as User).UserId;

                            (changeCtrl as AdminChangePassword).SetUserId(userID);
                        }
                    }
                }

                SessionManager.IsEditFormCreated = true;
            }
        }
    protected void grid_ref_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        if (this.grid_ref.EditingRowVisibleIndex > -1)
        {
            ASPxPageControl pageControl  = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
            ASPxButtonEdit  whId         = pageControl.FindControl("txt_WhId") as ASPxButtonEdit;
            ASPxButtonEdit  crAgentId    = pageControl.FindControl("txt_CrAgentId") as ASPxButtonEdit;
            ASPxButtonEdit  nvoccAgentId = pageControl.FindControl("txt_NvoccAgentId") as ASPxButtonEdit;
            ASPxButtonEdit  agentId      = pageControl.FindControl("txt_AgentId") as ASPxButtonEdit;

            ASPxTextBox whName         = pageControl.FindControl("txt_WhName") as ASPxTextBox;
            ASPxTextBox crAgentName    = pageControl.FindControl("txt_CrAgentName") as ASPxTextBox;
            ASPxTextBox nvoccAgentName = pageControl.FindControl("txt_NvoccAgentName") as ASPxTextBox;
            ASPxTextBox agentName      = pageControl.FindControl("txt_AgentName") as ASPxTextBox;
            ASPxTextBox localCustName  = pageControl.FindControl("txt_LocalCustName") as ASPxTextBox;



            whName.Text         = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "WarehouseId" }));
            crAgentName.Text    = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "CrAgentId" }));
            nvoccAgentName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "NvoccAgentId" }));
            agentName.Text      = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "AgentId" }));
            localCustName.Text  = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "LocalCust" }));
            string oid = SafeValue.SafeString(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "SequenceId" }));
            if (this.txt_RefType.Text.ToLower() == "sec")
            {
                for (int i = 0; i < pageControl.TabPages.Count; i++)
                {
                    if (pageControl.TabPages[i].Text == "Booking")
                    {
                        pageControl.TabPages[i].ClientVisible = true;
                        break;
                    }
                }
            }


            if (oid.Length > 0)
            {
                ASPxDateEdit date_RefDate = pageControl.FindControl("date_RefDate") as ASPxDateEdit;
                date_RefDate.BackColor = ((DevExpress.Web.ASPxEditors.ASPxTextBox)(pageControl.FindControl("cbx_JobType"))).BackColor;
                date_RefDate.ReadOnly  = true;

                string     userId         = HttpContext.Current.User.Identity.Name;
                ASPxLabel  jobStatusStr   = pageControl.FindControl("lb_JobStatus") as ASPxLabel;
                string     sql            = string.Format("select StatusCode from SeaExportRef  where SequenceId='{0}'", oid);
                string     statusCode     = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// closeIndStr.Text;
                ASPxButton btn            = this.grid_ref.FindEditFormTemplateControl("btn_RefCloseJob") as ASPxButton;
                ASPxButton btn_VoidMaster = this.grid_ref.FindEditFormTemplateControl("btn_VoidMaster") as ASPxButton;
                if (statusCode == "CNL")
                {
                    btn_VoidMaster.Text = "Unvoid";
                    jobStatusStr.Text   = "Void";
                }
                else if (statusCode == "USE")
                {
                    btn.Text            = "Close Job";
                    btn_VoidMaster.Text = "Void";
                    jobStatusStr.Text   = "USE";
                }
                else if (statusCode == "CLS")
                {
                    btn.Text          = "Open Job";
                    jobStatusStr.Text = "Closed";
                }
            }
        }
    }
Exemple #14
0
    protected void grid_OnHtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        Control wc = grid.FindEditFormTemplateControl("UpdateButton");
        if (wc != null)
        {
            wc.Visible = AuthUser.IsSystemAdmin;
        }

    }
Exemple #15
0
        protected void gridCategories_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
        {
            this.LocalizeEditForm(e.EditForm);

            if (!SessionManager.IsEditFormCreated)
            {
                if (!gridCategories.IsNewRowEditing)
                {
                    //PLACE combo initialization if needed
                }
                SessionManager.IsEditFormCreated = true;
            }
        }
    protected void grid_OnHtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        Control       pc    = grid.FindEditFormTemplateControl("pageControl");
        Control       tbl   = grid.FindEditFormTemplateControl("tblDownload");
        Control       cMB   = pc.FindControl("txtMessageBody");
        Control       cRMB  = pc.FindControl("txtReturnMessageBody");
        ASPxHyperLink hlReq = tbl.FindControl("lnkReq") as ASPxHyperLink;
        ASPxHyperLink hlRes = tbl.FindControl("lnkRes") as ASPxHyperLink;

        if (cMB != null && cRMB != null)
        {
            ASPxMemo txtMB  = cMB as ASPxMemo;
            ASPxMemo txtRMB = cRMB as ASPxMemo;

            string msgBody    = "无法寻找请求消息体!";
            string retMsgBody = "无法寻找响应消息体!";
            string oid        = txtMB.Text;

            try
            {
                Guid g = new Guid(oid);
                Session["TraceID"] = oid;
            }
            catch
            {
                return;
            }

            hlReq.NavigateUrl += oid;
            hlRes.NavigateUrl += oid;

            AuditService  auditService  = new AuditService();
            AuditBusiness auditBusiness = auditService.GetAuditBusinessByOID(oid);

            if (!(String.IsNullOrEmpty(auditBusiness.MessageBody)))
            {
                String msgContent = auditBusiness.MessageBody;
                if (msgContent.Length > 102400)
                {
                    msgBody = msgContent.Substring(0, 102400) + "(只显示100K数据,剩余数据隐藏)";
                }
                else
                {
                    msgBody = msgContent;
                }
            }
            else
            {
                msgBody = "请求消息体为空!";
            }

            if (!(String.IsNullOrEmpty(auditBusiness.ReturnMessageBody)))
            {
                String msgContent = auditBusiness.ReturnMessageBody;
                if (msgContent.Length > 102400)
                {
                    retMsgBody = msgContent.Substring(0, 102400) + "(只显示100K数据,剩余数据隐藏)";
                }
                else
                {
                    retMsgBody = msgContent;
                }
            }
            else
            {
                retMsgBody = "响应消息体为空!";
            }

            txtMB.Text  = msgBody;
            txtRMB.Text = retMsgBody;
        }
    }
Exemple #17
0
    protected void grid_OnHtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        Control pc = grid.FindEditFormTemplateControl("pageControl");
        Control tbl = grid.FindEditFormTemplateControl("tblDownload");
        Control cMB = pc.FindControl("txtMessageBody");
        Control cRMB = pc.FindControl("txtReturnMessageBody");
        ASPxHyperLink hlReq = tbl.FindControl("lnkReq") as ASPxHyperLink;
        ASPxHyperLink hlRes = tbl.FindControl("lnkRes") as ASPxHyperLink;

        if (cMB != null && cRMB != null)
        {
            ASPxMemo txtMB = cMB as ASPxMemo;
            ASPxMemo txtRMB = cRMB as ASPxMemo;

            string msgBody = "无法寻找请求消息体!";
            string retMsgBody = "无法寻找响应消息体!";
            string oid = txtMB.Text;

            try
            {
                Guid g = new Guid(oid);
                Session["TraceID"] = oid;
            }
            catch
            {
                return;
            }

            hlReq.NavigateUrl += oid;
            hlRes.NavigateUrl += oid;

            AuditService auditService = new AuditService();
            AuditBusiness auditBusiness = auditService.GetAuditBusinessByOID(oid);

            if (!(String.IsNullOrEmpty(auditBusiness.MessageBody)))
            {
                String msgContent = auditBusiness.MessageBody;
                if (msgContent.Length > 102400)
                    msgBody = msgContent.Substring(0, 102400) + "(只显示100K数据,剩余数据隐藏)";
                else
                    msgBody = msgContent;
            }
            else
            {
                msgBody = "请求消息体为空!";
            }

            if (!(String.IsNullOrEmpty(auditBusiness.ReturnMessageBody)))
            {
                String msgContent = auditBusiness.ReturnMessageBody;
                if (msgContent.Length > 102400)
                    retMsgBody = msgContent.Substring(0, 102400) + "(只显示100K数据,剩余数据隐藏)";
                else
                    retMsgBody = msgContent;
            }
            else
            {
                retMsgBody = "响应消息体为空!";
            }

            txtMB.Text = msgBody;
            txtRMB.Text = retMsgBody;
        }
    }
Exemple #18
0
 protected void grid_Issue_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
 {
     if (this.grid_Issue.EditingRowVisibleIndex > -1)
     {
     }
 }