void UCVehicleAddOrEdit_SaveEvent(object sender, EventArgs e) { try { #region 必要的判断 if (!CheckControlValue()) { return; } if (!ucAttr.CheckAttachment()) { return; } #endregion if (MessageBoxEx.Show("确认要保存吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(picPhoto.Tag))) { photo = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(picPhoto.Tag.ToString()); if (!FileOperation.UploadFile(picPhoto.Tag.ToString(), photo)) { return; } } List <SQLObj> listSql = new List <SQLObj>(); SaveVehicleData(listSql); AddPhoto(listSql, strId, photo); deleteDriInfo(listSql, strId); SaveCustomData(listSql, strId); ucAttr.TableName = "tb_vehicle"; ucAttr.TableNameKeyValue = strId; listSql.AddRange(ucAttr.AttachmentSql); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("保存失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
void UCVehicleView_StatusEvent(object sender, EventArgs e) { List <SQLObj> listSql = new List <SQLObj>(); SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); string strMsg = string.Empty; if (strStatus == Convert.ToInt32(DataSources.EnumStatus.Start).ToString()) { strMsg = "停用"; dicParam.Add("status", new ParamObj("status", DataSources.EnumStatus.Stop, SysDbType.VarChar, 40));//状态 } else if (strStatus == Convert.ToInt32(DataSources.EnumStatus.Stop).ToString()) { strMsg = "启用"; dicParam.Add("status", new ParamObj("status", DataSources.EnumStatus.Start, SysDbType.VarChar, 40));//状态 } if (MessageBoxEx.Show("确认要" + strMsg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } dicParam.Add("v_id", new ParamObj("v_id", strVId, SysDbType.VarChar, 40)); //车辆档案Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = "update tb_vehicle set status=@status,update_by=@update_by,update_time=@update_time where v_id=@v_id"; obj.Param = dicParam; listSql.Add(obj); if (DBHelper.BatchExeSQLMultiByTrans("更新单据状态为启停用", listSql)) { MessageBoxEx.Show("" + strMsg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } }