Пример #1
0
 protected void gvxOpperation_RowInserted(object sender, DevExpress.Web.Data.ASPxDataInsertedEventArgs e)
 {
     // insert materials
     try
     {
         int opperationID                       = int.Parse(ViewState ["OpperatioinID"].ToString());
         ASPxDropDownEdit          dd           = (ASPxDropDownEdit)gvxOpperation.FindEditFormTemplateControl("ddMaterails");
         ASPxCheckBoxList          list         = (ASPxCheckBoxList)dd.FindControl("chlMaterails");
         List <OpperationMaterial> opperMatList = new List <OpperationMaterial>();
         foreach (ListEditItem item in list.Items)
         {
             if (item.Selected)
             {
                 opperMatList.Add(new OpperationMaterial()
                 {
                     OpperationID = opperationID, ItemID = int.Parse(item.Value.ToString())
                 });
             }
         }
         OpperationMaterialsRepository oppRepository = new OpperationMaterialsRepository();
         bool result = oppRepository.AddMaterialForOpperations(opperMatList);
     }
     catch (Exception)
     {
     }
 }
Пример #2
0
    private void AssignControllerResources()
    {
        ASPxDropDownEdit ddResource = (ASPxDropDownEdit)this.FindControlByID("ddResource");

        if (base.Control.Storage.ResourceSharing && ddResource != null)
        {
            ASPxGridView gvMultiResource = (ASPxGridView)ddResource.FindControl("gvMultiResource");
            if (gvMultiResource != null)
            {
                base.Controller.ResourceIds.Clear();
                string[] resources = ddResource.Value.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < resources.Length; i++)
                {
                    for (int j = 0; j < gvMultiResource.VisibleRowCount; j++)
                    {
                        string text = gvMultiResource.GetRowValues(j, "Text").ToString();
                        if (resources[i].Trim() == text.Trim())
                        {
                            base.Controller.ResourceIds.Add(gvMultiResource.GetRowValues(j, "Value"));
                        }
                    }
                }
            }
        }
    }
Пример #3
0
    protected void grid_Transport_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        ASPxGridView     grid   = sender as ASPxGridView;
        ASPxDropDownEdit d      = grid.FindEditFormTemplateControl("DropDownEdit") as ASPxDropDownEdit;
        ASPxGridView     gvlist = d.FindControl("gridPopCont") as ASPxGridView;
        string           sql    = string.Format(@"select Code,Name,TowheaderCode From CTM_Driver where StatusCode='Active'");

        gvlist.DataSource = C2.Manager.ORManager.GetDataSet(sql);
        gvlist.DataBind();
    }
Пример #4
0
    protected void grid_Trip_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        ASPxGridView     grd         = (sender as ASPxGridView) as ASPxGridView;
        string           sql         = @"select det1.Id,det1.ContainerNo,det1.ContainerType from CTM_JobDet1 as det1 left outer join CTM_Job as job on det1.JobNo=job.JobNo where job.Id=" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0);
        ASPxPageControl  pageControl = this.grid_job.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
        ASPxGridView     grid_Trip   = pageControl.FindControl("grid_Trip") as ASPxGridView;
        ASPxDropDownEdit dde_contNo  = grid_Trip.FindEditFormTemplateControl("dde_Trip_ContNo") as ASPxDropDownEdit;
        ASPxGridView     gvlist      = dde_contNo.FindControl("gridPopCont") as ASPxGridView;

        gvlist.DataSource = C2.Manager.ORManager.GetDataSet(sql);
        gvlist.DataBind();
    }
Пример #5
0
    protected void grid_Event_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        //string Port = System.Configuration.ConfigurationManager.AppSettings["LocalPort"];
        //ASPxButtonEdit btnPort = this.grid_Transport.FindEditFormTemplateControl("btn_Port") as ASPxButtonEdit;
        string Port = btn_Port.Text;
        //string where = string.Format("EventCode='depotin' AND EventPort='{0}' AND EventDateTime in(select MAX(EventDateTime) from Cont_AssetEvent where EventCode='depotin' group by ContainerNo)", Port);
        //dsRefCont.FilterExpression = where;
        string           sql    = "select aEvent.id,aEvent.ContainerNo,aEvent.ContainerType from Cont_AssetEvent as aEvent left outer join (select ContainerNo,MAX(eventDateTime) as maxEventDateTime from Cont_AssetEvent group by ContainerNo) as ass on aEvent.ContainerNo=ass.ContainerNo and aEvent.EventDateTime=ass.maxEventDateTime left outer join Ref_Container as Cont on aEvent.ContainerNo=Cont.ContainerNo where aEvent.EventCode='depotin' and ass.maxEventDateTime is not null  and Cont.StatusCode='Use' and aEvent.EventPort='" + Port + "'";
        ASPxGridView     grid   = sender as ASPxGridView;
        ASPxDropDownEdit d      = grid.FindEditFormTemplateControl("DropDownEdit") as ASPxDropDownEdit;
        ASPxGridView     gvlist = d.FindControl("gridPopCont") as ASPxGridView;

        gvlist.DataSource = C2.Manager.ORManager.GetDataSet(sql);
        gvlist.DataBind();
    }
