private void InitList() { if (_moFacade == null) { _moFacade = new MOFacade(this.DataProvider); } this.txtSelected.Value = ";"; this.lstSelected.Items.Clear(); object[] objs = _moFacade.QueryMOViewFieldByUserCode(this.GetUserCode()); bool bIsEmpty = false; if (objs != null) { for (int i = 0; i < objs.Length; i++) { MOViewField viewField = (MOViewField)objs[i]; string strText = languageComponent1.GetString(viewField.Description); if (strText == string.Empty) { strText = languageComponent1.GetString(viewField.FieldName); } lstSelected.Items.Add(new ListItem(strText, viewField.FieldName)); txtSelected.Value += viewField.FieldName + ";"; } } else { bIsEmpty = true; } objs = _moFacade.QueryMOViewFieldDefault(); lstUnSelected.Items.Clear(); if (objs != null) { for (int i = 0; i < objs.Length; i++) { MOViewField viewField = (MOViewField)objs[i]; if (this.txtSelected.Value.IndexOf(";" + viewField.FieldName + ";") < 0) { string strText = languageComponent1.GetString(viewField.Description); if (strText == string.Empty) { strText = languageComponent1.GetString(viewField.FieldName); } lstUnSelected.Items.Add(new ListItem(strText, viewField.FieldName)); if (bIsEmpty == true && FormatHelper.StringToBoolean(viewField.IsDefault) == true) { lstSelected.Items.Add(new ListItem(strText, viewField.FieldName)); txtSelected.Value += viewField.FieldName + ";"; } } } } }
protected DataRow GetGridRow(object obj) { DataRow row = DtSource.NewRow(); MO mo = obj as MO; //工单的未完工数量=工单的已投入数量-工单已完工数量-工单的拆解数量-脱离工单数量 decimal moNotComQty = mo.MOInputQty - mo.MOActualQty - mo.MOScrapQty - mo.MOOffQty; int ActDate = 0; if (mo.MOActualStartDate > 0) { TimeSpan dateTime = DateTime.Now.Date - Convert.ToDateTime(FormatHelper.ToDateString(mo.MOActualStartDate, "/")); ActDate = dateTime.Days; } //object[] objs = new object[this.MOViewFieldList.Length + 3]; //objs[0] = "false"; //objs[objs.Length - 1] = ""; //objs[objs.Length - 2] = ""; //objs[objs.Length - 3] = ""; Type type = mo.GetType(); for (int i = 0; i < this.MOViewFieldList.Length; i++) { MOViewField field = this.MOViewFieldList[i]; string strValue = string.Empty; if (field.FieldName == "MONotActualQty") { strValue = moNotComQty.ToString(); } else if (field.FieldName == "MOActualDate") { strValue = ActDate.ToString(); } else { System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName); if (fieldInfo != null) { strValue = fieldInfo.GetValue(mo).ToString(); if (field.FieldName.ToUpper().EndsWith("DATE") == true) { if (strValue == string.Empty) { strValue = "0"; } strValue = FormatHelper.ToDateString(int.Parse(strValue)); } else if (field.FieldName.ToUpper().EndsWith("TIME") == true) { if (strValue == string.Empty) { strValue = "0"; } strValue = FormatHelper.ToTimeString(int.Parse(strValue)); } else if (field.FieldName == "MOStatus") { strValue = this.languageComponent1.GetString(strValue); } } } row[i + 1] = strValue; // objs[i + 1] = strValue; } return(row); }
private string[] FormatExportRecord(object obj) { MO mo = obj as MO; //工单的未完工数量=工单的已投入数量-工单已完工数量-工单的拆解数量 decimal moNotComQty = mo.MOInputQty - mo.MOActualQty - mo.MOScrapQty - mo.MOOffQty; int ActDate = 0; if (mo.MOActualStartDate > 0) { TimeSpan dateTime = DateTime.Now.Date - Convert.ToDateTime(FormatHelper.ToDateString(mo.MOActualStartDate, "/")); ActDate = dateTime.Days; } // Added by Icyer 2006/12/09 string[] objs = new string[this.MOViewFieldList.Length]; Type type = mo.GetType(); for (int i = 0; i < this.MOViewFieldList.Length; i++) { MOViewField field = this.MOViewFieldList[i]; string strValue = string.Empty; if (field.FieldName == "MONotActualQty") { strValue = moNotComQty.ToString(); } else if (field.FieldName == "MOActualDate") { strValue = ActDate.ToString(); } else { System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName); if (fieldInfo != null) { strValue = fieldInfo.GetValue(mo).ToString(); if (field.FieldName.ToUpper().EndsWith("DATE") == true) { if (strValue == string.Empty) { strValue = "0"; } strValue = FormatHelper.ToDateString(int.Parse(strValue)); } else if (field.FieldName.ToUpper().EndsWith("TIME") == true) { if (strValue == string.Empty) { strValue = "0"; } strValue = FormatHelper.ToTimeString(int.Parse(strValue)); } else if (field.FieldName == "MOStatus") { strValue = this.languageComponent1.GetString(strValue); } } } objs[i] = strValue; } return(objs); // Added end }