/// <summary> /// 将数据行转换为实体 /// </summary> /// <param name="modelRow">数据行记录</param> /// <returns>实体信息</returns> protected override void DataRow2ModelBase(XModelBase modelInfo, DataRow modelRow) { XCodeEquipmentStateInfo info = modelInfo as XCodeEquipmentStateInfo; info.ID = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "RID")); //主键 info.RID = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "RID")); //主键 info.NameEN = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "NameEN")); //英文名称 info.NameCN = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "NameCN")); //中文名称 info.NameBig5 = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "NameBig5")); //繁体名称 info.Code = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "Code")); //代码 info.CodeNum = XHelper.GetInt(XDataRowHelper.GetFieldValue(modelRow, "CodeNum")); //数字代码 info.CodeEN = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "CodeEN")); //字母代码 info.Spell = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "Spell")); //拼音 info.SpellHeader = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "SpellHeader")); //拼音缩写 info.ColorRGB = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "ColorRGB")); //颜色标识 info.ProirNum = XHelper.GetInt(XDataRowHelper.GetFieldValue(modelRow, "ProirNum")); //顺序号 info.DeptId = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "DeptId")); //部门名称 info.IsUsed = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "IsUsed")) == "True"; //是否可用 info.ParentID = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "ParentID")); //上级节点 info.UserID = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "UserID")); //用户ID info.Remark = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "Remark")); //备注 info.InputUserId = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "InputUserId")); //录入人 info.InputTime = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "InputTime")); //录入时间 info.UpdateUserId = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "UpdateUserId")); //修改人 info.UpdateTime = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "UpdateTime")); //修改时间 }
/// <summary> /// 设置修改时的默认值 /// </summary> protected override void SetDefaultValue() { XCodeEquipmentStateInfo info = this.m_CurrentModel as XCodeEquipmentStateInfo; this.txtNameEN.Text = info.NameEN; this.txtNameCN.Text = info.NameCN; this.txtNameBig5.Text = info.NameBig5; this.txtCode.Text = info.Code; this.nebCodeNum.Value = info.CodeNum; this.txtCodeEN.Text = info.CodeEN; this.txtSpell.Text = info.Spell; this.txtSpellHeader.Text = info.SpellHeader; //this.txtColorRGB.Text = info.ColorRGB; this.nebProirNum.Value = info.ProirNum; this.txtDeptId.Text = info.DeptId; this.chkIsUsed.Checked = info.IsUsed; this.txtParentID.Text = info.ParentID; this.txtUserID.Text = info.UserID; this.txtRemark.Text = info.Remark; string colorArgb = info.ColorRGB; string[] rgbs = colorArgb.Split(','); if (rgbs.Length == 3) { int r = XHelper.GetInt(rgbs[0]); int g = XHelper.GetInt(rgbs[1]); int b = XHelper.GetInt(rgbs[2]); Color color = Color.FromArgb(r, g, b); this.btnColor.SelectedColor = color; } }
/// <summary> /// 获取删除时插入日志表sql /// </summary> /// <param name="modelInfo"></param> /// <param name="userId"></param> /// <returns></returns> protected override string GetInsertDeleteHistory(XModelBase modelInfo, string userId) { XCodeEquipmentStateInfo info = modelInfo as XCodeEquipmentStateInfo; string sql = "Insert Into " + this.HistoryTableName + "(RID,NameEN,NameCN,NameBig5,Code,CodeNum,CodeEN,Spell,SpellHeader,ColorRGB,ProirNum,DeptId,IsUsed,ParentID,UserID,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime,OperateUserId,Operate,OperateTime,NewID) SELECT RID,NameEN,NameCN,NameBig5,Code,CodeNum,CodeEN,Spell,SpellHeader,ColorRGB,ProirNum,DeptId,IsUsed,ParentID,UserID,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime,'" + userId + "','删除',getdate(),newid() FROM " + this.TableName + " WHERE " + this.PrimaryKey + "='" + info.RID + "'"; return(sql); }
protected override void FillGridBefore() { IList <XModelBase> stateList = this.m_EquipmentStateBusiness.GetAll(); IList <string> colors = new List <string>(); foreach (XModelBase model in stateList) { XCodeEquipmentStateInfo stateInfo = model as XCodeEquipmentStateInfo; GridEXFormatCondition condition = new GridEXFormatCondition(); if (!colors.Contains(stateInfo.ColorRGB) && stateInfo.ColorRGB != "0,0,0") { Color color = XColorHelper.GetColorFormStringRgb(stateInfo.ColorRGB); condition.FormatStyle.BackColor = color; condition.Column = this.grdData.RootTable.Columns["ColorRGB"]; condition.Value1 = stateInfo.ColorRGB; if (condition.Column != null) { this.grdData.RootTable.FormatConditions.Add(condition); } colors.Add(stateInfo.ColorRGB); } } }
/// <summary> /// 填充实体信息 /// </summary> protected override void FillModelInfo() { XCodeEquipmentStateInfo info = this.m_CurrentModel as XCodeEquipmentStateInfo; if (this.m_EditStatus == XEditStatus.AddNew) { info.RID = this.GetNewId(); } info.NameEN = this.txtNameEN.Text; info.NameCN = this.txtNameCN.Text; info.NameBig5 = this.txtNameBig5.Text; info.Code = this.txtCode.Text; info.CodeNum = XHelper.GetInt(this.nebCodeNum.Value); info.CodeEN = this.txtCodeEN.Text; info.Spell = this.txtSpell.Text; info.SpellHeader = this.txtSpellHeader.Text; //info.ColorRGB = this.txtColorRGB.Text; info.ProirNum = XHelper.GetInt(this.nebProirNum.Value); info.DeptId = this.txtDeptId.Text; info.IsUsed = this.chkIsUsed.Checked; info.ParentID = this.txtParentID.Text; info.UserID = this.txtUserID.Text; info.Remark = this.txtRemark.Text; Color selectedColor = this.btnColor.SelectedColor; info.ColorRGB = selectedColor.R.ToString() + "," + selectedColor.G.ToString() + "," + selectedColor.B.ToString(); base.FillModelInfo(); }
protected override void FillGridBefore() { IList <string> colors = new List <string>(); foreach (XModelBase model in this.m_CurrentList) { XCodeEquipmentStateInfo stateInfo = model as XCodeEquipmentStateInfo; GridEXFormatCondition condition = new GridEXFormatCondition(); if (!colors.Contains(stateInfo.ColorRGB) && stateInfo.ColorRGB != "0,0,0") { try { Color color = XColorHelper.GetColorFormStringRgb(stateInfo.ColorRGB); condition.FormatStyle.BackColor = color; condition.Column = this.grdData.RootTable.Columns["ColorRGB"]; condition.Value1 = stateInfo.ColorRGB; this.grdData.RootTable.FormatConditions.Add(condition); colors.Add(stateInfo.ColorRGB); } catch (Exception ex) { XErrorLogTool.WriteLog(ex.ToString()); } } } }
/// <summary> /// 获取插入sql /// </summary> /// <param name="modelInfo"></param> /// <returns></returns> public override string GetInsertSql(XModelBase modelInfo) { XCodeEquipmentStateInfo info = modelInfo as XCodeEquipmentStateInfo; string sql = "Insert Into " + this.TableName + "(RID,NameEN,NameCN,NameBig5,Code,CodeNum,CodeEN,Spell,SpellHeader,ColorRGB,ProirNum,DeptId,IsUsed,ParentID,UserID,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime)Values('{0}','{1}','{2}','{3}','{4}',{5},'{6}','{7}','{8}','{9}',{10},'{11}','{12}','{13}','{14}','{15}','{16}',{17},'{18}',{19})"; sql = String.Format(sql, info.RID, info.NameEN, info.NameCN, info.NameBig5, info.Code, info.CodeNum, info.CodeEN, info.Spell, info.SpellHeader, info.ColorRGB, info.ProirNum, info.DeptId, info.IsUsed == true?"1":"0", info.ParentID, info.UserID, info.Remark, info.InputUserId, this.GetServerTimeFuncion(), info.UpdateUserId, this.GetServerTimeFuncion()); return(sql); }
/// <summary> /// 获取更新Sql /// </summary> /// <param name="modelInfo"></param> /// <returns></returns> public override string GetUpdateSql(XModelBase modelInfo) { string sql = String.Empty; XCodeEquipmentStateInfo info = modelInfo as XCodeEquipmentStateInfo; sql = "Update " + this.TableName + " Set NameEN='{0}',NameCN='{1}',NameBig5='{2}',Code='{3}',CodeNum={4},CodeEN='{5}',Spell='{6}',SpellHeader='{7}',ColorRGB='{8}',ProirNum={9},DeptId='{10}',IsUsed='{11}',ParentID='{12}',UserID='{13}',Remark='{14}',UpdateUserId='{15}',UpdateTime={16} Where RID='{17}'"; sql = string.Format(sql, info.NameEN, info.NameCN, info.NameBig5, info.Code, info.CodeNum, info.CodeEN, info.Spell, info.SpellHeader, info.ColorRGB, info.ProirNum, info.DeptId, info.IsUsed == true?"1":"0", info.ParentID, info.UserID, info.Remark, info.UpdateUserId, this.GetServerTimeFuncion(), info.RID); return(sql); }
/// <summary> /// 自定义修改校验 /// </summary> /// <param name="modelInfo"></param> /// <returns></returns> protected override string GetValidateUpdateCustom(XModelBase modelInfo) { string validateInfo = string.Empty; XCodeEquipmentStateInfo codeequipmentstate = modelInfo as XCodeEquipmentStateInfo; if (codeequipmentstate == null) { return(this.GetNotRightType()); } return(string.Empty); }
protected override string GetValueMember(XModelBase selectedModel) { XCodeEquipmentStateInfo info = selectedModel as XCodeEquipmentStateInfo; if (info != null) { return(info.RID); } else { return(string.Empty); } }
protected override string GetDisplayMember(Model.XModelBase selectedModel) { XCodeEquipmentStateInfo info = selectedModel as XCodeEquipmentStateInfo; if (info != null) { return(info.NameCN); } else { return(string.Empty); } }
/// <summary> /// 填充实体信息 /// </summary> protected override void FillModelInfo() { XVEquipmentCheckInfo info = this.m_CurrentModel as XVEquipmentCheckInfo; if (this.m_EditStatus == XEditStatus.AddNew || chkcopy.Checked) { info.RID = this.GetNewId(); info.ID = info.RID; } info.EquipmentType = this.txtEquipmentType.ValueMember; info.EquipmentTypeName = this.txtEquipmentType.DisplayMember; info.EquipmentCustId = this.txtEquipmentCustId.ValueMember; info.CustName = this.txtEquipmentCustId.DisplayMember; info.EquipmentName = this.txtEquipmentName.Text; info.FactoryNo = this.txtFactoryNo.Text; info.Spec = this.txtSpec.Text; info.Model = this.txtModel.Text; info.FactoryName = this.txtFactoryName.Text; info.SourceTime = XHelper.GetFormatedDate(this.dtSourceTime.Value); info.UseTime = XHelper.GetFormatedDate(this.dtUseTime.Value); //info.SourceCustId = this.txtSourceCustId.Text;//2015-07-13,mxj,del info.SourceTypeId = this.cboSourceTypeId.Text; info.EquipmentStatusId = this.txtEquipmentStatusId.ValueMember; info.EquipmentState = this.txtEquipmentStatusId.DisplayMember; info.SignStatus = this.cboSignStatus.Text; info.Quanlity = XHelper.GetInt(this.nebQuanlity.Value); info.LinkMan = this.txtLinkMan.Text; info.MobileNo = this.txtTel.Text; info.Tel = this.txtTel.Text;//2016-11-21,mxj,启动,实现单条送检设备联系人及电话修改后同步问题 info.Email = this.txtEmail.Text; info.CheckAccord = this.txtCheckAccord.Text; info.LastCheckDate = XHelper.GetFormatedDate(this.dtLastCheckDate.Value); //2015-07-13,mxj,add======================= info.SourceCustId = this.txtCheckUserId.ValueMember; //20151019,mxj,临时借用传递指定检定人名称=== //2015-07-13,mxj,add=========================== if (info.SourceCustId != null && info.SourceCustId != "") { string sqlget = "select * from StaffInfo where rid='" + info.SourceCustId + "'"; DataTable dt = new DataTable(); dt = SQLHelper.GetDataSet(sqlget); bool ishad = false; if (dt != null) { if (dt.Rows.Count > 0) { ishad = true; } } string disname = ""; if (ishad) { disname = dt.Rows[0]["UserName"] + ""; info.CheckResult = disname; } } //========================================== info.ValidDate = XHelper.GetFormatedDate(this.dtValidDate.Value); info.CertNo = this.txtCertNo.Text; info.EquipmentDesc = this.txtEquipmentDesc.Text; info.Remark = this.txtRemark.Text; info.BillNo = this.txtBillNo.Text.Trim(); info.EquipmentNo = this.txtEquipmentNo.Text.Trim(); if (this.txtEquipmentStatusId.SelectedModel != null) { XCodeEquipmentStateInfo stateInfo = this.txtEquipmentStatusId.SelectedModel as XCodeEquipmentStateInfo; info.ColorRGB = stateInfo.ColorRGB; } base.FillModelInfo(); }