/// <summary> /// 重新发起 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvProgramFileList_RowUpdating(object sender, GridViewUpdateEventArgs e) { string id = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString(); B_ProgramFileInfo pfEntity = new B_ProgramFileInfo(); pfEntity.ID = int.Parse(id); if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE) { if (pfEntity.Files.Length > 0) { return; } //存在附件 pfEntity.ApplyStyle = null; pfEntity.ArchiveState = null; pfEntity.Year = null; pfEntity.Edition = null; if (pfEntity.Save()) { GetSearchList(true); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC); ms.Show(); } else { string strErr = string.Empty; if (pfEntity.ErrMsgs.Count != 0) { foreach (string str in pfEntity.ErrMsgs) { strErr += str; } } IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr); ms.Show(); } }//创建程序 else { if (pfEntity.Delete()) { GetSearchList(true); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC); ms.Show(); } else { string strErr = string.Empty; if (pfEntity.ErrMsgs.Count != 0) { foreach (string str in pfEntity.ErrMsgs) { strErr += str; } } IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr); ms.Show(); } }//升版、注销程序 }
/// <summary> /// 提交(创建程序) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnConfirm_Click(object sender, EventArgs e) { if (ddlDept.SelectedIndex == -1) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE); ms.Show(); return; } if (string.IsNullOrEmpty(ddlDept.SelectedValue) && ddlDept.SelectedIndex == 0) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED); ms.Show(); return; } GridViewRow row = this.gvProgramFileList.SelectedRow; B_ProgramFileInfo bProFile = new B_ProgramFileInfo(); bProFile.ID = int.Parse(row.Cells[PF_ID].Text.ToString());//ID bProFile.Name = txtName.Text.ToString().Trim(); bProFile.Edition = lblEdition.Text.ToString().Trim(); bProFile.Code = txtCode.Text.ToString().Trim(); bProFile.Sort = row.Cells[SORT].Text.ToString().Trim(); bProFile.ProTypId = int.Parse(row.Cells[TYPE_ID].Text.ToString().Trim()); bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPE_ID].Text.ToString().Trim()); bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//据ArchiveState is null判断需要发起的程序文件 B_DocumentNo_A docNo_A = new B_DocumentNo_A(); bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号 bProFile.Year = DateTime.Now.Year.ToString(); bProFile.ApplyStyle = ConstString.ProgramFile.PROGRAM_CREATE; if (bProFile.Save()) { RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, this.hfSort.Value, ddlDept.SelectedValue, bProFile.SerialID); } else { IMessage im = new WebFormMessage(Page, "提交失败。"); im.Show(); } }
/// <summary> /// 新增按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false) { IMessage ms = new WebFormMessage(Page, "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。"); ms.Show(); return; } if (txtName.Text.ToString().Contains("#") || txtName.Text.ToString().Contains("'")) { IMessage ms = new WebFormMessage(Page, "含有特殊字符,请替换后再上传"); ms.Show(); return; } B_ProgramFileInfo enProFile = new B_ProgramFileInfo(); enProFile.Name = txtName.Text.ToString().Trim(); //bProFile.Edition = "1";//txtEdition.Text.ToString().Trim(); enProFile.Code = txtCode.Text.ToString().Trim(); enProFile.Sort = ddlSort.SelectedItem.Text.ToString().Trim(); enProFile.ProTypId = int.Parse(ddlProgramType.SelectedItem.Value.ToString().Trim()); enProFile.ProTypSubId = int.Parse(ddlProgramSubType.SelectedItem.Value.ToString().Trim()); enProFile.ActivationDate = DateTime.Now; if (enProFile.Save()) { BindProgramFileList(false, 0, 0, "", "", "", "", "", ""); ClearData(); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC); ms.Show(); } else { IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString()); ms.Show(); } }
/// <summary> /// 升版程序提交按钮事件(升版、注销) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnConfirms_Click(object sender, EventArgs e) { if (ddlDept2.SelectedIndex == -1) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE); ms.Show(); return; } if (string.IsNullOrEmpty(ddlDept2.SelectedValue) && ddlDept2.SelectedIndex == 0) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED); ms.Show(); return; } bool isUsed = false; bool isRelUsed = false; if (rdolstStyle.SelectedIndex == 0) { isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_UPDATE); int iEdition = int.Parse(lblEdition.Text) - 1; isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_DELETE); }//升版 else { isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_DELETE); int iEdition = int.Parse(lblEdition.Text) + 1; isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_UPDATE); }//注销 if (isUsed) { IMessage ms = new WebFormMessage(Page, txtNames.Text + "第" + lblEditions.Text + "版,已在流程流转中。"); ms.Show(); return; }//所选程序文件已占用 if (isRelUsed) { string strPrompt = string.Empty; strPrompt = rdolstStyle.SelectedIndex == 0 ? "正在注销流转中,不能升版。" : "正在升版流转中,不能注销。"; IMessage ms = new WebFormMessage(Page, txtNames.Text + strPrompt); ms.Show(); return; } GridViewRow row = this.gvProgramFilesList.SelectedRow; B_ProgramFileInfo bProFile = new B_ProgramFileInfo(); bProFile.Name = txtNames.Text.ToString().Trim(); bProFile.Edition = lblEditions.Text.ToString().Trim(); bProFile.Code = txtCodes.Text.ToString().Trim(); bProFile.Sort = row.Cells[SORTS].Text.ToString().Trim(); bProFile.ProTypId = int.Parse(row.Cells[TYPES_ID].Text.ToString().Trim()); bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPES_ID].Text.ToString().Trim()); bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//未完成 B_DocumentNo_A docNo_A = new B_DocumentNo_A(); bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号 bProFile.Year = DateTime.Now.Year.ToString(); bProFile.ApplyStyle = rdolstStyle.SelectedIndex == 0 ? ConstString.ProgramFile.PROGRAM_UPDATE : ConstString.ProgramFile.PROGRAM_DELETE; string deptID = ddlDept2.SelectedValue; //string serialID = txtSerialID2.Text.Trim(); //if (rdolstStyle.SelectedIndex == 0) //{ if (bProFile.Save()) { RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, this.hfSorts.Value, ddlDept2.SelectedValue, bProFile.SerialID); } else { IMessage im = new WebFormMessage(Page, "提交失败。"); im.Show(); } //}//升版 //else //{ // RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, deptID); //}//注销 }
/// <summary> /// 升版程序提交按钮事件(升版、注销) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnConfirms_Click(object sender, EventArgs e) { if (ddlDept2.SelectedIndex == -1) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE); ms.Show(); return; } if (string.IsNullOrEmpty(ddlDept2.SelectedValue) && ddlDept2.SelectedIndex == 0) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED); ms.Show(); return; } bool isUsed = false; bool isRelUsed = false; if (rdolstStyle.SelectedIndex == 0) { isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_UPDATE); int iEdition = int.Parse(lblEdition.Text) - 1; isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_DELETE); }//升版 else { isUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, lblEditions.Text, ConstString.ProgramFile.PROGRAM_DELETE); int iEdition = int.Parse(lblEdition.Text) + 1; isRelUsed = B_ProgramFileInfo.IsFileUse(txtNames.Text, iEdition.ToString(), ConstString.ProgramFile.PROGRAM_UPDATE); }//注销 if (isUsed) { IMessage ms = new WebFormMessage(Page, txtNames.Text + "第" + lblEditions.Text + "版,已在流程流转中。"); ms.Show(); return; }//所选程序文件已占用 if (isRelUsed) { string strPrompt = string.Empty; strPrompt = rdolstStyle.SelectedIndex == 0 ? "正在注销流转中,不能升版。" : "正在升版流转中,不能注销。"; IMessage ms = new WebFormMessage(Page, txtNames.Text + strPrompt); ms.Show(); return; } GridViewRow row = this.gvProgramFilesList.SelectedRow; B_ProgramFileInfo bProFile = new B_ProgramFileInfo(); bProFile.Name = txtNames.Text.ToString().Trim(); bProFile.Edition = lblEditions.Text.ToString().Trim(); bProFile.Code = txtCodes.Text.ToString().Trim(); bProFile.Sort = row.Cells[SORTS].Text.ToString().Trim(); bProFile.ProTypId = int.Parse(row.Cells[TYPES_ID].Text.ToString().Trim()); bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPES_ID].Text.ToString().Trim()); bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//未完成 B_DocumentNo_A docNo_A = new B_DocumentNo_A(); bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号 bProFile.Year = DateTime.Now.Year.ToString(); bProFile.ApplyStyle = rdolstStyle.SelectedIndex == 0 ? ConstString.ProgramFile.PROGRAM_UPDATE : ConstString.ProgramFile.PROGRAM_DELETE; string deptID = ddlDept2.SelectedValue; //string serialID = txtSerialID2.Text.Trim(); //if (rdolstStyle.SelectedIndex == 0) //{ if (bProFile.Save()) { RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, this.hfSorts.Value, ddlDept2.SelectedValue, bProFile.SerialID); } else { IMessage im = new WebFormMessage(Page, "提交失败。"); im.Show(); } //}//升版 //else //{ // RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, deptID); //}//注销 }
/// <summary> /// 提交(创建程序) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnConfirm_Click(object sender, EventArgs e) { if (ddlDept.SelectedIndex == -1) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_NONE); ms.Show(); return; } if (string.IsNullOrEmpty(ddlDept.SelectedValue) && ddlDept.SelectedIndex == 0) { IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_CHECK_HOST_UNSELECTED); ms.Show(); return; } GridViewRow row = this.gvProgramFileList.SelectedRow; B_ProgramFileInfo bProFile = new B_ProgramFileInfo(); bProFile.ID = int.Parse(row.Cells[PF_ID].Text.ToString());//ID bProFile.Name = txtName.Text.ToString().Trim(); bProFile.Edition = lblEdition.Text.ToString().Trim(); bProFile.Code = txtCode.Text.ToString().Trim(); bProFile.Sort = row.Cells[SORT].Text.ToString().Trim(); bProFile.ProTypId = int.Parse(row.Cells[TYPE_ID].Text.ToString().Trim()); bProFile.ProTypSubId = int.Parse(row.Cells[SUBTYPE_ID].Text.ToString().Trim()); bProFile.ArchiveState = ConstString.ProgramFile.PROGRAM_UNFINISHED;//据ArchiveState is null判断需要发起的程序文件 B_DocumentNo_A docNo_A = new B_DocumentNo_A(); bProFile.SerialID = docNo_A.GetNo(ProcessConstString.TemplateName.PROGRAM_FILE);//3位流水号 bProFile.Year = DateTime.Now.Year.ToString(); bProFile.ApplyStyle = ConstString.ProgramFile.PROGRAM_CREATE; if (bProFile.Save()) { RedirectUrl(bProFile.ID.ToString(), bProFile.Name, bProFile.Code, bProFile.Edition, bProFile.ApplyStyle, this.hfSort.Value, ddlDept.SelectedValue, bProFile.SerialID); } else { IMessage im = new WebFormMessage(Page, "提交失败。"); im.Show(); } }
/// <summary> /// 新增按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (FormsMethod.CheckRole(ConstString.RoleName.QUALITY_MEMBER) == false) { IMessage ms = new WebFormMessage(Page, "只有质保人员" + OAUser.GetUserByRoleName(ConstString.RoleName.QUALITY_MEMBER)[1].ToString() + "可以添加程序文件。"); ms.Show(); return; } if (txtName.Text.ToString().Contains("#") || txtName.Text.ToString().Contains("'")) { IMessage ms = new WebFormMessage(Page, "含有特殊字符,请替换后再上传"); ms.Show(); return; } B_ProgramFileInfo enProFile = new B_ProgramFileInfo(); enProFile.Name = txtName.Text.ToString().Trim(); //bProFile.Edition = "1";//txtEdition.Text.ToString().Trim(); enProFile.Code = txtCode.Text.ToString().Trim(); enProFile.Sort = ddlSort.SelectedItem.Text.ToString().Trim(); enProFile.ProTypId = int.Parse(ddlProgramType.SelectedItem.Value.ToString().Trim()); enProFile.ProTypSubId = int.Parse(ddlProgramSubType.SelectedItem.Value.ToString().Trim()); enProFile.ActivationDate = DateTime.Now; if (enProFile.Save()) { BindProgramFileList(false, 0, 0, "", "", "", "", "", ""); ClearData(); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC); ms.Show(); } else { IMessage ms = new WebFormMessage(Page, enProFile.ErrMsgs[0].ToString()); ms.Show(); } }
/// <summary> /// 重新发起 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvProgramFileList_RowUpdating(object sender, GridViewUpdateEventArgs e) { string id = gvProgramFileList.DataKeys[e.RowIndex].Value.ToString(); B_ProgramFileInfo pfEntity = new B_ProgramFileInfo(); pfEntity.ID = int.Parse(id); if (pfEntity.ApplyStyle == ConstString.ProgramFile.PROGRAM_CREATE) { if (pfEntity.Files.Length > 0) { return; }//存在附件 pfEntity.ApplyStyle = null; pfEntity.ArchiveState = null; pfEntity.Year = null; pfEntity.Edition = null; if (pfEntity.Save()) { GetSearchList(true); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC); ms.Show(); } else { string strErr = string.Empty; if (pfEntity.ErrMsgs.Count != 0) { foreach (string str in pfEntity.ErrMsgs) { strErr += str; } } IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr); ms.Show(); } }//创建程序 else { if (pfEntity.Delete()) { GetSearchList(true); IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_RESTART_SUC); ms.Show(); } else { string strErr = string.Empty; if (pfEntity.ErrMsgs.Count != 0) { foreach (string str in pfEntity.ErrMsgs) { strErr += str; } } IMessage ms = new WebFormMessage(Page, strErr.Length > 300 ? strErr.Substring(0, 300) : strErr); ms.Show(); } }//升版、注销程序 }