/// <summary> /// Add the specified type. /// </summary> /// <param name="theType">The type to add.</param> public void AddType(String theType) { if (theType.Equals("b")) { AddType(EPLValueType.BooleanType); } else if (theType.Equals("e")) { AddType(EPLValueType.EnumType); } else if (theType.Equals("f")) { AddType(EPLValueType.FloatingType); } else if (theType.Equals("i")) { AddType(EPLValueType.IntType); } else if (theType.Equals("s")) { AddType(EPLValueType.StringType); } else if (theType.Equals("*")) { AddAllTypes(); } else { throw new EACompileError("Unknown type: " + theType); } }
public void reportesHorario(String opcion) { if (opcion.Equals("Todos")) { horarioS.conexionS(); dgReporte.AutoGenerateColumns = true; dgReporte.DataSource = horarioS.listarHorarios(); gbResultado.Visible = true; dgReporte.Visible = true; horarioS.cerrarConexion(); } if (opcion.Equals("Disponibles")) { horarioS.conexionS(); dgReporte.AutoGenerateColumns = true; dgReporte.DataSource = horarioS.listarHorariosDisponibles(); gbResultado.Visible = true; dgReporte.Visible = true; horarioS.cerrarConexion(); } if (opcion.Equals("Ocupados")) { horarioS.conexionS(); dgReporte.AutoGenerateColumns = true; dgReporte.DataSource = horarioS.listarHorariosOcupados(); gbResultado.Visible = true; dgReporte.Visible = true; horarioS.cerrarConexion(); } }
private void colorBodyParts(String color) { Color bodyColor = Color.Black; if (color.Equals("Red")) { bodyColor = Color.Red; } else if (color.Equals("Yellow")) { bodyColor = Color.Yellow; } else if (color.Equals("Green")) { bodyColor = Color.Green; } else if (color.Equals("Blue")) { bodyColor = Color.Blue; } headShape.BorderColor = bodyColor; rightArmShape.BorderColor = bodyColor; leftArmShape.BorderColor = bodyColor; rightLegShape.BorderColor = bodyColor; leftLegShape.BorderColor = bodyColor; bodyShape.BorderColor = bodyColor; }
public static SqlBoolean ArraysFullyIncluded(String AArray, String ASubArray, Char ASeparator) { //String // LArray = (AArray.IsNull ? null : AArray.Value), // LSubArray = (ASubArray.IsNull ? null : ASubArray.Value); if (String.IsNullOrEmpty(ASubArray) || ASubArray.Equals(ASeparator)) return true; if (String.IsNullOrEmpty(AArray) || AArray.Equals(ASeparator)) return false; if (AArray.Equals("*")) return new SqlBoolean(true); if (ASubArray.Equals("*")) return new SqlBoolean(false); AArray = ASeparator + AArray + ASeparator; foreach(String LItem in ASubArray.Split(new char[]{ASeparator}, StringSplitOptions.RemoveEmptyEntries)) { if(AArray.IndexOf(ASeparator + LItem + ASeparator) == -1) return false; } return true; }
/// <summary> /// retrieves value for key from internal storage /// </summary> /// <param name="key">name of value to get</param> /// <returns>value as object</returns> public override Object InternalGet(String key) { Object o = null; /* * special token : NODE * * returns current node */ if (key.Equals(NODE)) { return PeekNode(); } /* * ATTRIB - returns attribute map */ if (key.Equals(ATTRIB)) { DvslNode n = PeekNode(); return n.AttribMap; } /* * start with local storage */ return ctx[key]; }
private void CheckOutputValue(Rect rect, String recognizedCharacter, bool isError, StrokeCollection removedStrokes) { //Check out if it is header box if (!_truthTable.IsHeaderBox(rect)) { if (recognizedCharacter.Equals("1") || recognizedCharacter.Equals("l") || recognizedCharacter.Equals("|")) { _truthTable.insertValue(rect, "1"); } else if (recognizedCharacter.Equals("0") || recognizedCharacter.Equals("O")) { _truthTable.insertValue(rect, "0"); } else { _truthTable.DisplayInputErrorInfo(rect, removedStrokes); } }else { if (!isError) { if (_truthTable.default_terms_names.Contains(recognizedCharacter)) { _truthTable.insertValue(rect, recognizedCharacter); } else { _truthTable.DisplayInputErrorInfo(rect, removedStrokes); } } else { _truthTable.DisplayInputErrorInfo(rect, removedStrokes); } } }
public frmEntradaSaida(String tipoOperacao, Usuario user, String dataCaixa, bool permiteEscrita, String opId) { InitializeComponent(); this.opId = opId; mov = new Movimentacao(); tipoOp = tipoOperacao; dtCaixa = dataCaixa; this.Text = tipoOperacao; this.user = user; lblUser.Text = user.Login; lblData.Text = dataCaixa; if (tipoOperacao.Equals("Entrada")) btnConfirma.Image = imageList1.Images[0]; if (tipoOperacao.Equals("Saída")) btnConfirma.Image = imageList1.Images[1]; if (!permiteEscrita) { ttbDesc.Enabled = false; ttbValor.Enabled = false; btnConfirma.Visible = false; mov.EntradaId = opId; if (tipoOperacao.Equals("Entrada")) mov = mov.getEntradaById(); else mov = mov.getSaidaById(); ttbDesc.Text = mov.Desc; ttbValor.Text = new Utils().moneyFormata(mov.Valor); lblData.Text = DateTime.Parse(mov.CaiData).ToShortDateString(); } }
public static void Configure(ref Int32 intervalStart, ref Int32 intervalEnd, ref String returnType, ref String actualCode) { ConfigurationForm form = new ConfigurationForm(); form.edtEndInt.Text = intervalEnd.ToString(); form.edtStartInt.Text = intervalStart.ToString(); form.edtCode.Text = actualCode; if (returnType.Equals("Int32")) form.cbbReturnType.SelectedIndex = 0; else if (returnType.Equals("Double")) form.cbbReturnType.SelectedIndex = 1; else form.cbbReturnType.SelectedIndex = 2; form.ControlUIChanges(); if (form.ShowDialog() == DialogResult.OK) { intervalEnd = Convert.ToInt32(form.edtEndInt.Text); intervalStart = Convert.ToInt32(form.edtStartInt.Text); actualCode = form.edtCode.Text; returnType = form.cbbReturnType.Text; } }
// worst code I've ever written in my life is below. Too tired to write creative algorithm.... private int assignClassStartDay(String day, DateTime semesterStart) { DateTime d = new DateTime(); if (day.Equals("Mo")) { d = new DateTime(2011, 11, 7, 00, 00, 00, 00); } else if (day.Equals("Tu")) { d = new DateTime(2011, 11, 8, 00, 00, 00, 00); } else if (day.Equals("We")) { d = new DateTime(2011, 11, 9, 00, 00, 00, 00); } else if (day.Equals("Th")) { d = new DateTime(2011, 11, 10, 00, 00, 00, 00); } else if (day.Equals("Fr")) { d = new DateTime(2011, 11, 11, 00, 00, 00, 00); } TimeSpan t = semesterStart - d; double diff = Math.Floor(t.TotalDays) % 7; int daysUntil = Convert.ToInt32(7 - diff); // days from start of semester that first class occurs return semesterStart.Day + daysUntil; }
public static Object getDao(String daoName) { if (daoName.Equals("DELIVERY_NOTE")) { IDeliveryNoteDAO dao = new DeliveryNoteDAOImpl(); return dao; } else if (daoName.Equals("RECEIVE_NOTE")) { var dao = new ReceiveNoteDAOImpl(); return dao; } else if(daoName.Equals("CAR")) { ICarDAO dao = new CarDAOImpl(); return dao; } else if (daoName.Equals("LOCATION")) { ILocationDAO dao = new LocationDAOImpl(); return dao; } else { return null; } }
private void loadResult(string p,String type) { if (type.Equals("caythuoc")) { DataTable dt = admin.dao.CayThuoc_DAO.searchTenCayThuoc(p); lv_Result.DataSource = dt; lv_Result.DataBind(); } else if(type.Equals("hocaythuoc")) { DataTable dt = admin.dao.CayThuoc_DAO.searchhocaythuoc(p); lv_Result.DataSource = dt; lv_Result.DataBind(); } else if (type.Equals("baithuoc")) { DataTable dt = admin.dao.CayThuoc_DAO.searchBaiThuoc(p); lv_Result.DataSource = dt; lv_Result.DataBind(); } else { Response.Redirect("index.aspx"); } }
public ActionResult UpdateNotificationStatus(String Type) // assumes the enum is typeof EmployeeStatus { if (Type.Equals("Admin")) { foreach (var admin in db.SystemAdmins) { RegisteredUser registeredUser = null; registeredUser = db.RegisteredUsers.Find(admin.RegisteredUserRefId); registeredUser.NotificationStatus += 1; db.Entry(registeredUser).State = EntityState.Modified; LoadData(); } } else if (Type.Equals("GeneralUser")) { foreach (var users in db.GeneralUsers) { RegisteredUser registeredUser = null; registeredUser = db.RegisteredUsers.Find(users.RegisteredUserRefId); registeredUser.NotificationStatus += 1; db.Entry(registeredUser).State = EntityState.Modified; } } db.SaveChanges(); return Json(true); }
/// <summary> /// set query to select patient ID and nurse ID. Search for patient. /// </summary> /// <param name="field"></param> /// <param name="value"></param> /// <param name="data"></param> /// <returns></returns> public Data list(String field, String value,Data data) { String query = "Select * From history A, Users B WHERE A.patientId = B.UserID AND A.patientId = @pId AND A.staffId = @NurseID AND status = '0' <SEARCH> <DATE> ORDER BY historyId DESC"; String date = data.getString("date"); if (field.Equals("")) { query = query.Replace("<SEARCH>", ""); } else if (field.Equals("memo")) { query = query.Replace("<SEARCH>", "AND memo LIKE '%" + value + "%'"); } else if (field.Equals("patientId")) { query = query.Replace("<SEARCH>", "AND patientId LIKE '%" + value + "%'"); } if (date.Equals("")) { query = query.Replace("<DATE>", ""); } else { query = query.Replace("<DATE>", "AND CONVERT(VARCHAR(10), A.date, 103) = '<DATE>'".Replace("<DATE>", date)); } return select(query, data); }
public IEncoder newEncoder(String encodingSchema) { if(encodingSchema.Equals("BER",StringComparison.CurrentCultureIgnoreCase)) { return new org.bn.coders.ber.BEREncoder(); } else if (encodingSchema.Equals("PER", StringComparison.CurrentCultureIgnoreCase) || encodingSchema.Equals("PER/Aligned", StringComparison.CurrentCultureIgnoreCase) || encodingSchema.Equals("PER/A", StringComparison.CurrentCultureIgnoreCase)) { return new org.bn.coders.per.PERAlignedEncoder(); } else if (encodingSchema.Equals("PER/Unaligned", StringComparison.CurrentCultureIgnoreCase)|| encodingSchema.Equals("PER/U", StringComparison.CurrentCultureIgnoreCase)) { return new org.bn.coders.per.PERUnalignedEncoder(); } else if (encodingSchema.Equals("DER", StringComparison.CurrentCultureIgnoreCase)) { return new org.bn.coders.der.DEREncoder(); } else return null; }
/** * Construct trigger with the object that will trigger the...trigger. Trigger. * * triggeringObject - The object that the trigger is checking a condition on. * fieldName - Name of the field on the object to check the condition on. * comparison - The comparison to use in the conditional. * value - The value to compare the field against. */ public Trigger(Object triggeringObject, String fieldName, String comparison, String value) { this.triggeringObject = triggeringObject; eventList = new List<Event>(); // Get the field using reflection. triggeringField = triggeringObject.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); // Store an int to represent the comparison. if (comparison.Equals(">")) { this.comparison = 1; } else if (comparison.Equals("<")) { this.comparison = -1; } else if (comparison.Equals("==")) { this.comparison = 0; } // Parse the value to an int. this.value = Int32.Parse(value); }
public void ShowHome(String preview,Int32 processDefinitionId,Int32 flowId) { if (log.IsDebugEnabled) { log.Debug("ShowHome preview:"+preview+" processDefinitionId:"+processDefinitionId+" flowId:"+flowId); } IDefinitionSessionLocal definitionComponent = null; IExecutionSessionLocal executionComponent = null; try { definitionComponent = ServiceLocator.Instance.GetService(typeof (IDefinitionSessionLocal)) as IDefinitionSessionLocal; executionComponent = ServiceLocator.Instance.GetService(typeof (IExecutionSessionLocal)) as IExecutionSessionLocal; // IList taskList = executionComponent.GetTaskList(new Relations(new System.String[]{"processInstance.processDefinition"})); IList taskList = executionComponent.GetTaskList(); IList processDefinitions = definitionComponent.GetProcessDefinitions(); // Collect data for the preview if (preview != null) { if (preview.Equals("process")) { if (processDefinitionId == 0) { ArrayList errors = new ArrayList(); errors.Add("when parameter 'preview' is equal to 'process', a valid parameter 'processDefinitionId' should be provided as well,"); Context.Flash["errormessages"] = errors; } IProcessDefinition processDefinition = null; // Get the processDefinition processDefinition = definitionComponent.GetProcessDefinition(processDefinitionId); Context.Flash["processDefinition"]=processDefinition; } else if (preview.Equals("activity")) { if (flowId == 0) { ArrayList errors = new ArrayList(); errors.Add("when parameter 'preview' is equal to 'activity', a valid parameter 'flowId' should be provided as well,"); Context.Flash["errormessages"] = errors; } // IFlow flow = executionComponent.GetFlow(flowId, new Relations(new System.String[]{"processInstance.processDefinition"})); IFlow flow = executionComponent.GetFlow(flowId); Context.Flash["activity"] = flow.Node; AddImageCoordinates((IState)flow.Node); Context.Flash["processDefinition"]=flow.ProcessInstance.ProcessDefinition; } } Context.Flash["taskList"] = taskList; Context.Flash["processDefinitions"] = processDefinitions; Context.Flash["preview"] = preview; } finally { ServiceLocator.Instance.Release(executionComponent); ServiceLocator.Instance.Release(definitionComponent); } }
public static Freedom freedomFromString(String position) { if (position.Equals("STRICT")) return Freedom.STRICT; if (position.Equals("RELAXED")) return Freedom.RELAXED; if (position.Equals("FREE")) return Freedom.FREE; throw new Exception("Unknown freedom: " + position); }
static void Main() { // We'll create one Person object ... Person p1 = new Person("222-22-2222", "Fred"); // ... and maintain two handles on it (p1 and p2). Person p2 = p1; // We'll create a second different Person object with exactly the same // attribute values as the first Person object that we created, and will // use variable p3 to maintain a handle on this second object. Person p3 = new Person("222-22-2222", "Fred"); if (p1 == p2) Console.WriteLine("p1 == p2 is true"); if (p1.Equals(p2)) Console.WriteLine("p1.equals(p2) is true"); if (p1 == p3) Console.WriteLine("p1 == p3 is true"); if (p1.Equals(p3)) Console.WriteLine("p1.equals(p3) is true"); char[] c = {'b','o','o'}; String s1 = new String(c); String s2 = s1; String s3 = new String(c); if (s1 == s2) Console.WriteLine("s1 == s2 is true"); if (s1.Equals(s2)) Console.WriteLine("s1.equals(s2) is true"); if (s1 == s3) Console.WriteLine("s1 == s3 is true"); if (s1.Equals(s3)) Console.WriteLine("s1.equals(s3) is true"); }
/// <summary> /// Tạo báo cáo /// </summary> /// <param name="path">Đường dẫn tới file báo cáo</param> /// <param name="iTuNgay">Từ ngày</param> /// <param name="iDenNgay">Đến ngày</param> /// <param name="iTuThang">Từ tháng</param> /// <param name="iDenThang">Đến tháng</param> /// <param name="iNam">Năm</param> /// <param name="iDVTinh">Đơn vị tính</param> /// <returns></returns> public ExcelFile CreateReport(String path, String iTuNgay, String iDenNgay, String iTuThang, String iDenThang, String iNam, String iDVTinh, String iSoTo, String iReport, String UserID, String iID_MaTrangThaiDuyet) { XlsFile Result = new XlsFile(true); Result.Open(path); FlexCelReport fr = new FlexCelReport(); //Thêm chữ ký vào báo cáo fr = ReportModels.LayThongTinChuKy(fr, "rptKT_TongHop_RutDuToan"); LoadData(fr, iTuNgay, iDenNgay, iTuThang, iDenThang, iNam, iDVTinh,iSoTo,iReport,UserID,iID_MaTrangThaiDuyet); fr.SetValue("cap1", ReportModels.CauHinhTenDonViSuDung(1).ToUpper()); fr.SetValue("cap2", ReportModels.CauHinhTenDonViSuDung(2).ToUpper()); fr.SetValue("NgayThang", ReportModels.Ngay_Thang_Nam_HienTai()); DataTable dt = sLNS(GetLNS(iTuNgay, iDenNgay, iTuThang, iDenThang, iNam,UserID,iID_MaTrangThaiDuyet),iSoTo,iReport); if (dt.Rows.Count > 0) for (int i = 0; i < dt.Rows.Count; i++) fr.SetValue("LNS" + (i + 1), dt.Rows[i]["sMoTa"]); if (iDVTinh.Equals("rD")) fr.SetValue("DVT", "Đồng"); else if (iDVTinh.Equals("rND")) fr.SetValue("DVT", "Nghìn đồng"); else if (iDVTinh.Equals("rTrD")) fr.SetValue("DVT", "Triệu đồng"); fr.SetValue("NgayThangTK", "Từ ngày " + iTuNgay + "/ " + iTuThang + " Đến ngày " + iDenNgay + " /" + iDenThang + "/" + iNam); if (iReport.Equals("A4Ngang")) fr.SetValue("SoTo", "Tờ số: "+iSoTo); fr.Run(Result); return Result; }
public virtual Boolean AdminByAction( String action, User member, String choice ) { String condition = string.Format( "Id in ({0}) and ReceiverId={1}", choice, member.Id ); Message message = new Message(); if (action.Equals( "delete" )) { db.updateBatch<Message>( "set IsDelete=1", condition ); updateAllMsgCount( member ); updateNewMsgCount( member ); } else if (action.Equals( "undelete" )) { db.updateBatch<Message>( "set IsDelete=0", condition ); updateAllMsgCount( member ); updateNewMsgCount( member ); } else if (action.Equals( "deletetrue" )) { db.deleteBatch<Message>( condition ); updateAllMsgCount( member ); updateNewMsgCount( member ); } else if (action.Equals( "deletesendedmsg" )) { String condition2 = "Id in (" + choice + ") and SenderId=" + member.Id; db.updateBatch<MessageData>( "set IsDelete=1", condition2 ); } else if (action.Equals( "deletedraftmsg" )) { String condition3 = "Id in (" + choice + ") and SenderId=" + member.Id; db.deleteBatch<MessageDraft>( condition3 ); } return true; }
public XLoper Execute(String name, XLoper[] args) { Console.WriteLine(name); XLoper x = new XLoper(); x.Type = XLoper.xlTypeStr; x.Str = "#Unknown Function"; if (name.Equals("RandTest")) { x.Type = XLoper.xlTypeMulti; x.Arr.Arr = new XLoper[new Random().Next(50) + 2]; x.Arr.Rows = (uint)x.Arr.Arr.Length; x.Arr.Columns = 1; Random r = new Random(); for (int i = 0; i < x.Arr.Arr.Length; i++) { x.Arr.Arr[i] = MakeRandom(r); } } else if (name.Equals("ArrayTest")) { } return x; }
// convenience function to return correct verb based on message type public void setDefaultVerb(DERMSInterface.CIMData.header h, String name) { if (name.Equals("createDER") || name.Equals("dispatchDER")) verbText.Text = h.Verb = "create"; else if (name.Equals("getDER") || name.Equals("getDERStatus")) verbText.Text = h.Verb = "get"; }
public string SendRequest(String request, String conditions) { String res = ""; if (request.Equals("Dev_FPR_GetDistributors")) { res = this.Dev_FPR_GetDistributors(conditions); } else if (request.Equals("Dev_FPR_GetSalesMen")) { res = this.Dev_FPR_GetSalesMen(conditions); } else if (request.Equals("Dev_FPR_GetRoutes")) { res = this.Dev_FPR_GetRoutes(conditions); } else if (request.Equals("Dev_FPR_GetOutlets")) { res = this.Dev_FPR_GetOutlets(conditions); } else if (request.Equals("Dev_FPR_GetPoints")) { res = this.Dev_FPR_GetPoints(conditions); } return res; }
public String evalMAEK(String input, String type, int lineNumber, ref Hashtable symbolTable, TextView consoleText) { //Check if the type is valid if (!(type.Equals ("TROOF") || type.Equals ("YARN") || type.Equals ("NUMBR") || type.Equals ("NUMBAR") || type.Equals ("NOOB"))) { consoleText.Buffer.Text += "Syntax error at line: " + lineNumber + ". " + type + " is undefinded\n"; return "UNDEFINED"; } //Return value based on type requested switch (type) { case "TROOF": { //String literal no content if (Regex.IsMatch (input, @"\s*^""""$")) { return "FAIL"; } else if (Regex.IsMatch (input, @"\s*^""\.+""$")) { //string literal with content return "WIN"; } else if (Regex.IsMatch (input, @"^\-?[0]*.?[0]+\s*")) { // IF 0 return "FAIL"; } else { return "WIN"; } } case "YARN": { //If yarn literal already if (Regex.IsMatch (input, @"\s*^""\.""$")) { //Do not modify return input; } else { //Add quotes and return return "\"" + input + "\""; } } case "NOOB": { return "NOOB"; } case "NUMBR": { //consoleText.Buffer.Text += "to Numbr"; if (Regex.IsMatch (input, @"^"".*""$")) { consoleText.Buffer.Text += "String to Numbr"; input = comp.removeQuotes (input); int answer; Boolean isInteger = Int32.TryParse (input, out answer); if (isInteger) { return answer.ToString (); } return "BAWAL ITO."; } return (input.Equals ("WIN") ? "1" : "0"); } case "NUMBAR": { input = comp.removeQuotes (input); return input; } } return "UNDEFINED"; }
/* * Takes an input string (value of what's selected in comboBox) * and return the corresponding email address * Note: for now, all officers use the same email address. Expand this in the future :) */ private String getToAddressEmail(String selectedValue) { if (selectedValue.Equals("president")) { return "*****@*****.**"; } else if (selectedValue.Equals("vice-president")) { return "*****@*****.**"; } else if (selectedValue.Equals("treasuer")) { return "*****@*****.**"; } else if (selectedValue.Equals("secretary")) { return "*****@*****.**"; } else if (selectedValue.Equals("officeatlarge")) { return "*****@*****.**"; } else if (selectedValue.Equals("womenoutreach")) { return "*****@*****.**"; } else if (selectedValue.Equals("runsponsor")) { return "*****@*****.**"; } else //member support { return "*****@*****.**"; } }
public void AddVariable(String type, String name, String value) { if (type.Equals("int")) { // Integer int intValue = 0; try { intValue = Convert.ToInt32(value); } catch (Exception e) { throw new Exception("Variable " + name + " is defined as " + type + ", but " + value + " can't be converted to this variable type."); } intVars.Add(name,intValue); } else if (type.Equals("boolean")) { // Boolean Boolean booleanValue = false; try { booleanValue = Boolean.Parse(value); } catch (Exception e) { throw new Exception("Variable " + name + " is defined as " + type + ", but " + value + " can't be converted to this variable type."); } boolVars.Add(name, booleanValue); } }
public void GetUserDetails(int id) { string getUserDetail = "Select ID,Email,Name,City,Convert(varchar (20), RegisterDate, 106) RegisterDate,Convert(varchar (20), LastLogin, 106) LastLogin ,Description,ImageName,UserType FROM [User] where Id='" + id + "'"; dt = dbClass.ConnectDataBaseReturnDT(getUserDetail); if (dt.Rows.Count > 0) { UserImage.ImageUrl = "~/UserImage/" + dt.Rows[0]["ImageName"].ToString(); lblCreated.Text = dt.Rows[0]["RegisterDate"].ToString(); LabelLastLogin.Text = dt.Rows[0]["LastLogin"].ToString(); lblCreated.Text = dt.Rows[0]["RegisterDate"].ToString(); LabelAboutMe.Text = dt.Rows[0]["Description"].ToString(); LabelAboutMe0.Text = dt.Rows[0]["Name"].ToString(); LabelAboutMe1.Text = dt.Rows[0]["City"].ToString(); LabelType11.Text = dt.Rows[0]["UserType"].ToString(); UserTypeWhat = dt.Rows[0]["UserType"].ToString(); if (UserTypeWhat.Equals("Student")) { lnkCreateEvent.Visible = false; lnkCreateVacancy.Visible = false; } if (UserTypeWhat.Equals("Lecturer")) { AddToFriend.Visible = false; } } }
public ReceiveSync(Socket s, String syncPath) { this.s = s; this.syncPath = syncPath; try { while (true) { //接收需要同步的类型 syncType = getStringFromUTF8(new byte[20]); //接收文件名 fileName = getStringFromUTF8(new byte[50]); fileName = fileName.Substring(fileName.IndexOf('/') + 1); fileName = syncPath + "\\" + fileName; if (syncType.Equals("Send")) { ReceiveFile(); continue; } else if (syncType.Equals("Delete")) { File.Delete(fileName); continue; } break; } } catch(Exception){ MessageBox.Show("文件传输错误,系统正在尝试修复!", "Easybox"); } }
/// <summary> /// Lấy danh sách doanh nghiệp /// </summary> /// <param name="Quy">Quý</param> /// <param name="Nam">Năm</param> /// <param name="All">Lấy doanh nghiệp theo năm hay theo quý và năm</param> /// <returns></returns> public static DataTable GetDoanhNghiep(String Quy,String Nam) { String DKQuy = ""; if (Quy.Equals("5") || Quy.Equals("6")) DKQuy = "AND TCDN.iQuy=@iQuy-3"; else if (Quy.Equals("7")) DKQuy = ""; else DKQuy = "AND TCDN.iQuy=@iQuy"; DataTable dtDN = new DataTable(); String SQL = String.Format(@"SELECT TC.iID_MaDoanhNghiep,TC.sTenDoanhNghiep FROM TCDN_DoanhNghiep AS TC WHERE TC.iTrangThai=1 AND TC.iID_MaDoanhNghiep IN( SELECT TCDN.iID_MaDoanhNghiep FROM TCDN_KinhDoanh_ChungTuChiTiet AS TCDN WHERE TCDN.iTrangThai=1 AND TCDN.iNamLamViec=@iNamLamViec {0} )", DKQuy); SqlCommand cmd = new SqlCommand(SQL); cmd.Parameters.AddWithValue("@iNamLamViec", Nam); if (!String.IsNullOrEmpty(DKQuy)) { cmd.Parameters.AddWithValue("@iQuy", Quy); } dtDN = Connection.GetDataTable(cmd); cmd.Dispose(); return dtDN; }
private static void check() { userChoice = Console.ReadLine(); userChoice.ToLower().Trim(); if (userChoice.Equals("easy")) { grid = new int[M_G[0,1], M_G[0,1]]; generator(M_G[0,0], M_G[0,1]); return; } else if(userChoice.Equals("medium")) { grid = new int[M_G[1,1], M_G[1,1]]; generator(M_G[1, 0], M_G[1, 1]); return; } else if (userChoice.Equals("hard")) { grid = new int[M_G[2,1] , M_G[2,1]]; generator(M_G[2, 0], M_G[2, 1]); return; } if(x == -1) x = int.Parse(userChoice); else y = int.Parse(userChoice); }