本文整理汇总了C#中Class1类的典型用法代码示例。如果您正苦于以下问题:C# Class1类的具体用法?C# Class1怎么用?C# Class1使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Class1类属于命名空间,在下文中一共展示了Class1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main() {
Class1 obj1=new Class1();
CheckReturnedInt(obj1.F1("obj1"), 1);
CheckReturnedString(obj1.F2("obj1"), "String returned from Class1.F2:obj1");
CheckReturnedString(obj1.NonVirtualFunc(11), "String returned from Class1.NonVirtualFunc:11");
Console.WriteLine("");
Class2 obj2=new Class2();
CheckReturnedInt(obj2.F1("obj2"), 2);
CheckReturnedString(obj2.F2("obj2"), "String returned from Class2.F2:obj2");
CheckReturnedString(obj2.NonVirtualFunc(15), "String returned from Class2.NonVirtualFunc:30");
Console.WriteLine("");
I1 itf;
itf = obj1;
CheckReturnedInt(itf.F1("itf is now obj1"), 1);
CheckReturnedString(itf.F2("itf is now obj1"), "String returned from Class1.F2:itf is now obj1");
Console.WriteLine("");
itf = obj2;
CheckReturnedInt(itf.F1("itf is now obj2"), 2);
CheckReturnedString(itf.F2("itf is now obj2"), "String returned from Class2.F2:itf is now obj2");
Console.WriteLine("");
if (failed) {
System.Environment.ExitCode = 1;
}
else {
System.Environment.ExitCode = 0;
}
}
示例2: BindRemainder
private void BindRemainder()
{
try
{
ObjBal = new Class1();
ObjDataSet = new DataSet();
ObjBal.ScreenInd = Master123.GetRemainder;
ObjDataSet = (DataSet)ObjBal.fnGetData();
if (ObjDataSet.Tables[0] != null)
{
if (ObjDataSet.Tables[0].Rows.Count > 0)
{
//gvRemainders.Visible = false;
gvRemainders.DataSource = ObjDataSet.Tables[0];
gvRemainders.DataBind();
}
}
}
catch (Exception ex)
{
throw ex;
}
}
示例3: btnAdd_Click
protected void btnAdd_Click(object sender, EventArgs e)
{
objBal = new Class1();
try
{
int id = Convert.ToInt32(Session["UserID"]);
objBal = new Class1();
objBal.AdminRemainder = txtHotelPolicy.Text;
objBal.ScreenInd = Master123.InsertHotelPolicy;
objBal.id = id;
if (objBal.fnInsertRecord() == true)
{
lblmsg.Text = "You have Sucessfully Saved Your Policy";
txtHotelPolicy.Text = "";
BindAdminRemainder();
}
else
{
lblmsg.Text = "You can not to be saved your details";
}
}
catch (Exception ex)
{
}
}
示例4: Main
static void Main(string[] args)
{
Class1 target = new Class1();
target.sampleEvent += new SampleEventHandler(target.handler);
target.sampleEvent(target , EventArgs.Empty);
target.sampleEvent(null , EventArgs.Empty);
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Class1 x = new Class1();
x.connect();
if(!IsPostBack)
{
string q = "select * from Polls";
DataTable dt = x.display(q);
gv1.DataSource = dt;
gv1.DataBind();
if (Request.QueryString["iid"] != null)
{
string id= Request.QueryString["iid"].ToString();
string s = "delete from polls where id_poll=" + id;
x.allquery(s);
Response.Redirect("deletepoll.aspx");
}
}
}
示例6: DataTemplate_Should_Match_Data_Of_Type
public void DataTemplate_Should_Match_Data_Of_Type()
{
var target = new DataTemplate { DataType = typeof(Class1) };
var data = new Class1();
Assert.True(target.Match(data));
}
示例7: bt1_Click
protected void bt1_Click(object sender, EventArgs e)
{
Class1 x = new Class1();
x.connect();
string at = "select max(Id_institute) from Institutemaster ";
int ff = x.autoincrement(at);
string varidpol = ff.ToString();
string varname=txtname.Text;
string varadd=txtaddress.Text;
string varcity=txtcity.Text;
string varstate=txtstate.Text;
string varcountry=ddlcountry.SelectedItem.ToString();
string varabout=txtabout.Text;
string varaff=txtaffiliated.Text;
string varcat=ddlcategory.SelectedItem.ToString();
string varsub = ddlsub.SelectedItem.ToString();
string varwebsite=txtwebsite.Text;
string varemail=txtemail.Text;
string varpass= txtpassword.Text;
string varhelp=txthelp.Text;
string varapp = txtapp.Text;
string q = "insert into Institutemaster(Id_institute,Name,Address,City,State,Country,About,Affiliated,Category,Subcategory,Website,Email,Password,Helplineno,Approved) values("+ varidpol +",'"+varname +"','"+varadd +"','"+varcity +"','"+varstate +"','"+varcountry +"','"+varabout +"','"+varaff +"','"+varcat +"','"+varsub +"','"+varwebsite +"','"+varemail +"','"+varpass +"',"+varhelp+",'"+varapp +"')";
x.allquery(q);
}
示例8: Validate
public static string Validate(string uname,string pwd)
{
try
{
if (uname == null && pwd == null)
return "fail";
Class1 cn = new Class1();
DataSet ds = new DataSet();
ds = cn.getdata("select * from Login_mst where User_Name='" + uname + "' and User_Pass='" + pwd + "'");
if (ds.Tables[0].Rows.Count == 1)
{
HttpContext.Current.Session["username"] = uname;
return "success";
}
else
{
return "fail";
}
}
catch (Exception validate)
{
return "fail";
}
}
示例9: Later_Styles_Should_Override_Earlier
public void Later_Styles_Should_Override_Earlier()
{
Styles styles = new Styles
{
new Style(x => x.OfType<Class1>().Class("foo"))
{
Setters = new[]
{
new Setter(Class1.FooProperty, "Foo"),
},
},
new Style(x => x.OfType<Class1>().Class("foo"))
{
Setters = new[]
{
new Setter(Class1.FooProperty, "Bar"),
},
}
};
var target = new Class1();
List<string> values = new List<string>();
target.GetObservable(Class1.FooProperty).Subscribe(x => values.Add(x));
styles.Attach(target);
target.Classes.Add("foo");
target.Classes.Remove("foo");
Assert.Equal(new[] { "foodefault", "Foo", "Bar", "foodefault" }, values);
}
示例10: test1
public void test1()
{
var class1 = new Class1();
var duplicate = class1.Duplicate();
AssertNotNull(duplicate);
}
示例11: Func2
public void Func2()
{
object[] myObjects = new object[6];
myObjects[0] = new Class1();
myObjects[1] = new Class2();
myObjects[2] = "hello";
myObjects[3] = 123;
myObjects[4] = 123.4;
myObjects[5] = null;
for (int i = 0; i < myObjects.Length; ++i)
{
try
{
string s = (string)myObjects[i];
if (s != null)
{
// 1. conter
// dfaf
// dfafa
//afdfs
// 1.fafddaf
}
else
{
}
}
catch
{
}
}
}
示例12: AddMultipleRelations
public void AddMultipleRelations()
{
var class1 = new Class1().Modl();
class1.MultipleRelation.Add(new Class2());
class1.MultipleRelation.Add(new Class2());
class1.Save();
foreach (var class2 in class1.MultipleRelation)
class2.Save();
Assert.Equal(2, class1.MultipleRelation.Count());
Assert.Equal(class1.Id(), class1.MultipleRelation.First().SingleRelation.Id);
Assert.Equal(class1.Id(), class1.MultipleRelation.First().SingleRelation.Val.Id());
var loadedClass1 = Modl<Class1>.Get(class1.Id());
Assert.Equal(2, loadedClass1.MultipleRelation.Count());
Assert.Equal(loadedClass1.Id(), loadedClass1.MultipleRelation.First().SingleRelation.Id);
Assert.Equal(loadedClass1.Id(), loadedClass1.MultipleRelation.First().SingleRelation.Val.Id());
foreach (var class2 in class1.MultipleRelation)
{
var loadedClass2 = Modl<Class2>.Get(class2.Id());
Assert.NotNull(loadedClass2.SingleRelation.Val);
Assert.Equal(2, loadedClass2.SingleRelation.Val.MultipleRelation.Count());
Assert.True(loadedClass2.SingleRelation.Val.MultipleRelation.Any(x => x.Id() == loadedClass2.Id()));
}
}
示例13: btnUpdate_Click
protected void btnUpdate_Click(object sender, EventArgs e)
{
try
{
btnUpdate.Visible = false;
btnCancel.Visible = false;
int id = Convert.ToInt32(lblid.Text);
objBal = new Class1();
objBal.ScreenInd = Master123.UpdateAdminMarkUp;
objBal.Modifyby = Convert.ToInt32(Session["UserID"]);
objBal.id = id;
objBal.Type = ddltype.SelectedItem.Text;
objBal.MarkupAmount = txtAmount.Text;
if (objBal.fnUpdateRecord() == true)
{
lblmsg.Text = "You have Sucessfully Updated Your Record";
txtAmount.Text = "";
ddlAddSubtract.ClearSelection();
ddltype.ClearSelection();
BindAdminMarkUp();
btnUpdate.Visible = false;
btnCancel.Visible = false;
Button1.Visible = true;
}
}
catch (Exception ex)
{
}
}
示例14: btnAdd_Click
protected void btnAdd_Click(object sender, EventArgs e)
{
try
{
objBal = new Class1();
objBal.ScreenInd = Master123.InsertAdminMarkup;
objBal.Type = ddltype.SelectedItem.Text;
objBal.MarkupAmount = txtAmount.Text;
objBal.AddSubtract = ddlAddSubtract.SelectedItem.ToString();
objBal.Role = Session["Role"].ToString();
if (objBal.fnInsertRecord() == true)
{
lblmsg.Text = "You have Sucessfully Saved Your Notices";
txtAmount.Text = "";
ddltype.ClearSelection();
BindAdminMarkUp();
}
else
{
lblmsg.Text = "You can not to be saved your details";
}
}
catch
{
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Class1 c = new Class1();
ProductDataConsolidator obj = new ProductDataConsolidator();
Gridview1.DataSource = ProductDataConsolidator.Get();
Gridview1.DataBind();
}