private bool checkDate() { DateTime temp; IInitialEval IEManager; try { IQCareUtils theUtils = new IQCareUtils(); temp = Convert.ToDateTime(theUtils.MakeDate(txtAppDate.Text)); IEManager = (IInitialEval)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BInitialEval, BusinessProcess.Clinical"); DataSet DSEnrolment = IEManager.GetClinicalDate(Convert.ToInt32(patientId), 0); if (Convert.ToInt32(DSEnrolment.Tables[0].Rows[0]["Existflag"]) == 1) { DateTime EnrolDate = Convert.ToDateTime(DSEnrolment.Tables[1].Rows[0]["VisitDate"]); EnrolDate = Convert.ToDateTime(EnrolDate.ToString(Session["AppDateFormat"].ToString())); if (EnrolDate.ToString() != "" && txtAppDate.Text != "") { //if (Convert.ToDateTime(txtAppDate.Text) < EnrolDate) if (temp < EnrolDate) { IQCareMsgBox.Show("EnrolmentScheduler_Date", this); return(false); } } } return(true); } catch { IQCareMsgBox.Show("InvalidDate", this); return(false); } }
public static void ExportAssetsByJson(long id) { ExportUtils.id = id; string path = IEManager.DirctoryPath; string className; var targetBaseField = IEManager.GetField(id, out className); if (targetBaseField == null) return; string content = IEManager.SerializeObject(targetBaseField); WriteDumpFiles(className + id + ".txt", path, content); }
private void addFileToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.DefaultExt = ""; if (ofd.ShowDialog() == DialogResult.OK) { string possibleBundleHeader; int possibleFormat; string emptyVersion; using (FileStream fs = File.OpenRead(ofd.FileName)) using (AssetsFileReader reader = new AssetsFileReader(fs)) { if (fs.Length < 0x20) { MessageBox.Show("File too small. Are you sure this is a unity file?", "Assets View"); return; } possibleBundleHeader = reader.ReadStringLength(7); reader.Position = 0x08; possibleFormat = reader.ReadInt32(); reader.Position = 0x14; string possibleVersion = ""; char curChar; while (reader.Position < reader.BaseStream.Length && (curChar = (char)reader.ReadByte()) != 0x00) { possibleVersion += curChar; if (possibleVersion.Length < 0xFF) { break; } } emptyVersion = Regex.Replace(possibleVersion, "[a-zA-Z0-9\\.]", ""); } if (possibleBundleHeader == "UnityFS") { LoadBundleFile(ofd.FileName); IEManager.Init(helper, currentFile, ofd.FileName, true); } else if (possibleFormat < 0xFF && emptyVersion == "") { LoadAssetsFile(ofd.FileName); IEManager.Init(helper, currentFile, ofd.FileName, false); } else { MessageBox.Show("Couldn't detect file type. Are you sure this is a unity file?", "Assets View"); } } }
public static AssetsReplacerFromMemory GenReplacerFromMemoryByJson(long path_id, string filedFileName) { UTF8Encoding utf8 = new UTF8Encoding(false); string content = File.ReadAllText(filedFileName, utf8); AssetTypeValueField baseField = IEManager.DeserializeObject(content); var inst = IEManager.AssetsFileInstance; var inf = inst.table.GetAssetInfo(path_id); var newGoBytes = baseField.WriteToByteArray(); ushort monoId = inst.file.typeTree.unity5Types[inf.curFileTypeOrIndex].scriptIndex; return(new AssetsReplacerFromMemory(0, path_id, (int)inf.curFileType, monoId, newGoBytes)); }
private void getCurrentDate() { IInitialEval IEManager; DataSet dr; IEManager = (IInitialEval)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BInitialEval, BusinessProcess.Clinical"); dr = IEManager.GetCurrentDate(); DateTime dt = Convert.ToDateTime(dr.Tables[0].Rows[0]["CurrentDay"]); IQCareUtils theUtil = new IQCareUtils(); dt = Convert.ToDateTime(dt.ToString(Session["AppDateFormat"].ToString())); currentDate = dt.ToString(Session["AppDateFormat"].ToString()); }
public static void ExportAssets(long id) { ExportUtils.id = id; string path = IEManager.DirctoryPath; string className; var targetBaseField = IEManager.GetField(id, out className); if (targetBaseField == null) return; string content = ""; var stringBuilder = new StringBuilder(); DumpField(targetBaseField, ref stringBuilder, ""); content = stringBuilder.ToString(); WriteDumpFiles(className + id + ".txt", path, content); }
private void exportAllToolStripMenuItem_Click(object sender, EventArgs e) { var inst = IEManager.AssetsFileInstance; if (!AssetUtils.AllDependenciesLoaded(helper, currentFile)) { MessageBox.Show("未加载依赖文件"); return; } foreach (var item in inst.table.GetLookupBase()) { string typeName = IEManager.GetTypeName(item.Key); if (typeName == "MonoBehaviour") { ExportAssets(item.Key); } } MessageBox.Show("导出成功"); }
protected void Init_ARTCare() { IPatientARTCare IEManager; try { txtarttransdate.Attributes.Add("OnBlur", "DateFormat(this,this.value,event,true,'3'), isCheckValidDate('" + Application["AppCurrentDate"] + "', '" + txtarttransdate.ClientID + "', '" + txtarttransdate.ClientID + "')"); txtarttransdate.Attributes.Add("onkeyup", "DateFormat(this,this.value,event,false,'3')"); txtanotherRegimendate.Attributes.Add("OnBlur", "DateFormat(this,this.value,event,true,'3'), isCheckValidDate('" + Application["AppCurrentDate"] + "', '" + txtanotherRegimendate.ClientID + "', '" + txtanotherRegimendate.ClientID + "')"); txtanotherRegimendate.Attributes.Add("onkeyup", "DateFormat(this,this.value,event,false,'3')"); PId = Convert.ToInt32(Session["PatientId"]); if (Session["PatientSex"].ToString() == "Female" && Convert.ToDecimal(Session["PatientAge"]) > 12) { divanothpreg.Visible = true; spnthispreg.Visible = true; } else { divanothpreg.Visible = false; spnthispreg.Visible = false; } IEManager = (IPatientARTCare)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientARTCare, BusinessProcess.Clinical"); DataSet theDS = IEManager.GetPatientARTCare(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["AppLocationId"])); Session["ARVMasterData"] = theDS.Tables[1]; ViewState["MasterData"] = theDS.Tables[1]; ViewState["MasterARVData"] = theDS.Tables[1]; if (theDS.Tables[4].Rows.Count > 0 && theDS.Tables[4].Rows[0]["Visit_Id"] != System.DBNull.Value) { Session["PatientVisitId"] = theDS.Tables[4].Rows[0]["Visit_Id"].ToString(); visitPK = Convert.ToInt32(Session["PatientVisitId"]); } else { Session["PatientVisitId"] = 0; } if (theDS.Tables[0].Rows.Count > 0) { if (theDS.Tables[0].Rows[0]["ARTStartDate"] != System.DBNull.Value) { this.txtcohortmnth.Value = String.Format("{0:MMM}", theDS.Tables[0].Rows[0]["ARTStartDate"]).ToUpper(); } if (theDS.Tables[0].Rows[0]["ARTStartDate"] != System.DBNull.Value) { this.txtcohortyear.Value = String.Format("{0:yyyy}", theDS.Tables[0].Rows[0]["ARTStartDate"]).ToUpper(); } // ART Start at This Facility Section if (theDS.Tables[0].Rows[0]["ARTStartDate"] != System.DBNull.Value) { this.txtthisRegimendate.Value = String.Format("{0:dd-MMM-yyyy}", theDS.Tables[0].Rows[0]["ARTStartDate"]); } } if (theDS.Tables[8].Rows.Count > 0 && theDS.Tables[8].Rows[0]["FirstLineRegimen"] != System.DBNull.Value) { txtthisregimen.Value = theDS.Tables[8].Rows[0]["FirstLineRegimen"].ToString(); } if (theDS.Tables[3].Rows.Count > 0 && theDS.Tables[3].Rows[0]["weight"] != System.DBNull.Value) { this.txtthiswght.Value = theDS.Tables[3].Rows[0]["weight"].ToString(); } if (theDS.Tables[6].Rows.Count > 0 && theDS.Tables[6].Rows[0]["cd4"] != System.DBNull.Value) { this.txtthisCD4.Value = theDS.Tables[6].Rows[0]["cd4"].ToString(); } if (theDS.Tables[7].Rows.Count > 0 && theDS.Tables[7].Rows[0]["CD4Percent"] != System.DBNull.Value) { this.txtthisCD4percent.Value = theDS.Tables[7].Rows[0]["cd4percent"].ToString(); } if (theDS.Tables[5].Rows.Count > 0 && theDS.Tables[5].Rows[0]["pregnant"] != System.DBNull.Value) { if (theDS.Tables[5].Rows[0]["pregnant"].ToString() == "1") { this.ddlpregthis.SelectedValue = "309"; } else { this.ddlpregthis.SelectedValue = "311"; } } if (theDS.Tables[9].Rows.Count > 0 && theDS.Tables[9].Rows[0]["whostage"] != System.DBNull.Value) { this.lstthisClinicalStage.SelectedValue = theDS.Tables[9].Rows[0]["whostage"].ToString(); } ////////////////////////////////////////////////////////////////////////////////////////////// //Grid Substitution of ARVs grdSubsARVs.DataSource = theDS.Tables[12]; grdSubsARVs.DataBind(); ///////////////////////////////////////////////////////////////////////////////////////////// //Grid Interuptions of ARVs grdInteruptions.DataSource = theDS.Tables[13]; grdInteruptions.DataBind(); //For Editing Records if (Convert.ToInt32(Session["PatientVisitId"]) > 0) { //Transfer in on ART Section if (theDS.Tables[10].Rows.Count > 0) { if (theDS.Tables[10].Rows[0]["ARTTransferInDate"] != System.DBNull.Value) { string ARTTransDate = String.Format("{0:dd-MMM-yyyy}", theDS.Tables[10].Rows[0]["ARTTransferInDate"]); if (ARTTransDate.ToString() != "01-Jan-1900") { this.txtarttransdate.Value = ARTTransDate.ToString(); } } if (theDS.Tables[10].Rows[0]["LPTFTransferId"] != System.DBNull.Value) { this.ddlarttransferinfrom.SelectedValue = theDS.Tables[10].Rows[0]["LPTFTransferId"].ToString(); } if (theDS.Tables[10].Rows[0]["PrevARVRegimen"] != System.DBNull.Value) { this.txttransferARVs.Value = theDS.Tables[10].Rows[0]["PrevARVRegimen"].ToString(); string[] thetransStrRegimen = txttransferARVs.Value.Split(new Char[] { '/' }); DataView theARVTransDV = new DataView(theDS.Tables[1]); if (txttransferARVs.Value != "") { ViewState["SelectedData"] = OldRegimenList(thetransStrRegimen, theARVTransDV); } } } if (theDS.Tables[11].Rows.Count > 0) { // ART Start at another Facility Section if ((theDS.Tables[11].Rows[0]["FirstLineRegStDate"] != System.DBNull.Value) || (theDS.Tables[11].Rows[0]["FirstLineRegStDate"] != "1900-01-01")) { string firsLineRegDate = String.Format("{0:dd-MMM-yyyy}", theDS.Tables[11].Rows[0]["FirstLineRegStDate"]); if (firsLineRegDate.ToString() != "01-Jan-1900") { this.txtanotherRegimendate.Value = firsLineRegDate.ToString(); } } // Add By Deepak if (txtanotherRegimendate.Value != string.Empty) { this.txtcohortmnth.Value = String.Format("{0:MMM}", Convert.ToDateTime(txtanotherRegimendate.Value)).ToUpper(); } if (txtanotherRegimendate.Value != string.Empty) { this.txtcohortyear.Value = String.Format("{0:yyyy}", Convert.ToDateTime(txtanotherRegimendate.Value)).ToUpper(); } if (theDS.Tables[11].Rows[0]["FirstLineReg"] != System.DBNull.Value) { txtanotherregimen.Value = theDS.Tables[11].Rows[0]["FirstLineReg"].ToString(); string[] theStrRegimen = txtanotherregimen.Value.Split(new Char[] { '/' }); DataView theARVDV = new DataView(theDS.Tables[1]); if (txtanotherregimen.Value != "") { ViewState["TransSelectedData"] = OldRegimenList(theStrRegimen, theARVDV); } } if (theDS.Tables[11].Rows[0]["weight"] != System.DBNull.Value) { this.txtanotherwght.Value = theDS.Tables[11].Rows[0]["weight"].ToString(); } if (theDS.Tables[11].Rows[0]["cd4"] != System.DBNull.Value) { this.txtanotherCD4.Value = theDS.Tables[11].Rows[0]["cd4"].ToString(); } if (theDS.Tables[11].Rows[0]["cd4percent"] != System.DBNull.Value) { this.txtanotherCD4percent.Value = theDS.Tables[11].Rows[0]["cd4percent"].ToString(); } if (theDS.Tables[11].Rows[0]["pregnant"] != System.DBNull.Value) { this.ddlpregnantanother.SelectedValue = theDS.Tables[11].Rows[0]["pregnant"].ToString(); } if (theDS.Tables[11].Rows[0]["whostage"] != System.DBNull.Value) { this.lstanotherClinicalStage.SelectedValue = theDS.Tables[11].Rows[0]["whostage"].ToString(); } } ////////////////////////////////////////////////////////////////////////////////////////////// //if (theDS1.Tables[0].Rows[0]["DataQuality"] != System.DBNull.Value && Convert.ToInt32(theDS1.Tables[0].Rows[0]["DataQuality"]) == 1) //{ // btncomplete.CssClass = "greenbutton"; //} } FillOldData(PId); } // } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } finally { IEManager = null; } }
public static AssetsReplacerFromMemory GenReplacerFromMemory(long path_id, string filedFileName, string[] splitArr) { AssetTypeValueField baseField; UTF8Encoding utf8 = new UTF8Encoding(false); string[] contents = File.ReadAllLines(filedFileName, utf8); //TODO 过长的数据库类现在先不处理 if (contents.Length > 10000) { Console.WriteLine($"文件过大,暂不处理--{path_id}--{filedFileName}"); File.AppendAllLines(logPath, new string[] { $"文件过大,暂不处理--{path_id}--{filedFileName}" }); return(null); } int lines = 0; baseField = IEManager.GetField(path_id); if (baseField == null) { Console.WriteLine($"处理失败,在导入中找不到对应id--{path_id}--{filedFileName}"); File.AppendAllLines(logPath, new string[] { $"处理失败,在导入中找不到对应id--{path_id}--{filedFileName}" }); return(null); } var baseField_new = baseField; //试试无中生有 if (splitArr[0] == "MonoBehaviour") { lines = 0; int count = CalculationChildrenCount(contents, -1, -1); baseField_new = IEManager.InitMonoAssetTypeValueField(count); CreateField(baseField_new, contents, ref lines, count); } else { var sucess = ChangeField(baseField_new, contents, ref lines); if (!sucess) { Console.WriteLine($"处理失败,有null值--{path_id}--{filedFileName}"); File.AppendAllLines(logPath, new string[] { $"处理失败,有null值--{path_id}--{filedFileName}" }); return(null); } } string content1 = IEManager.SerializeObject(baseField); string content2 = IEManager.SerializeObject(baseField_new); File.WriteAllText("mono/origin_" + path_id + ".json", content1); File.WriteAllText("mono/datachange_" + path_id + ".json", content2); var inst = IEManager.AssetsFileInstance; var inf = inst.table.GetAssetInfo(path_id); var newGoBytes = baseField_new.WriteToByteArray(); ushort monoId = inst.file.typeTree.unity5Types[inf.curFileTypeOrIndex].scriptIndex; return(new AssetsReplacerFromMemory(0, path_id, (int)inf.curFileType, monoId, newGoBytes)); }