Пример #6
0
    protected void grid_Event_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        //string Port = System.Configuration.ConfigurationManager.AppSettings["LocalPort"];
        //string where = string.Format("(isnull(EventCode,'')='' or EventCode='gateout') AND EventPort='{0}' AND EventDateTime in(select MAX(EventDateTime) from Cont_AssetEvent where isnull(EventCode,'')='' or EventCode='gateout' group by ContainerNo)",Port);
        string Port = btn_Port.Text;
        //string where = string.Format(" Id in(select id from Cont_AssetEvent as aEvent left outer join (select containerno,MAX(EventDateTime) as EventDateTime from Cont_AssetEvent group by containerno) as ass on ass.ContainerNo=aEvent.ContainerNo and ass.EventDateTime=aEvent.EventDateTime where (isnull(EventCode,'')='' or EventCode='gateout') and aEvent.EventPort='{0}' and ass.EventDateTime is not null and len(replace(isnull(aEvent.DocNo,''),' ',''))=0 and len(isnull(DocType,''))=0 )", Port);
        //dsRefCont.FilterExpression = where;
        string           sql    = string.Format(@"select aEvent.ContainerType,aEvent.ContainerNo from Cont_AssetEvent as aEvent left outer join (select containerno,MAX(EventDateTime) as EventDateTime from Cont_AssetEvent group by containerno) as ass on ass.ContainerNo=aEvent.ContainerNo and ass.EventDateTime=aEvent.EventDateTime left outer join Ref_Container as Cont on aEvent.ContainerNo=Cont.ContainerNo where (isnull(EventCode,'')='' or EventCode='gateout') and aEvent.EventPort='{0}' and ass.EventDateTime is not null and len(replace(isnull(aEvent.DocNo,''),' ',''))=0 and isnull(DocType,'')<>'SO' and Cont.StatusCode='Use' union all select ContainerType,ContainerNo  from Ref_Container where ContainerNo not in( select distinct isnull(ContainerNo,'') from Cont_AssetEvent) and StatusCode='Use' ", Port);
        ASPxGridView     grid   = sender as ASPxGridView;
        ASPxDropDownEdit d      = grid.FindEditFormTemplateControl("DropDownEdit") as ASPxDropDownEdit;
        ASPxGridView     gvlist = d.FindControl("gridPopCont") as ASPxGridView;

        gvlist.DataSource = C2.Manager.ORManager.GetDataSet(sql);
        gvlist.DataBind();
    }
Пример #7
0
 protected void gvxOpperation_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
 {
     try
     {
         int opperationID      = int.Parse(ViewState["OpperatioinID"].ToString());
         ASPxDropDownEdit dd   = (ASPxDropDownEdit)gvxOpperation.FindEditFormTemplateControl("ddMaterails");
         ASPxCheckBoxList list = (ASPxCheckBoxList)dd.FindControl("chlMaterails");
         dsOpperationMaterails.SelectParameters[0].DefaultValue = opperationID.ToString();
         DataView  SelectedItemView = (DataView)dsOpperationMaterails.Select(new DataSourceSelectArguments());
         DataTable SelectedItems    = SelectedItemView.ToTable();
         foreach (DataRow item in SelectedItems.Rows)
         {
             list.Items.FindByValue(item[0].ToString()).Selected = true;
         }
     }
     catch (Exception)
     {
     }
 }
Пример #8
0
        protected void gvxOpperation_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e)
        {
            try
            {
                int opperationID      = int.Parse(e.Keys[0].ToString());
                ASPxDropDownEdit dd   = (ASPxDropDownEdit)gvxOpperation.FindEditFormTemplateControl("ddMaterails");
                ASPxCheckBoxList list = (ASPxCheckBoxList)dd.FindControl("chlMaterails");
                dsOpperationMaterails.SelectParameters[0].DefaultValue = opperationID.ToString();
                dsOpperationMaterails.DeleteParameters[0].DefaultValue = opperationID.ToString();
                dsOpperationMaterails.InsertParameters[0].DefaultValue = opperationID.ToString();
                DataView  SelectedItemView = (DataView)dsOpperationMaterails.Select(new DataSourceSelectArguments());
                DataTable SelectedItems    = SelectedItemView.ToTable();
                foreach (DataRow item in SelectedItems.Rows)
                {
                    if (!list.Items.FindByValue(item[0].ToString()).Selected)
                    {
                        dsOpperationMaterails.DeleteParameters[1].DefaultValue = item[0].ToString();
                        dsOpperationMaterails.Delete();
                        list.Items.Remove(list.Items.FindByValue(item[0].ToString()));
                    }
                    else
                    {
                        list.Items.Remove(list.Items.FindByValue(item[0].ToString()));
                    }
                }

                foreach (ListEditItem item in list.Items)
                {
                    if (item.Selected)
                    {
                        dsOpperationMaterails.InsertParameters[1].DefaultValue = item.Value.ToString();
                        dsOpperationMaterails.Insert();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Пример #9
0
 /// <summary>
 /// Gets the Values or Text of the Selected Items in the DropdownEdit
 /// </summary>
 /// <param name="DropdownEdit">DropdownEdit name in which we have to process</param>
 /// <param name="ListBoxName">Name of the Listbox within the Dropdown Edit</param>
 /// <param name="IsText">bool value to get Text or Value</param>
 /// <returns>Returns the Comma separated Value</returns>
 public static string GetDropDownEditSelectedData(ASPxDropDownEdit DropdownEdit, string ListBoxName, bool IsText)
 {
     StringBuilder fieldNames = new StringBuilder();
     ASPxListBox oOutputList = (ASPxListBox)DropdownEdit.FindControl(ListBoxName);
     if (oOutputList != null)
     {
         if (oOutputList.SelectedItems.Count > 0)
         {
             foreach (ListEditItem ls in oOutputList.SelectedItems)
             {
                 fieldNames.Append((IsText == true ? ls.Text.ToString() : ls.Value.ToString()) + ",");
             }
             fieldNames.Remove(fieldNames.Length - 1, 1);
         }
     }
     return fieldNames.ToString();
 }