private void ProcessAvatar(HttpContext context) { HttpPostedFile fileUpload = context.Request.Files["Filedata"]; if (fileUpload != null && fileUpload.ContentLength > 0) { int id = CU.ToInt(context.Request.QueryString["i"]); string name = context.Request.QueryString["n"]; UserEntity user = UserAccount.Current; if (user != null && user.id == id) { if (name == null) { name = user.www; } string extension = Path.GetExtension(fileUpload.FileName).ToLower(); string fileName = name + extension; string originalPath = @"s\o\"; string datepath = DateTime.Now.ToString("yyyyMM"); string ofileName = rootPath + originalPath + datepath + "\\" + fileName; if (SaveFile(fileUpload, ofileName)) { string iconFileName = rootPath + originalPath + datepath + "\\" + name + ".png"; int width, height; if (IU.Resize(ofileName, iconFileName, 300, 300, out width, out height)) { if (ofileName != iconFileName) { File.Delete(ofileName); } } else /*TODO: log failed!*/ } { FileController.CreateAttachment(new AttachmentEntity() { uid = id, url = "/s/o/" + datepath + "/" + fileName, physicalpath = iconFileName, type = 1 }); context.Response.StatusCode = 200; string data = "{url:'" + "/s/o/" + datepath + "/" + name + ".png" + "',width:" + width + ",height:" + height + "}"; context.Response.Write(JU.BuildJSON(true, data)); return; } } } //内部服务器错误 context.Response.StatusCode = 500; context.Response.Write(JU.Build(false, "图片上传失败")); }
private void ProcessActivityCover(HttpContext context) { try { HttpPostedFile fileUpload = context.Request.Files["Filedata"]; int uid = CU.ToInt(context.Request.QueryString["uid"]); int aid = CU.ToInt(context.Request.QueryString["aid"]); string name = context.Request.QueryString["n"]; if (uid > 0 && !string.IsNullOrEmpty(name)) { if (fileUpload.ContentLength > 0) { string fileName = fileUpload.FileName; string originalPath = @"s\o\180x120\"; string coverPath = @"s\c\180x120\"; string ofileName = rootPath + originalPath + "\\" + fileName; if (SaveFile(fileUpload, ofileName)) { string cfileName = rootPath + coverPath + "\\" + name; IU.Resize(ofileName, cfileName, 180, 120); File.Delete(ofileName); string url = "/s/c/180x120/" + name; if (aid > 0 && FileDB.ExistUploadInfo(uid, aid, 2)) { //不创建上传信息 } else { FileDB.CreateAttachment(new AttachmentEntity() { uid = uid, referid = aid, url = "/s/c/180x120/" + name, physicalpath = cfileName, type = 2 }); } context.Response.StatusCode = 200; context.Response.Write("/s/c/180x120/" + name); return; } } } } catch { } //内部服务器错误 context.Response.StatusCode = 500; context.Response.Write("内部服务器错误"); }
public void PRINTFORILLYA() { for (int i = 0; i < Amount; i++) { for (int j = 0; j < Amount; j++) { Console.Write(priorities[i, j].ToString() + "\t"); } Console.Write("\t\t" + vectors[i].ToString() + "\t" + priorityVectors[i].ToString() + "\t" + lambdas[i].ToString() + "\n"); } Console.WriteLine("IU = " + IU.ToString() + " VU = " + VU.ToString()); }
private void btnUpload_Click(object sender, EventArgs e) { IUpdateRecordInfo IU; if (UpdateRecordEditorPanle.Controls.Count > 0) { IU = UpdateRecordEditorPanle.Controls[0] as IUpdateRecordInfo; _StudUpdateRecordEntity = IU.GetStudUpdateRecordData(); } string _base64Data = ""; string _FileName = ""; Guid g = Guid.NewGuid(); string DSNS = FISCA.Authentication.DSAServices.AccessPoint; OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { // 取得檔案 _FileName = g.ToString() + ofd.SafeFileName; _StudUpdateRecordEntity.SetComment("https://storage.googleapis.com/1campus-photo/j.kh.edu.tw/" + DSNS + "/upload_" + _FileName); //txtEDoc.Text = "https://storage.googleapis.com/1campus-photo/j.kh.edu.tw/" + DSNS + "/upload_" + _FileName; // 轉 Base64 try { MemoryStream ms = new MemoryStream(); ofd.OpenFile().CopyTo(ms); _base64Data = Convert.ToBase64String(ms.ToArray()); if (_FileName != "" && _base64Data != "") { UpdateRecordUtil.UploadFile(_StudUpdateRecordEntity.StudentID, _base64Data, _FileName); } // 上傳後儲存 SaveData(); MsgBox.Show("上傳檔案完成"); this.Close(); } catch (Exception ex) { FISCA.Presentation.Controls.MsgBox.Show("讀取上傳檔案失敗," + ex.Message); } } }
private void UpdateRecordItemForm_FormClosing(object sender, FormClosingEventArgs e) { IUpdateRecordInfo IU; if (UpdateRecordEditorPanle.Controls.Count == 0) { e.Cancel = true; } IU = UpdateRecordEditorPanle.Controls[0] as IUpdateRecordInfo; //IU.GetStudUpdateRecord(); _StudUpdateRec = IU.GetStudUpdateRecord(); // 當資料有改變 if (IU.GetLogData().GetDataHasChange() && _checkSave == false || string.IsNullOrEmpty(IU.GetStudUpdateRecord().UpdateCode)) { if (FISCA.Presentation.Controls.MsgBox.Show("這個動作將放棄目前編輯中的資料,是否確定離開?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } } // 當異動代碼是否存在問題,不存在不儲存。 if (IU.GetStudUpdateRecord() == null) { return; } else { List <string> xx = (from elm in _UpdateCode.Elements("異動") where elm.Element("代號").Value == IU.GetStudUpdateRecord().UpdateCode select elm.Element("代號").Value).ToList(); if (xx.Count == 0) { return; } } }
/// <summary> /// 裁减并保存用户上传的图像 /// </summary> /// <param name="context"></param> public static void SaveAvatar(HttpContext context) { int x = CU.ToInt(context.Request.QueryString["x"]); int y = CU.ToInt(context.Request.QueryString["y"]); int w = CU.ToInt(context.Request.QueryString["w"]); int h = CU.ToInt(context.Request.QueryString["h"]); if (w == 0 || h == 0) { context.Response.Write(JU.AJAX_FAIL); return; } UserEntity user = UserAccount.Current; if (user != null) { //get the originalfile & crop it. string filePath = FileController.GetFilePhysicalPath(1, user.id); if (File.Exists(filePath)) { string avatarPath = context.Server.MapPath("~/") + @"\s\u\avatar\"; if (!Directory.Exists(avatarPath)) { Directory.CreateDirectory(avatarPath); } if (IU.Crop(filePath, avatarPath + user.www + ".png", new Rectangle(x, y, w, h), 50, 50)) { string tURL = "/s/u/avatar/" + user.www + ".png"; if (UserAccount.SetAvatar(tURL, user.id) > 0) { context.Response.Write(JU.Build(true, tURL)); return; } } } } context.Response.Write(JU.AJAX_FAIL); }
public void Proverk() { for (int i = 0; i < sprget.Length; i++) { if (sprget[i] == gm[i].sprite) { b++; if (b == 4) { GameObject.Find("klish").GetComponent <Transform>().position = new Vector3(1.82f, 11.1f, 0); GameObject.Find("doradyra").GetComponent <SpriteRenderer>().sprite = aaaaaaaaa; } } else { diegg.Play(); MyLaziness.SetInteger("dies", 0); AIU.SetActive(false); IU.SetActive(false); } } }
private GameObject GetParent(IU iu) { GameObject parentSpace = null; if (iu.iu_space.Equals("WORLD_SPACE")) { parentSpace = worldSpace; } else if (iu.iu_space.Equals("LIFE_LINE")) { parentSpace = lifeLine; } else if (iu.iu_space.Equals("EVA_SPHERE_SPACE")) { parentSpace = evaSphereSpace; } else if (iu.iu_space.Equals("EVA_GRID_SPACE")) { parentSpace = evaGridSpace; } return(parentSpace); }
public void UnitSelected(bool select, GameObject unit) { unit.TryGetComponent(out IUnit IU); var type = IU.GetUnitType(); switch (type) { case TextureAssetType.Builder: m_Builder.EnableMainUI(select, unit); break; case TextureAssetType.Solider: m_Soldier.EnableMainUI(select, unit); break; case TextureAssetType.Horse: m_Horse.EnableMainUI(select, unit); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
int FindPoint(int _start, bool _positive) { if (_positive) { for (int i = _start; i <= Stop; i++) { if (!Check(i, StartPoint)) { continue; } if (!CheckWin(i, StartPoint)) { continue; } return(i); } } else { EStartPoint sp = Reverse(StartPoint); for (int i = _start; i <= Stop; i++) { IU iui = iu[i]; if (!Check(i, sp)) { continue; } if (!CheckWin(i, sp)) { continue; } return(i); } } return(-1); }
public void ajoutBois() { uI = Camera.main.GetComponent <IU>(); nombreDeBois += 100; uI.mettreAJourBois(nombreDeBois); }
private void Start() { score = 0; or = 0; uI = Camera.main.GetComponent <IU>(); }
bool Check(int _index, EStartPoint _StartPoint) { return(IU.Check(iu[_index], _StartPoint)); }
private void DisplayIUs(IAU iau) { //destroy current ARControllers foreach (Transform trans in panel_top.GetComponentsInChildren <Transform>()) { if (trans.tag.Equals("arc")) { Destroy(trans.gameObject); } } foreach (Transform trans in panel_bottom.GetComponentsInChildren <Transform>()) { if (trans.tag.Equals("arc")) { Destroy(trans.gameObject); } } //create new arcontrollers with new Content GameObject obj = null; for (int i = 0; i < iau.iau_ius.Count; ++i) { IU iu = iau.iau_ius[i]; switch (iu.iu_type) { case "image": PictureARC pictureARC = new PictureARC(); pictureARC.SetLink(iu.iu_link); pictureARC.SetPos(iu.GetPosition()); pictureARC.SetScale(iu.GetScale()); pictureARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(pictureARC, panel_top, imagePrefab); break; case "text": TextARC textARC = new TextARC(); textARC.SetLink(iu.iu_link); textARC.SetPos(iu.GetPosition()); textARC.SetScale(iu.GetScale()); textARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(textARC, panel_top, textPrefab); break; case "video": VideoARC videoARC = new VideoARC(); videoARC.SetLink(iu.iu_link); videoARC.SetPos(iu.GetPosition()); videoARC.SetScale(iu.GetScale()); videoARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(videoARC, panel_top, videoPrefab); break; case "audio": AudioARC audioARC = new AudioARC(); audioARC.SetLink(iu.iu_link); audioARC.SetPos(iu.GetPosition()); audioARC.SetScale(iu.GetScale()); audioARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(audioARC, panel_top, audioPrefab); break; case "3d": Model3dARC model3dARC = new Model3dARC(); model3dARC.SetLink(iu.iu_link); model3dARC.SetPos(iu.GetPosition()); model3dARC.SetScale(iu.GetScale()); model3dARC.SetRotation(iu.GetRotation()); switch (model3dARC.GetModel()) { case "fusebox": obj = CreateARC.CreateIU(model3dARC, panel_bottom, fuseboxPrefab); break; case "battery pack": obj = CreateARC.CreateIU(model3dARC, panel_bottom, batteryPackPrefab); break; case "buss bars": obj = CreateARC.CreateIU(model3dARC, panel_bottom, bussBarsPrefab); break; case "estop button key": obj = CreateARC.CreateIU(model3dARC, panel_bottom, eStopButtonKeyPrefab); break; case "estop button push": obj = CreateARC.CreateIU(model3dARC, panel_bottom, eStopButtonPushPrefab); break; case "conveyor belt": obj = CreateARC.CreateIU(model3dARC, panel_bottom, conveyorPrefab); break; default: Debug.Log("Could not find 3d model by name '" + model3dARC.GetModel() + "'"); break; } obj.AddComponent <BoxCollider>().size = new Vector3(50, 15, 30); break; default: Debug.Log("Something went wrong with iu type"); break; } } }
private void DisplayIUs(IAU iau) { //destroy current ARControllers foreach (Transform trans in panel_top.GetComponentsInChildren <Transform>()) { if (trans.tag.Equals("arc")) { Destroy(trans.gameObject); } } foreach (Transform trans in panel_bottom.GetComponentsInChildren <Transform>()) { if (trans.tag.Equals("arc")) { Destroy(trans.gameObject); } } foreach (Transform trans in worldSpace.GetComponentsInChildren <Transform>()) { if (trans.tag.Equals("arc")) { Destroy(trans.gameObject); } } //create new arcontrollers with new Content GameObject obj = null; for (int i = 0; i < iau.iau_ius.Count; ++i) { IU iu = iau.iau_ius[i]; switch (iu.iu_type) { case "image": PictureARC pictureARC = new PictureARC(); pictureARC.SetLink(iu.iu_link); pictureARC.SetPos(iu.GetPosition()); pictureARC.SetScale(iu.GetScale()); pictureARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(pictureARC, panel_top, imagePrefab); break; case "text": TextARC textARC = new TextARC(); textARC.SetLink(iu.iu_link); textARC.SetPos(iu.GetPosition()); textARC.SetScale(iu.GetScale()); textARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(textARC, panel_top, textPrefab); break; case "video": VideoARC videoARC = new VideoARC(); videoARC.SetLink(iu.iu_link); videoARC.SetPos(iu.GetPosition()); videoARC.SetScale(iu.GetScale()); videoARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(videoARC, panel_top, videoPrefab); break; case "audio": AudioARC audioARC = new AudioARC(); audioARC.SetLink(iu.iu_link); audioARC.SetPos(iu.GetPosition()); audioARC.SetScale(iu.GetScale()); audioARC.SetRotation(iu.GetRotation()); obj = CreateARC.CreateIU(audioARC, panel_top, audioPrefab); break; case "3d": Model3dARC model3dARC = new Model3dARC(); model3dARC.SetLink(iu.iu_link); model3dARC.SetPos(iu.GetPosition()); model3dARC.SetScale(iu.GetScale()); model3dARC.SetRotation(iu.GetRotation()); CreateARC.CreateIU(model3dARC, panel_bottom, model3dPrefab); break; default: Debug.Log("Something went wrong with iu type"); break; } } }
IEnumerator Calc0( SqlBoolean _pars, SqlString _img, SqlString _stresh, SqlInt32 _HalfPeriod, SqlInt32 _HalfPeriodDif, SqlBoolean _FullPeriod, SqlString _ByU, SqlString _ValIU, SqlInt32 _BorderStart, SqlInt32 _BorderStop, SqlInt32 _SOPLenght, SqlInt32 _SOPStart, SqlInt32 _SOPStop ) { if (_img.IsNull) { yield break; } StartPoint = ParceEStartPoint(_ByU.Value); ValIU = ParceEValIU(_ValIU.Value); iu = IU.StrToIUfloat(_img.Value); periodMin = periodMin = _HalfPeriod.Value - _HalfPeriodDif.Value; if (periodMin < 0) { periodMin = 0; } periodMax = _HalfPeriod.Value + _HalfPeriodDif.Value; if (_SOPLenght.IsNull) { if (_BorderStart.IsNull) { Start = 0; } else { Start = Convert.ToInt32(Math.Floor(Convert.ToDouble(iu.Length) * _BorderStart.Value / 100)); } if (_BorderStop.IsNull) { Stop = iu.Length - 1; } else { Stop = iu.Length - 1 - Convert.ToInt32(Math.Floor(Convert.ToDouble(iu.Length) * _BorderStop.Value / 100)); } } else { double per_mm = iu.Length; per_mm /= _SOPLenght.Value; Start = Convert.ToInt32(Math.Ceiling(per_mm * (_SOPStart.IsNull ? 0 : _SOPStart.Value))); Stop = Convert.ToInt32(Math.Ceiling(per_mm * (_SOPStop.IsNull ? 0 : _SOPStop.Value))); if (Start < 0) { Start = 0; } if (Stop < Start) { Stop = Start; } if (Stop > iu.Length - 1) { Stop = iu.Length - 1; } } FullPeriod = _FullPeriod.Value; win = Convert.ToInt32(Math.Ceiling(_HalfPeriod.Value * 0.05)); int[] tresh; int treshMax; if (_stresh.IsNull) { tresh = new int[0]; treshMax = 0; } else { string[] mtresh = _stresh.Value.Split(';'); tresh = new int[mtresh.Length]; double k = _HalfPeriod.Value; k /= 100; treshMax = 0; for (int i = 0; i < mtresh.Length; i++) { tresh[i] = (int)(k * Convert.ToDouble(mtresh[i].Replace('.', ','))); if (treshMax < tresh[i]) { treshMax = tresh[i]; } } } double[] coords = new double[tresh.Length]; for (int i = 0; i < tresh.Length; i++) { coords[i] = 0; } List <SGHalfPeriod> Lsghp = new List <SGHalfPeriod>(); int nn = 0; SGPeriod prev_period = new SGPeriod() { start = Start, size = 0 }; for (; ;) { SGPeriod period = GetNextPeriod(prev_period); if (period == null) { break; } if (period.start + treshMax >= iu.Length) { break; } if (period.size > periodMax || period.size < periodMin) { prev_period = period; continue; } Lsghp.Add(new SGHalfPeriod(nn, period.start, period.size)); for (int i = 0; i < coords.Length; i++) { coords[i] += iu[period.start + tresh[i]].Val(ValIU); } nn++; prev_period = period; } for (int i = 0; i < coords.Length; i++) { coords[i] = Math.Round(coords[i] / nn, 2); if (double.IsNaN(coords[i])) { coords[i] = 0; } } if (_pars.Value) { for (int i = 0; i < coords.Length; i++) { yield return(new Result(i, coords[i], "")); } } else { for (int i = 0; i < Lsghp.Count; i++) { yield return(new Result(Lsghp[i].start, Lsghp[i].size, "")); } } }
private void btnConfirm_Click(object sender, EventArgs e) { if (UpdateRecordEditorPanle.Controls.Count > 0) { IUpdateRecordInfo IU; IU = UpdateRecordEditorPanle.Controls[0] as IUpdateRecordInfo; _StudUpdateRec = IU.GetStudUpdateRecord(); _prlp = IU.GetLogData(); int codeInt; if (_StudUpdateRec != null) { if (int.TryParse(_StudUpdateRec.UpdateCode, out codeInt) && _actMode == actMode.新增) { int icode; List <SHUpdateRecordRecord> UpRec01List = new List <SHUpdateRecordRecord>(); // 檢查是否有新生異動 foreach (SHUpdateRecordRecord rec in SHUpdateRecord.SelectByStudentID(_StudentID)) { if (int.TryParse(rec.UpdateCode, out icode)) { if (icode > 0 && icode < 100) { UpRec01List.Add(rec); } } } if (UpRec01List.Count > 0 && codeInt < 100) { if (FISCA.Presentation.Controls.MsgBox.Show("已有" + UpRec01List.Count + "筆新生異動,是否覆蓋", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { SHUpdateRecord.Delete(UpRec01List); } else { return; } } // 檢查是否有畢業異動 List <SHUpdateRecordRecord> UpRec05List = (from data in SHUpdateRecord.SelectByStudentID(_StudentID) where data.UpdateCode == "501" select data).ToList(); if (UpRec05List.Count > 0 && codeInt == 501) { if (FISCA.Presentation.Controls.MsgBox.Show("已有" + UpRec01List.Count + "筆畢業異動,是否覆蓋", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { SHUpdateRecord.Delete(UpRec05List); } else { return; } } } } if (_StudUpdateRec != null) { // 儲存學年度學期 年級 _StudUpdateRec.SchoolYear = intSchoolYear.Value; _StudUpdateRec.Semester = intSemester.Value; if (cbxGradeYear.Text == "延修生") { _StudUpdateRec.GradeYear = "延修生"; } else { _StudUpdateRec.GradeYear = cbxGradeYear.Text; } // 儲存異動資料 string strItemName = ""; if (_actMode == actMode.新增) { SHUpdateRecord.Insert(_StudUpdateRec); strItemName = "新增:"; } else { SHUpdateRecord.Update(_StudUpdateRec); strItemName = "修改:"; } SHStudentRecord studRec = SHStudent.SelectByID(_StudentID); // Log strItemName += "學生姓名:" + studRec.Name + _actMode.ToString(); _prlp.SetActionBy("學生", strItemName); _prlp.SaveLog("", ":", "student", _StudentID); _checkSave = true; // 取得 UpdateCode int intUpdateCode; int.TryParse(_StudUpdateRec.UpdateCode, out intUpdateCode); // 學生資料 Cache List <SHStudentRecord> AllStudRec = null; // 復學,學生狀態是非一般,輸入異動代碼是復學,問使用者是否轉成一般。 if (intUpdateCode >= 221 && intUpdateCode <= 226 && studRec.Status != K12.Data.StudentRecord.StudentStatus.一般) { if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成一般?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (AllStudRec == null) { AllStudRec = SHStudent.SelectAll(); } // 檢查將變更學生狀態 // 身分證 List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.一般 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList(); // 學號 List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.一般 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList(); if (studNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在一般狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態"); } if (studIDNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在一般狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態"); } if (studIDNumber.Count == 0 && studNumber.Count == 0) { studRec.Status = K12.Data.StudentRecord.StudentStatus.一般; SHStudent.Update(studRec); } } } // 轉出,學生狀態是一般,輸入異動代碼是轉出,問使用者是否轉成畢業或離校。 if (intUpdateCode >= 311 && intUpdateCode <= 316 && studRec.Status == K12.Data.StudentRecord.StudentStatus.一般) { if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成畢業或離校?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (AllStudRec == null) { AllStudRec = SHStudent.SelectAll(); } // 檢查將變更學生狀態 // 身分證 List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList(); // 學號 List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList(); if (studNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在畢業或離校狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態"); } if (studIDNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在畢業或離校狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態"); } if (studIDNumber.Count == 0 && studNumber.Count == 0) { studRec.Status = K12.Data.StudentRecord.StudentStatus.畢業或離校; SHStudent.Update(studRec); } } } // 休學,學生狀態是一般,輸入異動代碼是休學,問使用者是否轉成休學。 if (intUpdateCode >= 341 && intUpdateCode <= 349 && studRec.Status == K12.Data.StudentRecord.StudentStatus.一般) { if (FISCA.Presentation.Controls.MsgBox.Show("請問是否將學生狀態變更成休學?", "提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (AllStudRec == null) { AllStudRec = SHStudent.SelectAll(); } // 檢查將變更學生狀態 // 身分證 List <string> studIDNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.休學 && stud.IDNumber == studRec.IDNumber select stud.ID).ToList(); // 學號 List <string> studNumber = (from stud in AllStudRec where stud.Status == K12.Data.StudentRecord.StudentStatus.休學 && stud.StudentNumber == studRec.StudentNumber select stud.ID).ToList(); if (studNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在休學狀態有相同的學號:" + studRec.StudentNumber + ",無法變更學生狀態"); } if (studIDNumber.Count > 0) { FISCA.Presentation.Controls.MsgBox.Show("在休學狀態有相同的身分證號:" + studRec.IDNumber + ",無法變更學生狀態"); } if (studIDNumber.Count == 0 && studNumber.Count == 0) { studRec.Status = K12.Data.StudentRecord.StudentStatus.休學; SHStudent.Update(studRec); } } } this.Close(); // 畫面同步 SmartSchool.StudentRelated.Student.Instance.SyncAllBackground(); } } }
private void btnConfirm_Click(object sender, EventArgs e) { IUpdateRecordInfo IU; if (UpdateRecordEditorPanle.Controls.Count > 0) { IU = UpdateRecordEditorPanle.Controls[0] as IUpdateRecordInfo; _StudUpdateRecordEntity = IU.GetStudUpdateRecordData(); } // 當新增時才處理 if (cbxSel.Enabled) { if (cbxSel.Text == "新生") { bool checkSameUpdateCode1 = DAL.DALTransfer2.checkStudentSameUpdateCode(RunningID, _StudUpdateRecordEntity, "1"); if (checkSameUpdateCode1) { MsgBox.Show("已有1筆新生異動,請刪除後再新增"); return; } } if (cbxSel.Text == "畢業") { bool checkSameUpdateCode2 = DAL.DALTransfer2.checkStudentSameUpdateCode(RunningID, _StudUpdateRecordEntity, "2"); if (checkSameUpdateCode2) { MsgBox.Show("已有1筆畢業異動,請刪除後再新增"); return; } } // 檢查同一天是否有相同異動 bool checkSameUpdateDateAndCode = false; checkSameUpdateDateAndCode = DAL.DALTransfer2.checkStudentSameUpdateCode(RunningID, _StudUpdateRecordEntity); if (checkSameUpdateDateAndCode) { if (MsgBox.Show("此異動日期已有相同異動,請問是否新增?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } // 儲存學年度學期 年級 _StudUpdateRecordEntity.SchoolYear = intSchoolYear.Value; _StudUpdateRecordEntity.Semester = intSemester.Value; _StudUpdateRecordEntity.SetGradeYear(intGradeYear.Text); // 儲存異動資料 DAL.DALTransfer2.SetStudUpdateRecordEntity(_StudUpdateRecordEntity); // Log string strItemName = "學生姓名:" + JHSchool.Data.JHStudent.SelectByID(RunningID).Name + "," + prlp.GetAction() + ":"; if (_StudUpdateRecordEntity.checkSameUpdateCode("1")) { strItemName += "新生異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("2")) { strItemName += "畢業異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("3")) { strItemName += "轉入異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("4")) { strItemName += "轉出異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("5")) { strItemName += "休學異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("6")) { strItemName += "復學異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("7")) { strItemName += "中輟異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("8")) { strItemName += "續讀異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("9")) { strItemName += "更正學籍異動"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("10")) { strItemName += "延長修業年限"; } if (_StudUpdateRecordEntity.checkSameUpdateCode("11")) { strItemName += "死亡"; } prlp.SetActionBy("學生", strItemName); prlp.SaveLog("", ":", "student", RunningID); JHSchool.Data.JHStudentRecord studRec = JHSchool.Data.JHStudent.SelectByID(RunningID); bool checkUpdateStudStatus = false; List <string> tmpList0 = new List <string>(); List <string> tmpList1 = new List <string>(); List <string> tmpList2 = new List <string>(); List <string> tmpList3 = new List <string>(); foreach (JHSchool.Data.JHStudentRecord stud in JHSchool.Data.JHStudent.SelectAll()) { if (stud.Status == K12.Data.StudentRecord.StudentStatus.一般) { tmpList0.Add(stud.IDNumber); } if (stud.Status == K12.Data.StudentRecord.StudentStatus.畢業或離校) { tmpList1.Add(stud.IDNumber); } if (stud.Status == K12.Data.StudentRecord.StudentStatus.休學) { tmpList2.Add(stud.IDNumber); } if (stud.Status == K12.Data.StudentRecord.StudentStatus.輟學) { tmpList3.Add(stud.IDNumber); } } // 轉出 if (_StudUpdateRecordEntity.checkSameUpdateCode("4") || _StudUpdateRecordEntity.checkSameUpdateCode("11")) { if (MessageBox.Show("請問是否更改學生狀態成 離校?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (tmpList1.Contains(studRec.IDNumber)) { MsgBox.Show("學生狀態 離校 有重複身分證號,請檢查後變更."); return; } studRec.Status = JHSchool.Data.JHStudentRecord.StudentStatus.畢業或離校; checkUpdateStudStatus = true; strItemName += ",更改學生狀態成 離校"; } } // 休學 if (_StudUpdateRecordEntity.checkSameUpdateCode("5")) { if (MessageBox.Show("請問是否更改學生狀態成 休學?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (tmpList2.Contains(studRec.IDNumber)) { MsgBox.Show("學生狀態 休學 有重複身分證號,請檢查後變更."); return; } studRec.Status = JHSchool.Data.JHStudentRecord.StudentStatus.休學; checkUpdateStudStatus = true; strItemName += "更改學生狀態成 休學"; } } // 中輟 if (_StudUpdateRecordEntity.checkSameUpdateCode("7")) { if (MessageBox.Show("請問是否更改學生狀態成 輟學?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (tmpList3.Contains(studRec.IDNumber)) { MsgBox.Show("學生狀態 輟學 有重複身分證號,請檢查後變更."); return; } studRec.Status = JHSchool.Data.JHStudentRecord.StudentStatus.輟學; checkUpdateStudStatus = true; strItemName += "更改學生狀態成 輟學"; } } // 處理復學轉成一般 if (_StudUpdateRecordEntity.checkSameUpdateCode("6")) { if (MessageBox.Show("請問是否更改學生狀態成 一般?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (tmpList0.Contains(studRec.IDNumber)) { MsgBox.Show("學生狀態 一般 有重複身分證號,請檢查後變更."); return; } studRec.Status = JHSchool.Data.JHStudentRecord.StudentStatus.一般; checkUpdateStudStatus = true; strItemName += "更改學生狀態成 一般"; } } // prlp.SaveLog("學生.異動資料", prlp.GetAction(),"學生",RunningID , strItemName); if (checkUpdateStudStatus) { JHSchool.Data.JHStudent.Update(studRec); JHSchool.Student.Instance.SyncDataBackground(RunningID); } JHSchool.Permrec.UpdateRecord.Instance.SyncAllBackground(); JHSchool.Student.Instance.SyncDataBackground(RunningID); prlp = null; }