protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            btnAdd.Visible = true;
            btnCancel.Visible = false;
            btnUpdate.Visible = false;
            int id = Convert.ToInt32(lblid.Text);
            objBal = new Class1();
            objBal.ScreenInd = Master123.UpdateHotelPolicy;
            objBal.Modifyby = Convert.ToInt32(Session["UserID"]);
            objBal.id = id;
            objBal.AdminRemainder = txtHotelPolicy.Text;
            if (objBal.fnUpdateRecord() == true)
            {
                lblmsg.Text = "You have Sucessfully Updated Your Record";
                txtHotelPolicy.Text = "";
                BindAdminRemainder();

            }

        }
        catch (Exception ex)
        {

        }
    }
Esempio n. 2
0
 public static void addtocart(string pid, string pname, int qty, int price, string img)
 {
     bool ismatch = false;
     Class1 ob = new Class1();
     ob.dt = (DataTable)HttpContext.Current.Session["cart"];
     for (int j = 0; j <= ob.dt.Rows.Count - 1; j++)
     {
         DataRow dr = ob.dt.Rows[j];
         if ((dr["pid"] == pid) && (dr["pname"] == pname))
         {
             dr["qty"] = Convert.ToInt32(dr["qty"]) + qty;
             ismatch = true;
             break;
         }
     }
     if (ismatch == false)
     {
         DataRow ndr = ob.dt.NewRow();
         ndr["pid"] = pid;
         ndr["pname"] = pname;
         ndr["qty"] = qty;
         ndr["price"] = price;
         ndr["img"] = img;
         ob.dt.Rows.Add(ndr);
     }
     HttpContext.Current.Session["cart"] = ob.dt;
 }
 static void Main()
 {
     var libClass = new Class1();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Form1());
 }
    protected void b1_Click(object sender, EventArgs e)
    {
        Class1 X = new Class1();
        X.connect();
        string  vartxt= Textbox1.Text ;
        string Password;
          string q="select * from Studentmaster where Email='"+vartxt+"'";
        DataTable dt = X.display(q);
        if (dt.Rows.Count > 0)
        {
            Password = dt.Rows[0]["Password"].ToString();

            if (Send(SQLFix(vartxt), SQLFix("forget password "), SQLFix(Password)))
            {

                msg.Visible = true;

            }
            else
            {
                msg.Text= "Problem with Sending Email , Try after some time";
                msg.Visible = true;
            }

        }
        else
        {
            msg.Visible = true;
            msg.Text = "invalid email id";
        }
    }
    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;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text.Length == 0)
        {
            Label1.Visible = true;
            Label1.Text = "User Name Mandatory.";
        }
        Class1 class1 = new Class1();
        SqlConnection con = new SqlConnection(class1.conn);
        con.Open();
        SqlCommand com = new SqlCommand("insert into users values ('" + Convert.ToString(TextBox1.Text) + "', '" + Convert.ToString(TextBox2.Text) + "', '" + Convert.ToString(TextBox4.Text) + "', '" + Convert.ToString(TextBox3.Text) + "', '" + Convert.ToString(TextBox6.Text) + "')", con);
        try
        {
            int i = com.ExecuteNonQuery();
           if(i!=0) {
            Console.WriteLine("successful");
            Label2.Visible = true;
            Label2.Text = "Registration Successful!";
            con.Close();
           }
        }
        catch (Exception)
        {

            Label1.Visible = true;
            Label1.Text = "User Name already exists.";
            con.Close();
        }
    }
    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;
        }
    }
    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");
            }

        }
    }
Esempio n. 9
0
        public void Typing_Beginning_With_0_Should_Not_Modify_Text_When_Bound_To_Int()
        {
            using (UnitTestApplication.Start(Services))
            {
                var source = new Class1();
                var target = new TextBox
                {
                    DataContext = source,
                    Template = CreateTemplate(),
                };

                target.ApplyTemplate();
                target.Bind(TextBox.TextProperty, new Binding(nameof(Class1.Foo), BindingMode.TwoWay));

                Assert.Equal("0", target.Text);

                target.CaretIndex = 1;
                target.RaiseEvent(new TextInputEventArgs
                {
                    RoutedEvent = InputElement.TextInputEvent,
                    Text = "2",
                });

                Assert.Equal("02", target.Text);
            }
        }
Esempio n. 10
0
 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);
 }
    private void BindCheckBalance()
    {
        try
        {
            objBal = new Class1();
            objDataset = new DataSet();
            //int id = Convert.ToInt32(Session["UserID"]);
           // int id = Convert.ToInt32(Session["Role"]);
            objBal.id = 4;

            objBal.ScreenInd = Master123.GetCheckBalance;
            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;
        }
    }
    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);
    }
    protected void b1_Click(object sender, EventArgs e)
    {
        Class1 X = new Class1();
        X.connect();

        string at = "select max(id_feedback) from feedback ";
        int ff = X.autoincrement(at);

        string msg = "name is "+ t1.Text + "E-mail is" +t2.Text + "Phone-no is"+t3.Text + "Message is"+t4.Text;
        string w = "insert into feedback values('"+ff+"','"+t1.Text+"','"+t2.Text+"','"+t3.Text+"','"+t4.Text+"')";

        int n= X.allquery(w);

        if (Send(SQLFix("*****@*****.**"), SQLFix("FORGET PASSWORD "), SQLFix(msg)))
        {
            abcxyz.Text = "Your inquiry has been succesfully sent";
            abcxyz.Visible = true;

        }
        else
        {
            abcxyz.Text  = "Problem with Sending Email , Try after some time";
            abcxyz.Visible   = true;
        }
    }
    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)
        {

        }
    }
Esempio n. 15
0
        public void DataTemplate_Should_Match_Data_Of_Type()
        {
            var target = new DataTemplate { DataType = typeof(Class1) };
            var data = new Class1();

            Assert.True(target.Match(data));
        }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            btnCancel.Visible = false;
            btnUpdate.Visible = false;
            int id = Convert.ToInt32(lblid.Text);
            objBal = new Class1();
            objBal.ScreenInd = Master123.UpdatePromocode;
            objBal.Modifyby = Convert.ToInt32(Session["UserID"]);
            objBal.id = id;
            objBal.operatorName=ddlserviceName.SelectedItem.Text;
            objBal.promocode = txtpromocode.Text;
            objBal.Amount = txtAmount.Text;
            objBal.DaystoExpiry = txtDaystoexpire.Text;
            objBal.MinValue = txtminamt.Text;
            objBal.MaxValue = txtmaxamt.Text;

            if (objBal.fnUpdateRecord() == true)
            {
                ddlserviceName.ClearSelection();
                txtpromocode.Text = txtminamt.Text = txtmaxamt.Text = txtDaystoexpire.Text = txtAmount.Text = "";

            }

        }
        catch (Exception ex)
        {

        }
    }
    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
        {

        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String t1 = Convert.ToString(TextBox12.Text);
        String t2 = Convert.ToString(TextBox7.Text);
        String t3 = Convert.ToString(TextBox8.Text);
        String t4 = Convert.ToString(TextBox9.Text);
        String t5 = Convert.ToString(TextBox10.Text);
        String t6 = Convert.ToString(TextBox11.Text);

        int ib;
        try
        {
            Class1 class1 = new Class1();
            SqlConnection con1 = new SqlConnection(class1.conn);
            con1.Open();
            SqlCommand com2 = new SqlCommand("update screenshots set empname='" + t2 + "', designation='" + t3 + "', contact='" + t4 + "', email='" + t5 + "', project='" + t6 + "' where empid='" + t1 + "';", con1);
            ib = com2.ExecuteNonQuery();
            con1.Close();
            if (ib > 0)
            {
                Label3.Visible = true;
                Label3.Text = "Profile Updated!";
            }
        }
        catch(Exception)
        {
            Label3.Text = "Unable to update";
        }
    }
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        Class1 class1 = new Class1();
        SqlConnection con4 = new SqlConnection(class1.conn);
        con4.Open();
        SqlCommand com = new SqlCommand("insert into screenshots values ('" + Convert.ToString(TextBox1.Text) + "', '" + Convert.ToString(TextBox2.Text) + "', '" + Convert.ToString(TextBox3.Text) + "', '" + Convert.ToString(TextBox4.Text) + "', '" + Convert.ToString(TextBox5.Text) + "', '" + Convert.ToString(TextBox6.Text) + "')", con4);
        try
        {
            int i = com.ExecuteNonQuery();
            if (i != 0)
            {
                String folder1 = Convert.ToString(TextBox1.Text);
                String pathString = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, folder1);
                System.IO.Directory.CreateDirectory(pathString);
                Console.WriteLine("successful");
                Label2.Visible = true;
                Label2.Text = "Employee Added";
                con4.Close();

            }
        }
        catch (Exception)
        {

            Label2.Visible = true;
            Label2.Text = "Employee Id already exists.";
            con4.Close();
        }
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Class1 class1 = new Class1();
     SqlConnection con = new SqlConnection(class1.conn);
     con.Open();
     SqlCommand com = new SqlCommand("select uid, upwd, uname from users where uid='" + Convert.ToString(TextBox1.Text)+"'", con);
     SqlDataReader sdr;
     sdr = com.ExecuteReader();
     if (sdr.Read() != true)
     {
         Label1.Visible = true;
         Label1.Text = "User Name not found";
         con.Close();
     }
     else
     {
         if (sdr[1].ToString().CompareTo(Convert.ToString(TextBox2.Text)) != 0)
         {
             Label1.Visible = true;
             Label1.Text = "User Name and Password do not match";
             con.Close();
         }
         else
         {
             Session ["home"] = sdr[0].ToString();
             Response.Redirect("Home1.aspx");
             con.Close();
         }
     }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         HyperLink5.Visible = true;
         Class1 class1 = new Class1();
         SqlConnection con2 = new SqlConnection(class1.conn);
         con2.Open();
         SqlCommand com1 = new SqlCommand("select * from screenshots where empid='" + Convert.ToString(TextBox12.Text) + "'", con2);
         SqlDataReader sdr1;
         sdr1 = com1.ExecuteReader();
         sdr1.Read();
         if (sdr1.FieldCount > 0)
         {
             TextBox7.Text = sdr1[1].ToString();
             TextBox8.Text = sdr1[2].ToString();
             TextBox9.Text = sdr1[3].ToString();
             TextBox10.Text = sdr1[4].ToString();
             TextBox11.Text = sdr1[5].ToString();
             con2.Close();
         }
         else
         {
             HyperLink5.Visible = false;
             Label3.Visible = true;
             Label3.Text = "Employee not found";
         }
     }
     catch(Exception)
     {
         HyperLink5.Visible = false;
         Label3.Visible = true;
         Label3.Text = "Employee not found";
     }
 }
Esempio n. 22
0
 static void Main(string[] args)
 {
     Class1 main = new Class1();
     main.startEvent(main , EventArgs.Empty);
     main.process();
     main.endEvent(main , EventArgs.Empty);
 }
Esempio n. 23
0
    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='******'");
            if (ds.Tables[0].Rows.Count == 1)
            {
                HttpContext.Current.Session["username"] = uname;
                return "success";
            }
            else
            {
                return "fail";
            }
        }
        catch (Exception validate)
        {
            return "fail";

        }
    }
Esempio n. 24
0
        public void test1()
        {
            var class1 = new Class1();
            var duplicate = class1.Duplicate();

            AssertNotNull(duplicate);
        }
Esempio n. 25
0
        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
                {
                }

            }
        }
Esempio n. 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Class1 c = new Class1();
     ProductDataConsolidator obj = new ProductDataConsolidator();
     Gridview1.DataSource = ProductDataConsolidator.Get();
     Gridview1.DataBind();
 }
Esempio n. 27
0
        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()));
            }
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        objBal = new Class1();
        try
        {
            int id = Convert.ToInt32(Session["UserID"]);
            objBal = new Class1();
            objBal.Role= txtRole.Text;

            objBal.ScreenInd = Master123.InsertRole;
            objBal.Createdby= id;

            if (objBal.fnInsertRecord() == true)
            {
                lblmsg.Text = "You have Sucessfully Saved  Your Notices";
                BindRole();
                txtRole.Text = "";

            }
            else
            {
                lblmsg.Text = "You can not to be saved your details";
            }
        }
        catch (Exception ex)
        {

        }
    }
Esempio n. 29
0
        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);
        }
    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)
        {

        }
    }
 public Class2(Class1 class1, DataContext context)
 {
     _class1  = class1;
     _context = context;
 }
    protected void btncompare_Click(object sender, EventArgs e)
    {
        try
        {
            //Reading Bytes From Uploaded Images

            if (FileUpload1.HasFile && FileUpload2.HasFile)
            {
                using (BinaryReader reader1 = new BinaryReader(FileUpload1.PostedFile.InputStream))
                {
                    using (BinaryReader reader2 = new BinaryReader(FileUpload2.PostedFile.InputStream))
                    {
                        _barray1 = reader1.ReadBytes(FileUpload1.PostedFile.ContentLength);
                        _barray2 = reader2.ReadBytes(FileUpload2.PostedFile.ContentLength);
                    }
                }
            }
            //Converting Byte Array To Image And Then Into Bitmap
            ImageConverter ic   = new ImageConverter();
            Image          img  = (Image)ic.ConvertFrom(_barray1);
            Bitmap         bmp1 = new Bitmap(img);

            Image  img1 = (Image)ic.ConvertFrom(_barray2);
            Bitmap bmp2 = new Bitmap(img1);

            //Calling Compare Function

            if (Class1.Compare(bmp1, bmp2) == Class1.CompareResult.ciCompareOk)
            {
                Label1.Visible = true;
                Label1.Text    = "Images Are Same";
            }
            if (Class1.Compare(bmp1, bmp2) == Class1.CompareResult.ciPixelMismatch)
            {
                Label2.Visible = true;
                Label2.Text    = "Pixel not Matching";
            }
            if (Class1.Compare(bmp1, bmp2) == Class1.CompareResult.ciSizeMismatch)
            {
                Label3.Visible = true;
                Label3.Text    = "Size is not Same";
            }
            if (Class1.Compare(bmp1, bmp2) != Class1.CompareResult.ciCompareOk)
            {
                Label1.Visible = true;
                Label1.Text    = "images are not same";
            }

            if (Class1.Compare(bmp1, bmp2) != Class1.CompareResult.ciPixelMismatch)
            {
                Label2.Visible = true;
                Label2.Text    = "Pixel Matching";
            }
            if (Class1.Compare(bmp1, bmp2) != Class1.CompareResult.ciSizeMismatch)
            {
                Label3.Visible = true;
                Label3.Text    = "Size is Same";
            }
        }
        catch (Exception ex)
        {
            Label1.Visible = true;
            Label1.Text    = ex.Message.ToString();
        }
    }
Esempio n. 33
0
        private void NewHTMLhreper()
        {
          
            try
            {
                string url = "";
                this.Dispatcher.Invoke(new Action(() =>
                {
                    url = QiuZhuURL.Text;

                }));

                string ALLhtml = GetHTMLstr(url);
                using (var ctx = new oaEntities())
                {
                    DateTime DBtime = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString());
                    var QZQtime = ctx.T_QiuZhuQiuGou.Count();
                    if (QZQtime <= 0)
                    {

                    }
                    MaxTime =QZQtime<=0? new DateTime(2016, 12, 12): ctx.T_QiuZhuQiuGou.DefaultIfEmpty().Max(x => x.FBtime);
                    #region 开始读取网站列表信息
                    IHtmlDocument document = new JumonyParser().Parse(ALLhtml);
                    IEnumerable<IHtmlElement> result = document.Find(".tblist");
                    IEnumerable<IHtmlElement> t = result.Find("tr");
                    //Dictionary<string, string> dir = new Dictionary<string, string>();                  
                    foreach (var item in t)
                    {
                       
                        #region MyRegion
                        Class1 _class = new Class1();
             
                        _class.href = item.Exists(".t > a") ? item.FindFirst(".t>a").Attribute("href").Value() : string.Empty;
                        _class.TextName = MainWindow.GetN_value(item, ".t");

                      

                        _class.Quyu = MainWindow.GetN_value(item, ".c_58"); 
                        _class.PingMoney = MainWindow.GetN_value(item, ".pri");

                        _class.PersonName = MainWindow.GetN_value(item, ".jjrname-outer");
                        _class.Laiyuan = "58"; 
                        string  Timestr;
                        IEnumerable<IHtmlElement> adds = item.Find(".tc");
                        int abc_i = 0;
                        foreach (var abc in adds)
                        {
                            if (abc_i == 1)
                            {
                                _class.FwHuXing = abc.InnerText();
                            }
                            else if (abc_i == 2)
                            {
                                Timestr = abc.InnerText();
                            }
                            abc_i++;
                        }
                        #region 进入子页面
                        string html = GetHTMLstr(_class.href);
                        IHtmlDocument document_1 = new JumonyParser().Parse(html);
                        IEnumerable<IHtmlElement> result1 = document_1.Find(".user");
                        IEnumerable<IHtmlElement> restime = document_1.Find(".other");
                        foreach (var tm in restime)
                        {
                            var tttm = tm.InnerText();
                            _class.time = Convert.ToDateTime(tttm.Substring(tttm.IndexOf(":") + 1).Substring(0, tttm.Substring(tttm.IndexOf(":") + 1).IndexOf("浏览")).Trim());

                        }

                        if (QZQtime > 0)
                        {
                            var listc = ctx.T_QiuZhuQiuGou.Where(u => u.Hname == _class.TextName && u.FBtime==_class.time);
                            if (listc.Count() >= 1)
                            {
                                this.Dispatcher.Invoke(new Action(() =>
                                {
                                    LISTbox.Text = "重复信息退出更新等待下一次更新———" + _class.TextName + "———" + DateTime.Now.ToString();

                                }));
                                WhileBOOL1 = false;
                                return;
                            }

                        }
                        foreach (var ts in result1)
                        {
                            _class.PersonName = ts.FindLast(".tx").InnerText();
                            string strimage = ts.FindFirst(".phone").InnerText();
                            strimage = strimage.Substring(strimage.IndexOf("'")+1);
                            _class.Image_str = strimage.Substring(0, strimage.IndexOf("'"));
                            _class.bak = ts.FindFirst(".belong").InnerText();                           
                        }

                        #endregion

                        #endregion

                        #region 写入系统
                        T_QiuZhuQiuGou tqzq = new T_QiuZhuQiuGou();
                        tqzq.Hname = _class.TextName;
                        tqzq.QuYu = _class.Quyu;
                        tqzq.JuShi = _class.FwHuXing;
                        tqzq.Money = _class.PingMoney;
                        tqzq.FBtime = _class.time;
                        tqzq.Hperson = _class.PersonName;
                        tqzq.Photo = _class.Image_str;
                        tqzq.GuiShuDi = _class.bak;
                       
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            tqzq.CityID = Convert.ToInt32(QiuZhuCombx1.SelectedValue);

                        }));

                        ctx.T_QiuZhuQiuGou.Add(tqzq);
                        #endregion
                      //  L_Class.Add(_class);
                        r++;
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            SUMcount.Text = r.ToString();

                        }));
                        ctx.SaveChanges();
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            LISTbox.Text = "更新一条数据————"+ _class.TextName+ "———" + DateTime.Now.ToString();

                        }));
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                this.Dispatcher.Invoke(new Action(() =>
                {
                    LISTbox.Text = DateTime.Now.ToString() + ex.ToString();

                }));

            }
            WhileBOOL1 = false;
        }
Esempio n. 34
0
 // overlap of Decrypt
 public static string Decrypt1(string data, byte[] key, ref byte[] iv)
 {
     return(Encoding.UTF8.GetString(
                Class1.Decrypt(Convert.FromBase64String(data), key, iv)));
 }
Esempio n. 35
0
 // overlap of Encrypt
 public static string Encrypt1(string data, byte[] key, ref byte[] iv)
 {
     return(Convert.ToBase64String(
                Class1.Encrypt(Encoding.UTF8.GetBytes(data), key, ref iv)));
 }
Esempio n. 36
0
 public void Init()
 {
     myClassUnderTest = new Class1();
 }
Esempio n. 37
0
        public void TKSYSPRUSED(string SYSTEMNAME, string PROGRAMCODE, string PROGRAMNAME, string USEDID, string USEDIP)
        {
            SqlConnection  sqlConn = new SqlConnection();
            SqlTransaction tran;
            SqlCommand     cmd = new SqlCommand();
            int            result;
            StringBuilder  sbSql = new StringBuilder();


            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);


            sqlConn.Close();
            sqlConn.Open();
            tran = sqlConn.BeginTransaction();

            sbSql.Clear();



            sbSql.AppendFormat(@" 
                                INSERT INTO [TKIT].[dbo].[TKSYSPRUSED]
                                ([SYSTEMNAME],[PROGRAMCODE],[PROGRAMNAME],[USEDDATES],[USEDID],[USEDIP])
                                VALUES
                                (@SYSTEMNAME,@PROGRAMCODE,@PROGRAMNAME,@USEDDATES,@USEDID,@USEDIP)
                                ");


            using (SqlConnection connection = new SqlConnection(sqlsb.ConnectionString))
            {
                SqlCommand command = new SqlCommand(sbSql.ToString(), connection);
                command.Parameters.AddWithValue("@SYSTEMNAME", SYSTEMNAME);
                command.Parameters.AddWithValue("@PROGRAMCODE", PROGRAMCODE);
                command.Parameters.AddWithValue("@PROGRAMNAME", PROGRAMNAME);
                command.Parameters.AddWithValue("@USEDDATES", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                command.Parameters.AddWithValue("@USEDID", USEDID);
                command.Parameters.AddWithValue("@USEDIP", USEDIP);

                try
                {
                    connection.Open();
                    Int32 rowsAffected = command.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                finally
                {
                    sqlConn.Close();
                }
            }
        }
Esempio n. 38
0
        private void CJTXNewHTMLhreper()
        {
            
            try
            {
                string url = "";
                this.Dispatcher.Invoke(new Action(() =>
                {
                    url = FTXtexturl.Text;

                }));
                string ALLhtml = BXGetHTMLstr(url);
                using (var ctx = new oaEntities())
                {
                    //获取当前时间
                    DateTime DBtime = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString());
                    var QZQtime = ctx.T_ChuZhuInfo.Count();
                    if (QZQtime <= 0)
                    {

                    }
                    MaxTime = QZQtime <= 0 ? new DateTime(2016, 12, 12) : Convert.ToDateTime(ctx.T_ChuZhuInfo.DefaultIfEmpty().Max(x => x.FbTime));

                    #region 开始读取网站列表信息
                    IHtmlDocument document = new JumonyParser().Parse(ALLhtml);
                    IEnumerable<IHtmlElement> result = document.Find(".hpic");

                    foreach (var item in result)
                    {

                        #region MyRegion
                        Class1 _class = new Class1();

                        _class.href = item.Exists(".pic_box") ? item.FindFirst(".pic_box").Attribute("href").Value() : string.Empty;
                        _class.TextName = item.Exists(".pic_box") ? item.FindFirst(".pic_box").Attribute("title").Value() : string.Empty;
                        

                        if (QZQtime > 0)
                        {
                            var listc = ctx.T_ChuZhuInfo.Where(u => u.ChuZhuName == _class.TextName && u.ChuZhuHref == _class.href);
                            if (listc.Count() >= 1)
                            {
                                this.Dispatcher.Invoke(new Action(() =>
                                {
                                    ltextd.Text = "重复信息退出更新等待下一次更新———" + _class.TextName + "———" + DateTime.Now.ToString();

                                }));
                                CJTXWhileBOOL1 = false;
                                return;
                            }

                        }

                        _class.Address = MainWindow.GetN_value(item, ".addr");
                        _class.SumMoney = MainWindow.GetN_value(item, ".pr");
                        _class.Laiyuan = "cjfl";

                        #region 进入子页面
                        string html = GetHTMLstr(_class.href);
                        IHtmlDocument document_1 = new JumonyParser().Parse(html);
                        IEnumerable<IHtmlElement> result1 = document_1.Find(".viewad_box>.viewad-meta > li");
                        IEnumerable<IHtmlElement> result2 = document_1.Find(".view_box>p");
                        IEnumerable<IHtmlElement> result3 = document_1.Find(".viewad-actions");
                        IEnumerable<IHtmlElement> image = document_1.Find(".container>.pic_box");

                        int i = 0;
                        foreach (var tm in result1)
                        {
                            if (i == 2)
                            {
                                _class.Mianji = MainWindow.GetN_value(tm, "span");
                            }
                            if (i == 4)
                            {
                                _class.PersonName = MainWindow.GetN_value(tm, "span");
                            }
                            if (i == 5)
                            {
                                _class.photo = MainWindow.GetN_value(tm, "span");
                            }
                            i++;

                        }
                        i = 0;
                        foreach (var ts in result2)
                        {
                            if (i == 1)
                            { _class.bak = ts.InnerHtml(); }
                            i++;

                        }
                        string imagerui = "";
                        foreach (var tm in image)
                        {
                            imagerui = imagerui + "---" + tm.FindFirst("img ").Attribute("src").Value();

                        }
                        _class.Image_str = imagerui;
                        foreach (var ts in result3)
                        {
                            _class.FbTime = Convert.ToDateTime(ts.FindFirst("span").InnerHtml());

                        }

                        #endregion

                        #endregion

                        #region 写入系统

                        if (item.Exists("a"))
                        {
                            T_ChuZhuInfo tqzq = new T_ChuZhuInfo();
                            tqzq.ChuZhuName = _class.TextName;
                            tqzq.Addess = _class.Address;
                            tqzq.Money = Convert.ToDecimal(_class.SumMoney);
                            tqzq.LaiYuan = _class.Laiyuan;
                            tqzq.Images = _class.Image_str;
                            tqzq.FbTime = _class.FbTime;
                            tqzq.PingMi = Convert.ToDecimal(_class.Mianji.Replace("㎡", ""));
                            tqzq.LianXiPerson = _class.PersonName;
                            tqzq.LianXiPhoto = _class.photo;
                            tqzq.Bak = _class.bak;
                            tqzq.ChuZhuHref = _class.href;

                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                tqzq.CityID = Convert.ToInt32(ftxCombx.SelectedValue);

                            }));
                            ctx.T_ChuZhuInfo.Add(tqzq);
                            //  L_Class.Add(_class);
                            r++;
                            this.Dispatcher.Invoke(new Action(() =>
                            {
                                ADDC.Text = r.ToString();

                            }));
                            ctx.SaveChanges();
                        }

                        #endregion

                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            ltextd.Text = "更新一条数据————" + _class.TextName + "———" + DateTime.Now.ToString();

                        }));
                    }
                    #endregion
                }

            }
            catch (Exception ex)
            {
                this.Dispatcher.Invoke(new Action(() =>
                {
                    ltextd.Text = DateTime.Now.ToString() + ex.ToString();

                }));

            }
            WhileBOOL1 = false;
        }
Esempio n. 39
0
        public static async Task RunAsync(TestHelper helper)
        {
            Communicator communicator = helper.Communicator;
            var          prx          = IInterface2Prx.Parse(helper.GetTestProxy("test", 0), communicator);

            Console.Out.Write("testing marshaling of parameters with aliases... ");
            Console.Out.Flush();
            {
                {
                    var(p1, p2, p3) = prx.OpBool(true, false, null);
                    TestHelper.Assert(p1 == true);
                    TestHelper.Assert(p2 == false);
                    TestHelper.Assert(p3 == null);
                }
                {
                    var(p1, p2, p3) = prx.OpByte(1, byte.MinValue, byte.MaxValue);
                    TestHelper.Assert(p1 == 1);
                    TestHelper.Assert(p2 == byte.MinValue);
                    TestHelper.Assert(p3 == byte.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpShort(2, short.MinValue, short.MaxValue);
                    TestHelper.Assert(p1 == 2);
                    TestHelper.Assert(p2 == short.MinValue);
                    TestHelper.Assert(p3 == short.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpUshort(3, ushort.MinValue, ushort.MaxValue);
                    TestHelper.Assert(p1 == 3);
                    TestHelper.Assert(p2 == ushort.MinValue);
                    TestHelper.Assert(p3 == ushort.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpInt(4, int.MinValue, int.MaxValue);
                    TestHelper.Assert(p1 == 4);
                    TestHelper.Assert(p2 == int.MinValue);
                    TestHelper.Assert(p3 == int.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpUint(5, uint.MinValue, uint.MaxValue);
                    TestHelper.Assert(p1 == 5);
                    TestHelper.Assert(p2 == uint.MinValue);
                    TestHelper.Assert(p3 == uint.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpVarint(6, int.MinValue, int.MaxValue);
                    TestHelper.Assert(p1 == 6);
                    TestHelper.Assert(p2 == int.MinValue);
                    TestHelper.Assert(p3 == int.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpVaruint(7, uint.MinValue, uint.MaxValue);
                    TestHelper.Assert(p1 == 7);
                    TestHelper.Assert(p2 == uint.MinValue);
                    TestHelper.Assert(p3 == uint.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpLong(8L, long.MinValue, long.MaxValue);
                    TestHelper.Assert(p1 == 8L);
                    TestHelper.Assert(p2 == long.MinValue);
                    TestHelper.Assert(p3 == long.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpUlong(9L, ulong.MinValue, ulong.MaxValue);
                    TestHelper.Assert(p1 == 9L);
                    TestHelper.Assert(p2 == ulong.MinValue);
                    TestHelper.Assert(p3 == ulong.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpVarlong(10L, -11L, null);
                    TestHelper.Assert(p1 == 10L);
                    TestHelper.Assert(p2 == -11L);
                    TestHelper.Assert(p3 == null);
                }
                {
                    var(p1, p2, p3) = prx.OpVarulong(12L, 13L, null);
                    TestHelper.Assert(p1 == 12L);
                    TestHelper.Assert(p2 == 13L);
                    TestHelper.Assert(p3 == null);
                }
                {
                    var(p1, p2, p3) = prx.OpFloat(1.0F, float.MinValue, float.MaxValue);
                    TestHelper.Assert(p1 == 1.0F);
                    TestHelper.Assert(p2 == float.MinValue);
                    TestHelper.Assert(p3 == float.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpDouble(2.0, double.MinValue, double.MaxValue);
                    TestHelper.Assert(p1 == 2.0);
                    TestHelper.Assert(p2 == double.MinValue);
                    TestHelper.Assert(p3 == double.MaxValue);
                }
                {
                    var(p1, p2, p3) = prx.OpString("", "hello", "there");
                    TestHelper.Assert(p1.Length == 0);
                    TestHelper.Assert(p2.Equals("hello"));
                    TestHelper.Assert(p3 !.Equals("there"));
                }
                {
                    var s1 = new Struct1(-1, "foo");
                    var s2 = new Struct1(79, "bar");
                    var(p1, p2, p3) = prx.OpStruct1(s1, s2, null);
                    TestHelper.Assert(p1.I == -1);
                    TestHelper.Assert(p1.S !.Equals("foo"));
                    TestHelper.Assert(p2.I == 79);
                    TestHelper.Assert(p2.S !.Equals("bar"));
                    TestHelper.Assert(p3 == null);
                }
                {
                    var c1 = new Class1(-1, "foo");
                    var c2 = new Class1(79, "bar");
                    var(p1, p2, p3) = prx.OpClass1(c1, c2, null);
                    TestHelper.Assert(p1.I == -1);
                    TestHelper.Assert(p1.S !.Equals("foo"));
                    TestHelper.Assert(p2.I == 79);
                    TestHelper.Assert(p2.S !.Equals("bar"));
                    TestHelper.Assert(p3 == null);
                }
                {
                    var(p1, p2, p3) = prx.OpEnum1(Enum1.Thing1, Enum1.Thing2, null);
                    TestHelper.Assert(p1 == Enum1.Thing1);
                    TestHelper.Assert(p2 == Enum1.Thing2);
                    TestHelper.Assert(p3 == null);
                }
                {
                    string[] ss1 = { "abc", "de", "fghi" };
                    string[] ss2 = { "hello", "world" };
                    string[] ss3 = { "1", "22", "" };

                    var(p1, p2, p3, p4) = prx.OpStringSeq(ss1, ss2, ss3, null);
                    TestHelper.Assert(p1.Length == 3);
                    TestHelper.Assert(p1[0].Equals("abc"));
                    TestHelper.Assert(p1[1].Equals("de"));
                    TestHelper.Assert(p1[2].Equals("fghi"));
                    TestHelper.Assert(p2.Length == 2);
                    TestHelper.Assert(p2[0].Equals("hello"));
                    TestHelper.Assert(p2[1].Equals("world"));
                    TestHelper.Assert(p3.Length == 3);
                    TestHelper.Assert(p3[0].Equals("1"));
                    TestHelper.Assert(p3[1].Equals("22"));
                    TestHelper.Assert(p3[2].Length == 0);
                    TestHelper.Assert(p4 == null);
                }
                {
                    var sid1 = new Dictionary <string, int>
                    {
                        ["a"] = 1,
                        ["b"] = 2,
                        ["c"] = 3
                    };
                    var sid2 = new Dictionary <string, int>
                    {
                        ["hello"] = 5,
                        ["world"] = 50
                    };
                    var sid3 = new Dictionary <string, int>
                    {
                        [""]    = 0,
                        ["foo"] = 3
                    };

                    var(p1, p2, p3, p4) = prx.OpStringIntDict(sid1, sid2, sid3, null);
                    TestHelper.Assert(p1.DictionaryEqual(sid1));
                    TestHelper.Assert(p2.DictionaryEqual(sid2));
                    TestHelper.Assert(p3.DictionaryEqual(sid3));
                    TestHelper.Assert(p4 == null);
                }
            }
            Console.Out.WriteLine("ok");

            Type C2 = typeof(Class2);

            Console.Out.Write("testing mapping of builtin type aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(C2.GetField("BoolAMember") !.FieldType == typeof(bool));
                TestHelper.Assert(C2.GetField("ByteAMember") !.FieldType == typeof(byte));
                TestHelper.Assert(C2.GetField("ShortAMember") !.FieldType == typeof(short));
                TestHelper.Assert(C2.GetField("UshortAMember") !.FieldType == typeof(ushort));
                TestHelper.Assert(C2.GetField("IntAMember") !.FieldType == typeof(int));
                TestHelper.Assert(C2.GetField("UintAMember") !.FieldType == typeof(uint));
                TestHelper.Assert(C2.GetField("VarintAMember") !.FieldType == typeof(int));
                TestHelper.Assert(C2.GetField("VaruintAMember") !.FieldType == typeof(uint));
                TestHelper.Assert(C2.GetField("LongAMember") !.FieldType == typeof(long));
                TestHelper.Assert(C2.GetField("UlongAMember") !.FieldType == typeof(ulong));
                TestHelper.Assert(C2.GetField("VarlongAMember") !.FieldType == typeof(long));
                TestHelper.Assert(C2.GetField("VarulongAMember") !.FieldType == typeof(ulong));
                TestHelper.Assert(C2.GetField("FloatAMember") !.FieldType == typeof(float));
                TestHelper.Assert(C2.GetField("DoubleAMember") !.FieldType == typeof(double));
                TestHelper.Assert(C2.GetField("StringAMember") !.FieldType == typeof(string));
                TestHelper.Assert(C2.GetField("Struct1AMember") !.FieldType == typeof(Struct1));
                TestHelper.Assert(C2.GetField("Class1AMember") !.FieldType == typeof(Class1));
                TestHelper.Assert(C2.GetField("Interface1AMember") !.FieldType == typeof(IInterface1Prx));
                TestHelper.Assert(C2.GetField("Enum1AMember") !.FieldType == typeof(Enum1));
            }
            Console.Out.WriteLine("ok");

            Console.Out.Write("testing mapping of sequence type aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(C2.GetField("StringASeqMember") !.FieldType == typeof(string[]));
                TestHelper.Assert(C2.GetField("OptLongASeqMember") !.FieldType == typeof(long?[]));
                TestHelper.Assert(C2.GetField("StructASeqMember") !.FieldType == typeof(Struct1[]));
                TestHelper.Assert(C2.GetField("InterfaceASeqMember") !.FieldType == typeof(IInterface1Prx[]));
                TestHelper.Assert(C2.GetField("StringSeqAMember") !.FieldType == typeof(string[]));
                TestHelper.Assert(C2.GetField("OptLongSeqAMember") !.FieldType == typeof(long?[]));
                TestHelper.Assert(C2.GetField("StructSeqAMember") !.FieldType == typeof(Struct1[]));
                TestHelper.Assert(C2.GetField("InterfaceSeqAMember") !.FieldType == typeof(IInterface1Prx[]));
            }
            Console.Out.WriteLine("ok");

            Console.Out.Write("testing mapping of dictionary type aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(C2.GetField("StringAIntADictMember") !.FieldType == typeof(Dictionary <string, int>));
                TestHelper.Assert(C2.GetField("BoolAOptLongADictMember") !.FieldType == typeof(Dictionary <bool, long?>));
                TestHelper.Assert(C2.GetField("UshortAOptInterfaceADictMember") !.FieldType == typeof(Dictionary <ushort, IInterface1Prx?>));
                TestHelper.Assert(C2.GetField("EnumAVarlongADictMember") !.FieldType == typeof(Dictionary <Enum1, long>));
                TestHelper.Assert(C2.GetField("StringIntDictAMember") !.FieldType == typeof(Dictionary <string, int>));
                TestHelper.Assert(C2.GetField("BoolOptLongDictAMember") !.FieldType == typeof(Dictionary <bool, long?>));
                TestHelper.Assert(C2.GetField("UshortOptInterfaceDictAMember") !.FieldType == typeof(Dictionary <ushort, IInterface1Prx?>));
                TestHelper.Assert(C2.GetField("EnumVarlongDictAMember") !.FieldType == typeof(Dictionary <Enum1, long>));
            }
            Console.Out.WriteLine("ok");

            // TODO uncomment after anonymous sequences.
            // Console.Out.Write("testing aliases with metadata... ");
            // Console.Out.Flush();
            // {
            //     TestHelper.Assert(C2.GetField("StringListAMember")!.FieldType == typeof(List<string>));
            //     TestHelper.Assert(C2.GetField("StringQueueAMember")!.FieldType == typeof(Queue<string>));
            //     TestHelper.Assert(C2.GetField("StringStackAMember")!.FieldType == typeof(Stack<string>));
            //     TestHelper.Assert(C2.GetField("StringListA2Member")!.FieldType == typeof(List<string>));
            //     TestHelper.Assert(C2.GetField("StringLinkedListOverrideAMember")!.FieldType == typeof(LinkedList<string>));
            //     TestHelper.Assert(C2.GetField("StringStackOverrideMember")!.FieldType == typeof(Stack<string>));
            // }
            // Console.Out.WriteLine("ok");

            Console.Out.Write("testing mapping of optional type aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(C2.GetField("OptBoolAMember") !.FieldType == typeof(bool?));
                TestHelper.Assert(C2.GetField("OptUshortAMember") !.FieldType == typeof(ushort?));
                // TODO uncomment after anonymous sequences.
                // TestHelper.Assert(C2.GetField("TaggedStringStackAMember")!.FieldType == typeof(Stack<string?>));

                FieldInfo OptStringAMemberField = C2.GetField("OptStringAMember") !;
                TestHelper.Assert(OptStringAMemberField.FieldType == typeof(string));
                TestHelper.Assert(HasNullableContextAttribute(OptStringAMemberField));

                FieldInfo OptClass1AMemberField = C2.GetField("OptClass1AMember") !;
                TestHelper.Assert(OptClass1AMemberField.FieldType == typeof(Class1));
                TestHelper.Assert(HasNullableContextAttribute(OptClass1AMemberField));

                FieldInfo TaggedInterface1AMemberField = C2.GetField("TaggedInterface1AMember") !;
                TestHelper.Assert(TaggedInterface1AMemberField.FieldType == typeof(IInterface1Prx));
                TestHelper.Assert(HasNullableContextAttribute(TaggedInterface1AMemberField));

                FieldInfo TaggedStructSeqAMemberField = C2.GetField("TaggedStructSeqAMember") !;
                TestHelper.Assert(TaggedStructSeqAMemberField.FieldType == typeof(Struct1[]));
                TestHelper.Assert(HasNullableContextAttribute(TaggedStructSeqAMemberField));

                FieldInfo TaggedEnumAVarlongADictMemberField = C2.GetField("TaggedEnumAVarlongADictMember") !;
                TestHelper.Assert(TaggedEnumAVarlongADictMemberField.FieldType == typeof(Dictionary <Enum1, long>));
                TestHelper.Assert(HasNullableContextAttribute(TaggedEnumAVarlongADictMemberField));
            }
            Console.Out.WriteLine("ok");

            Console.Out.Write("testing inheritance from aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(typeof(Class1).BaseType == typeof(AnyClass));
                TestHelper.Assert(typeof(Class2).BaseType == typeof(Class1));

                Type[] interface1Bases = typeof(IInterface1).GetInterfaces();
                TestHelper.Assert(interface1Bases.Length == 1);
                TestHelper.Assert(interface1Bases[0] == typeof(IObject));

                Type[] interface1AsyncBases = typeof(IAsyncInterface1).GetInterfaces();
                TestHelper.Assert(interface1AsyncBases.Length == 1);
                TestHelper.Assert(interface1AsyncBases[0] == typeof(IObject));

                Type[] interface1PrxBases = typeof(IInterface1Prx).GetInterfaces();
                TestHelper.Assert(interface1PrxBases.Length == 2);
                TestHelper.Assert(interface1PrxBases[0] == typeof(IObjectPrx));
                TestHelper.Assert(interface1PrxBases[1] == typeof(IEquatable <IObjectPrx>));

                Type[] interface2Bases = typeof(IInterface2).GetInterfaces();
                TestHelper.Assert(interface2Bases.Length == 2);
                TestHelper.Assert(interface2Bases[0] == typeof(IInterface1));
                TestHelper.Assert(interface2Bases[1] == typeof(IObject));

                Type[] interface2AsyncBases = typeof(IAsyncInterface2).GetInterfaces();
                TestHelper.Assert(interface2AsyncBases.Length == 2);
                TestHelper.Assert(interface2AsyncBases[0] == typeof(IAsyncInterface1));
                TestHelper.Assert(interface2AsyncBases[1] == typeof(IObject));

                Type[] interface2PrxBases = typeof(IInterface2Prx).GetInterfaces();
                TestHelper.Assert(interface2PrxBases.Length == 3);
                TestHelper.Assert(interface2PrxBases[0] == typeof(IInterface1Prx));
                TestHelper.Assert(interface2PrxBases[1] == typeof(IObjectPrx));
                TestHelper.Assert(interface2PrxBases[2] == typeof(IEquatable <IObjectPrx>));

                TestHelper.Assert(Enum.GetUnderlyingType(typeof(Enum1)) == typeof(int));
                TestHelper.Assert(Enum.GetUnderlyingType(typeof(Enum2)) == typeof(int));
            }
            Console.Out.WriteLine("ok");

            Console.Out.Write("testing constants with aliases... ");
            Console.Out.Flush();
            {
                TestHelper.Assert(Constants.const1.GetType() == typeof(int));
                TestHelper.Assert(Constants.const1 == 79);
            }
            Console.Out.WriteLine("ok");

            await prx.ShutdownAsync();
        }
    static void Main(string[] args)
    {
        Class1 c = new Class1();

        c.FindString("EXISTS");
    }
Esempio n. 41
0
        public void AddTest()
        {
            Class1 cls = new Class1();

            Assert.AreEqual(cls.Add(2, 3), 5);
        }
Esempio n. 42
0
        public void SubTest()
        {
            Class1 cls = new Class1();

            Assert.AreEqual(expected: cls.Sub(3, 7), actual: -4);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Class1 c = new Class1();


            string pass1 = "";
            string pass2 = "";
            string str   = Session["user"].ToString();

            if (Equals(str.Substring(0, 1), "d") == true)
            {
                c.cmd.CommandText = "Select * from Doctor1 where DoctorID='" + str + "' and pswd='" + TextBox2.Text + "'";
                c.ds.Clear();
                c.adp.Fill(c.ds, "vt");
                if (c.ds.Tables["vt"].Rows.Count == 0)
                {
                    Label5.Text = "Old Password Incorrect. Try Again!";
                }
                else
                {
                    //Session["user"] = loginTextBox.Text;
                    //Response.Redirect("WelcomeDoctor.aspx");
                    pass1 = TextBox3.Text.Trim();
                    pass2 = TextBox4.Text.Trim();
                    if (Equals(pass1, pass2) == true)
                    {
                        c.dr              = c.ds.Tables["vt"].Rows[0];
                        c.dr["pswd"]      = TextBox3.Text.Trim();
                        c.scb.DataAdapter = c.adp;
                        c.adp.Update(c.ds.Tables["vt"]);
                        Label5.Text = "Password Updated Successfully";
                    }
                    else
                    {
                        Label5.Text = "Passwords do not match";
                    }
                }
                //c.ds.Clear();
                //c.adp.Fill(c.ds, "vt");
            }
            else if (Equals(str.Substring(0, 1), "p") == true)
            {
                c.cmd.CommandText = "Select * from Patient1 where PatientID='" + str + "' and pswd='" + TextBox2.Text + "'";
                c.ds.Clear();
                c.adp.Fill(c.ds, "vt");
                if (c.ds.Tables["vt"].Rows.Count == 0)
                {
                    Label5.Text = "Old Password Incorrect. Try Again!";
                }
                else
                {
                    //Response.Redirect("WelcomeDoctor.aspx");
                    pass1 = TextBox3.Text.Trim();
                    pass2 = TextBox4.Text.Trim();
                    if (Equals(pass1, pass2) == true)
                    {
                        c.dr              = c.ds.Tables["vt"].Rows[0];
                        c.dr["pswd"]      = TextBox3.Text.Trim();
                        c.scb.DataAdapter = c.adp;
                        c.adp.Update(c.ds.Tables["vt"]);
                        Label5.Text = "Password Updated Successfully";
                    }
                    else
                    {
                        Label5.Text = "Passwords do not match";
                    }
                }
            }
            else if (Equals(str.Substring(0, 1), "e") == true)
            {
                c.cmd.CommandText = "Select * from Persons where EmployeeID='" + str + "' and pswd='" + TextBox2.Text + "'";
                c.ds.Clear();
                c.adp.Fill(c.ds, "vt");
                if (c.ds.Tables["vt"].Rows.Count == 0)
                {
                    Label5.Text = "Old Password Incorrect! Try again";
                }
                else
                {
                    //Response.Redirect("WelcomeDoctor.aspx");
                    pass1 = TextBox3.Text.Trim();
                    pass2 = TextBox4.Text.Trim();
                    if (Equals(pass1, pass2) == true)
                    {
                        c.dr              = c.ds.Tables["vt"].Rows[0];
                        c.dr["pswd"]      = TextBox3.Text.Trim();
                        c.scb.DataAdapter = c.adp;
                        c.adp.Update(c.ds.Tables["vt"]);
                        Label5.Text = "Password Updated Successfully";
                    }
                    else
                    {
                        Label5.Text = "Passwords do not match";
                    }
                }
            }
            else
            {
                Label5.Text = "Invalid Userid";
            }
        }
Esempio n. 44
0
        static void Main(string[] args)
        {
            string msg = string.Empty;

            if (args.Length > 0)
            {
                msg = String.Join(" ", args);
                Console.WriteLine(msg);

            }


            tc = new Microsoft.ApplicationInsights.TelemetryClient();
            tc.InstrumentationKey = " -b03d-431b-a82d-f3ab8b9c929d";// 
                                                                           // Set session data:
            tc.Context.User.Id = Environment.UserName;
            tc.Context.Session.Id = Guid.NewGuid().ToString();
            tc.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
            tc.Context.Location.Ip = Class1.GetLocalIPAddress();

            string input = string.Empty;
            Console.WriteLine("Enter one or more lines of text (press CTRL+Z to exit):");
            Console.WriteLine();
            do
            {
                //Console.Write("   ");
                input = Console.ReadLine();
                
                if (input != null)
                {
                    //input = input.Trim();
                    
                    if (String.IsNullOrWhiteSpace(input))
                    {
                        ;//continue;
                    }

                    Console.WriteLine("\tData read was " + input);
                }


                //Console.SetIn(new StreamReader(Console.OpenStandardInput(8192))); // This will allow input >256 chars

                //while (Console.In.Peek() != -1)
                //while (true)
                //{
                //    input = Console.In.ReadLine();
                //    Console.WriteLine("\tData read was " + input);
                //    if (0 == string.Compare(input, "quit", true))
                //        break;
                //}
                {

                // Log a page view:
                tc.TrackPageView("Form1");

            Dictionary<string, string> li = new Dictionary<string, string>();
            li.Add("LEVEL", "ERROR");

            string temp = (args.Length > 0) ? args[0] : "";
            string right = string.Format("{0}-{1}", "tbd.exe", msg);
            li.Add("NAME", right);

            temp = (args.Length > 1) ? args[1] : "n/a";
            right = string.Format("{0}", input);
            li.Add("TEXT", right);

            //tc.TrackEvent("hithere", null);
            tc.TrackEvent("log", li);

            //.TelemetryClient();
            Console.WriteLine("\tDid it go.(" + input + ")");

            }   // end of read input

            } while (input != null); // end of input do!
            OnClosing();

        }
Esempio n. 45
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public List <CenarioArquivo> RetornaListaArquivos()
        {
            var db = new Class1(true);

            return(db.CenarioArquivos.ToList());
        }
Esempio n. 46
0
    public void SetTextDataTable()
    {
        Random rx = new Random();

        Label4.Text = rx.Next(1000, 100000).ToString();


        int i = Convert.ToInt32(Application["activeuser"]);

        try
        {
            code_post = Page.Request.QueryString["page"].ToString();

            View_barg.type_post = Page.Request.QueryString["type"].ToString();


            key_url = Page.Request.Url.ToString();


            if (code_post == Page.Request.QueryString["page"].ToString())
            {
                Class1.status_createTagLinkPost = false;
                Class1.url_Address = key_url;
            }

            else if (code_post != Page.Request.QueryString["page"].ToString())
            {
                Class1.status_createTagLinkPost = true;
                Class1.url_Address = Page.Request.Url.ToString();
            }

            else
            {
                Class1.url_Address = Page.Request.Url.ToString();
            }
        }
        catch
        {
            Response.Redirect("Default.aspx");
        }



        string str3 = "";

        str3 = ConfigurationManager.ConnectionStrings["cn1"].ConnectionString;

        SqlConnection con = new SqlConnection(str3);
        SqlCommand    cmd = new SqlCommand("StoredProcedure1_View_mataleb", con);
        SqlDataReader r;

        // Configure command and add parameters.
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter param;

        param       = cmd.Parameters.Add("@code_post", SqlDbType.BigInt);
        param.Value = code_post;


//cmd.Parameters.Add("@code_post", SqlDbType.Int);
//cmd.Parameters("@code_post").Value = code_post;

        string g1 = "#";

        g1 = param.Value.ToString();

        // cmd.Parameters.Add(param);

        //      object fr = cmd.ExecuteScalar();

        //   Response.Write(fr.ToString());
        //Response.Write(g1);



        // تشخیص اینکه کد مطلب در آدرس بار فقط عدد باشد زیرا فیلد از نوع عددی است
        // اگر غیر عدد باشد خطا است.

        if (Class1.IsNumeric2(g1) == false)
        {
            Response.Redirect(Class1.urlAddress);
        }



        // Execute the command.
        con.Open();
        r = cmd.ExecuteReader();



        if (r.HasRows)
        { // اگر این کد وجود دارد
            while (r.Read())
            {
                Page.Title = r["title"].ToString();

                HyperLink31.Text = r["title"].ToString();


                //   Image1.ImageUrl = r["img_address"].ToString(); ;

                bodyLabel.Text = r["body"].ToString();
                // typeLabel.Text = r["type"].ToString();
                //  lenght.Text = r["lenght"].ToString();

                int v1 = 0;


                if (r["View_Count"].ToString() != "")
                {
                    v1 = int.Parse(r["View_Count"].ToString());
                }

                v1 = v1 + 1;

                //     c1.CmdSqlDataBaesAccess("update demah.send_softwear set View_Count= '" + v1 + "' where code_post='" + code_post + "' ");

                //  View_CountLabel.Text = r["View_Count"].ToString();

                //   HyperLink13.NavigateUrl = r["soft_address"].ToString();

                dateLabel.Text = r["DateSend"].ToString();

                //   subject_post.Text = r["subject_post"].ToString();
                //  if (Class1.status_createTagLinkPost == true)
                // {

                Class1.url_Address = Page.Request.Url.ToString();
                // }
                //ایجاد کلمه کلیدی----------------------------------------
                //     Class1.status_createTagLinkPost = true;
                keyWords = "";//جلوگیری از تکرار چاپ کلمات کلیدی
                //     Class1.url_Address = Page.Request.Url.ToString();
                // Create_KeyWord("",'');
                keyWords = Create_KeyWord(r["seo"].ToString(), ',');
                //     keyWords +=  ",";
                keyWords      += Create_KeyWord(r["title"].ToString(), '-');
                seo_Label.Text = keyWords;

//Class1.url_Address="";

//                keyWords =" ";
                //---------------------------------------------------------
                Class1.status_createTagLinkPost = true;



                if (div1.Visible == true)
                {
                    TextBox1_Title.Text = r["title"].ToString();


                    //  Image2.ImageUrl = r["img_address"].ToString();

                    FCKeditor1.Value = r["body"].ToString();
                    //   TextBox1_type.Text = r["type"].ToString();

                    DropDownList1.SelectedValue = r["type_Post"].ToString();


                    //  TextBox1_lengh.Text = r["lenght"].ToString();

                    // int v1 = int.Parse(r["View_Count"].ToString());
                    // v1 = v1 + 1;


                    //  TextBox1_AddressFile_link.Text = r["soft_address"].ToString();

                    TextBox1_DateSend.Text = r["DateSend"].ToString();

                    TextBox1_SubjectPost.Text = r["type_post"].ToString();
                    TextBox1_Seo.Text         = r["seo"].ToString();

                    //TextBox1_SourceOrCompany.Text = r["source_company"].ToString();

                    //  TextBox1_AddressIMG.Text = r["img_address"].ToString();

                    // TextBox1_Abestract.Text = r["Abstruct"].ToString();
                }



                //  lblPassword.Text = r["password_softwear"].ToString();
                ///  lblsource.Text = r["source_company"].ToString();



                // dateLabel.Text = reader["date"].ToString();//tedade dwnld
                //  lenght.Text = reader["lenght"].ToString();tedade nazar
                //seo
            }

            con.Close();
        }


        else
        { // اگر این کد وجود ندارد
            Response.Redirect("Default.aspx");
        }
    }
Esempio n. 47
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Please enter student name!");
                return; // return because we don't want to run normal code of buton click
            }

            if (comboBox_courses.Text.Trim() == string.Empty && txt_enrollment.Text.Trim()==string.Empty)
            {
                MessageBox.Show("Please Select Course name and enrollment no!");
                return; // return because we don't want to run normal code of buton click
            }


            string pwd = Class1.GetRandomPassword(20);
            string img_path;
            File.Copy(openFileDialog1.FileName, wanted_path + "\\Student_images\\" + pwd + ".jpg");
            img_path = "Student_images\\" + pwd + ".jpg";


            con.Open();
            SqlCommand cmd = con.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into student_info values('" + txt_name.Text + "','" + dateTimePicker1_dob.Text + "','" + txt_address.Text + "','" + txt_email.Text + "','" + txt_phone.Text + "','" + comboBox_courses.Text + "','" + txt_enrollment.Text + "','" + txt_class.Text + "','" + txt_rollno.Text + "','" + comboBox1_txtbatch.Text + "','" + comboBox1_txtcurrentsem.Text + "','" + txt_libraryC.Text + "','" + img_path.ToString() + "')";
            /*cmd.Parameters.AddWithValue("@name",txt_name.Text );
            cmd.Parameters.AddWithValue("@dob", dateTimePicker1_dob.Text);
            cmd.Parameters.AddWithValue("@address", txt_address.Text);
            cmd.Parameters.AddWithValue("@email", txt_email.Text);
            cmd.Parameters.AddWithValue("@phoneno", txt_phone.Text);
            cmd.Parameters.AddWithValue("@course", txt_course.Text);
            cmd.Parameters.AddWithValue("@enrollmentno", txt_enrollment.Text);
            cmd.Parameters.AddWithValue("@class", txt_class.Text);
            cmd.Parameters.AddWithValue("@rollno", txt_rollno.Text);
            cmd.Parameters.AddWithValue("@batch", txt_batch.Text);
            cmd.Parameters.AddWithValue("@currentsem", txt_currentsem.Text);
            cmd.Parameters.AddWithValue("@libcardno", txt_libraryC.Text);
            cmd.Parameters.AddWithValue("@image", img_path.ToString()); */


            DialogResult res = MessageBox.Show("Do You Want To register the student?", "Confirmation", MessageBoxButtons.YesNo);
            if (res == DialogResult.Yes)
            {


                cmd.ExecuteNonQuery();
                MessageBox.Show("Record entered succesfully");
                txt_name.Text = "";
                txt_address.Text = "";
                txt_email.Text = "";
                txt_phone.Text = "";
                comboBox_courses.Text = "";
                txt_enrollment.Text = "";
                txt_rollno.Text = "";
                comboBox1_txtbatch.Text = "";
                comboBox1_txtcurrentsem.Text = "";
                txt_libraryC.Text = "";
                txt_class.Text = "";
                pictureBox1.Image = null;



            }
            else if (res == DialogResult.No)
            {
                MessageBox.Show("Operation Cancelled");

                txt_name.Text = "";
                txt_address.Text = "";
                dateTimePicker1_dob.Text = "";
                txt_address.Text = "";
                comboBox1_txtbatch.Text = "";
                txt_class.Text = "";
                comboBox_courses.Text = "";
                comboBox1_txtcurrentsem.Text = "";
                txt_email.Text = "";
                txt_enrollment.Text = "";
                txt_libraryC.Text = "";
                txt_phone.Text = "";
                txt_rollno.Text = "";
                pictureBox1.Image = null;

            }
            con.Close();




        }
Esempio n. 48
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblCurDate.InnerHtml = String.Format("{0:dd MMMM, yyyy}", DateTime.Now);
        mainlogo.InnerHtml   = Class1.LogoText;
        title.InnerHtml      = Class1.MainHeaderText;
        // --> Checking Cookie
        HttpCookie ckType   = HttpContext.Current.Request.Cookies["ckUserType"];
        String     UserType = "";

        if (ckType != null)
        {
            UserType = ckType.Value.ToString();
        }
        linksmenu.InnerHtml = Class1.CreateMenu(UserType);
        HttpCookie ckName   = HttpContext.Current.Request.Cookies["ckUserName"];
        String     UserName = "";

        if (ckName != null && ckName.Value.ToString() != "")
        {
            UserName = ckName.Value.ToString() + "." + " (" + ckType.Value.ToString() + ")";
        }
        lblusername.InnerHtml = UserName;
        footer.InnerHtml      = Class1.FooterText;
        if (Class1.sUserName() == "")
        {
            Response.Redirect("Login.aspx");
        }

        if (Class1.sUserType().ToString() == "Department")
        {
            lblNewDept.Visible = false;
        }
        String StrSql = "Select * from UserMaster where UserType <> 'Administrator' order by UserType desc,FName";

        if (ckType.Value.ToString() == "Administrator")
        {
            StrSql = "Select * from UserMaster order by FName";
        }
        SqlConnection Cn = new SqlConnection();

        Class1.OpenConn(Cn);
        SqlCommand    Cmd  = new SqlCommand(StrSql, Cn);
        SqlDataReader Dr   = Cmd.ExecuteReader();
        String        Data = "";

        Data = Data + "<table style='background-color:#f8f8ff;' width='100%'>";
        Data = Data + "<tr>";
        Data = Data + "<td class='gridhead' style='background-color:#EEEEEE;'>Username</td>";
        Data = Data + "<td class='gridhead' style='background-color:#EEEEEE;'>User Type</td>";
        Data = Data + "<td class='gridhead' style='background-color:#EEEEEE;'>Email Id</td>";
        Data = Data + "<td class='gridhead' style='background-color:#EEEEEE;'>Mobile No</td>";
        Data = Data + "<td class='gridhead' style='background-color:#EEEEEE;'>Profile</td>";
        Data = Data + "</tr>";
        while (Dr.Read())
        {
            Data = Data + "<tr>";
            Data = Data + "<td class='griddata' style='background-color:#EEEEEE;'>" + Dr["FName"].ToString() + " " + Dr["LName"].ToString() + "</td>";
            Data = Data + "<td class='griddata' style='background-color:#EEEEEE;'>" + Dr["UserType"].ToString() + "</td>";
            Data = Data + "<td class='griddata' style='background-color:#EEEEEE;'>" + Dr["EmailId"].ToString() + "</td>";
            Data = Data + "<td class='griddata' style='background-color:#EEEEEE;'>" + Dr["MobileNo"].ToString() + "</td>";
            Data = Data + "<td class='griddata' style='background-color:#EEEEEE;'><a class='gridlink' href='UserRegistration.aspx?type=na&tag=view&id=" + Dr["UID"].ToString() + "'>View</a><span style='color:#339933'>|</span><a class='gridlink' href='UserRegistration.aspx?type=na&tag=edit&id=" + Dr["UID"].ToString() + "'>Edit</a></td>";
            Data = Data + "</tr>";
        }
        Data = Data + "</table>";
        Dr.Close();
        Cmd.Dispose();
        tbData.InnerHtml = Data;
    }
Esempio n. 49
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //تعداد بازدید ها
        //Label1.Text = Application["c"].ToString();

        //تعداد افراد آنلااین
        //Label2.Text = Application["OnlineUsers"].ToString();


        //Label3.Text = Class1.GetClockShamsi();

        // Label4.Text = DateTime.Now.ToLongTimeString();


        if (int.Parse(Class1.Count_login_rpt()) >= 50)
        {
            c1.CmdSqlDataBaesAccess("Delete From rpt_log");
        }
        else
        {
            c1.CmdSqlDataBaesAccess("insert into rpt_log(us,date_login,ip_login,contry,city)values('مهمان','" + Class1.date_login_logout + "','" + Class1.GetUsersIP() + "','','')");
        }
    }
Esempio n. 50
0
        public ActionResult Daycare_revenue()
        {
            var model = new Class1();


            model.sum11 = 10000;
            model.sum21 = 10000;
            model.sum31 = 0;
            model.sum41 = 1000;


            int result = db.Tbl_Doctor.Count();



            String start = "2019-08-01", end = "2019-08-31";

            dynamic day    = new ExpandoObject();
            dynamic Doc    = new ExpandoObject();
            dynamic donate = new ExpandoObject();
            dynamic adopt  = new ExpandoObject();



            day    = db.Tbl_DayCare_revenue(start, end).ToList();
            Doc    = db.Tbl_Doctor_revenue(start, end).ToList();
            donate = db.Tbl_Donation_revenue(start, end).ToList();
            adopt  = db.Tbl_Doctor_adoption(start, end).ToList();

            foreach (var h in day)
            {
                Tbl_Service s = db.Tbl_Service.Find(h.Service_id);
                model.sum11 = model.sum11 + (Convert.ToInt32(h.Duration) * Convert.ToInt32(s.amount));
            }

            //foreach(var h in Doc)
            //{
            //  model.sum21= (result*100)-h;

            //}

            foreach (var h in donate)
            {
                model.sum31 = model.sum31 + Convert.ToInt32(h);
            }

            foreach (var h in adopt)
            {
                model.sum41 = model.sum41 + Convert.ToInt32(h);
            }



            model.sum12 = 100;
            model.sum22 = 100;
            model.sum32 = 100;
            model.sum42 = 100;

            start  = "2019-09-01"; end = "2019-09-30";
            Doc    = db.Tbl_Doctor_revenue(start, end);
            donate = db.Tbl_Donation_revenue(start, end).ToList();
            adopt  = db.Tbl_Doctor_adoption(start, end).ToList();

            day = db.Tbl_DayCare_revenue(start, end);

            foreach (var h in day)
            {
                Tbl_Service s = db.Tbl_Service.Find(h.Service_id);
                model.sum12 = model.sum12 + (Convert.ToInt32(h.Duration) * Convert.ToInt32(s.amount));
            }

            //foreach(var h in Doc)

            //     model.sum22 = (result * 100) - h;

            foreach (var h in donate)
            {
                model.sum32 = model.sum32 + Convert.ToInt32(h);
            }

            foreach (var h in adopt)
            {
                model.sum42 = model.sum42 + Convert.ToInt32(h);
            }



            model.sum13 = 100;
            model.sum23 = 100;
            model.sum33 = 100;
            model.sum43 = 100;

            start  = "2019-10-01"; end = "2019-10-31";
            Doc    = db.Tbl_Doctor_revenue(start, end);
            donate = db.Tbl_Donation_revenue(start, end).ToList();
            adopt  = db.Tbl_Doctor_adoption(start, end).ToList();

            day = db.Tbl_DayCare_revenue(start, end);

            foreach (var h in day)
            {
                if (h.Service_id == 1000)
                {
                    model.sum13 = model.sum13 + (Convert.ToInt32(h.Duration) * 50);
                }


                else
                {
                    model.sum13 = model.sum13 + (Convert.ToInt32(h.Duration) * 100);
                }
            }

            //foreach (var h in Doc)

            //    model.sum23 = (result * 100) - h;

            foreach (var h in donate)
            {
                model.sum33 = model.sum33 + Convert.ToInt32(h);
            }

            foreach (var h in adopt)
            {
                model.sum43 = model.sum43 + Convert.ToInt32(h);
            }

            TempData["1"] = model.sum11 + model.sum21 + model.sum31 + model.sum41;
            TempData["2"] = model.sum12 + model.sum22 + model.sum32 + model.sum42;
            TempData["3"] = model.sum13 + model.sum23 + model.sum33 + model.sum43;
            //List<Tbl_DayCare> tb = db.Tbl_DayCare.ToList();

            // foreach(Tbl_DayCare tb1 in tb )
            // {
            //     Tbl_Service s = db.Tbl_Service.Find(tb1.Service_id);
            //     sum = sum + (Convert.ToInt32(tb1.Duration)* Convert.ToInt32(s.amount));

            // }

            TempData["11"] = model.sum11;
            TempData["21"] = model.sum21;
            TempData["31"] = model.sum31;
            TempData["21"] = model.sum21;
            TempData["22"] = model.sum22;
            TempData["23"] = model.sum23;
            TempData["31"] = model.sum31;
            TempData["32"] = model.sum32;
            TempData["33"] = model.sum33;
            TempData["41"] = model.sum41;
            TempData["42"] = model.sum42;
            TempData["43"] = model.sum43;

            TempData.Keep();



            return(View(model));
        }
Esempio n. 51
0
 static void Main(string[] args)
 {
     Class1.PrintHelloWorld();
     Console.ReadLine();
 }
Esempio n. 52
0
        public void NUnitTestMethod21()
        {
            var foo = new Class1();

            foo.Method1();
        }
Esempio n. 53
0
    public static int test_0_partial_shared_method_in_nonshared_class()
    {
        var c = new Class1 <double> ();

        return((c.Foo <string> (5).GetType() == typeof(Class1 <string>)) ? 0 : 1);
    }
Esempio n. 54
0
 protected override void OnStartup(StartupEventArgs e)
 {
     var c1 = new Class1();
 }
Esempio n. 55
0
    //private const int portNum = 10116;
    static public void Main(string[] Args)
    {
        byte[]    kiv = { 145, 12, 32, 245, 98, 132, 98, 214, 6, 77, 131, 44, 3, 9, 50, 0 };
        byte[]    iv  = { 15, 122, 132, 5, 93, 198, 44, 31, 9, 39, 241, 49, 250, 188, 80, 7 };
        TcpClient socketForServer;

        try
        {
            socketForServer = new TcpClient("localHost", 10);
        }
        catch
        {
            Console.WriteLine(
                "Failed to connect to server at {0}:999", "localhost");
            return;
        }

        NetworkStream networkStream = socketForServer.GetStream();

        System.IO.StreamReader streamReader =
            new System.IO.StreamReader(networkStream);
        System.IO.StreamWriter streamWriter =
            new System.IO.StreamWriter(networkStream);
        Console.WriteLine("*******This is client program who is connected to localhost on port No:10*****");

        try
        {
            {
                ////////////////////////////////////////////////////////////////
                //        private void LoadPublicKey_Click(object sender, EventArgs e)
                //{


                //    //read public key from server
                //        byte[] Key = new byte[tcpClient.ReceiveBufferSize];
                //        int BytesRead = networkStream.Read(Key, 0, (int)tcpClient.ReceiveBufferSize);
                //         publicKey = Encoding.ASCII.GetString(Key, 0, BytesRead);


                //   //encrept the key of symetric algorithm with Asymetric algorithm
                //        byte[] encrKiv = Enc(kiv, publicKey);
                //        networkStream.Write(encrKiv, 0, encrKiv.Length);
                //        networkStream.Flush();
                //        LoadPublicKey.Enabled = false;

                //}

                ///////////////////////////////////////////////////////////////////////////

                Console.WriteLine("type:");
                string str = Console.ReadLine();
                while (str != "exit")
                {
                    string encoded = Class1.Encrypt1(str, kiv, ref iv);
                    streamWriter.WriteLine(encoded);
                    streamWriter.Flush();
                    //here we send message to the server to reply it to its message ^_^
                    //************************************************
                    string rep = "";
                    rep = streamReader.ReadLine();
                    string decoded = Class1.Decrypt1(rep, kiv, ref iv);
                    Console.WriteLine("Message recieved by server:" + rep);
                    Console.WriteLine("Original Message recieved by server:" + decoded);
                    streamWriter.Flush();
                    //*************************************************

                    Console.WriteLine("type:");
                    str = Console.ReadLine();
                }


                if (str == "exit")
                {
                    streamWriter.WriteLine(str);
                    streamWriter.Flush();
                }
            }
        }
        catch
        {
            Console.WriteLine("Exception reading from Server");
        }
        // tidy up
        networkStream.Close();
        Console.WriteLine("Press any key to exit from client program");
        Console.ReadKey();
    }
Esempio n. 56
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="formCollec"></param>
        /// <param name="impressora"></param>
        public void Imprimir(string[] formCollec, string impressora)
        {
            var db = new Class1(true);

            for (int i = 1; i < formCollec.Count(); i++)
            {
                int IDD = Convert.ToInt32(formCollec[i]);
                var Arq = db.CenarioArquivos.First(x => x.CenarioArquivoId == IDD);


                if (Arq.tipoArquivo == "BL")
                {
                    var Boleto = db.Boleto.First(x => x.NumeroDocumento == Arq.NumeroDocumento);

                    string valor = String.Format("{0:C}", new Utils.Calculos().CalculoPorcentagem(0.033, (double)Boleto.ValorBoleto));

                    new MVX.Print.Boleto().Gera(Boleto, valor);

                    new MVX.Print.Form1().ImprimirBoleto(impressora, Arq.NumeroDocumento);
                }
                if (Arq.tipoArquivo == "Demonstrativo")
                {
                    new MVX.Print.Form1().ImprimirDemostra(impressora, Arq.RemessaLote);
                }
                if (Arq.tipoArquivo == TiposEnum.TipoArquivo.ISS.ToString())
                {
                    new MVX.Print.Form1().ImprimirNFSe(impressora, Arq.NumeroDocumento);
                }
                if (Arq.tipoArquivo == TiposEnum.TipoArquivo.ICMS_FORMULARIO.ToString())
                {
                    string AArq = HttpContext.Current.Server.MapPath("~/App_Data/ICMSELE/ICMS" + Arq.NumeroDocumento + ".doc");
                    if (!File.Exists(AArq))
                    {
                        EnviarLoteRpsEnvioLoteRpsRps nota = new EnviarLoteRpsEnvioLoteRpsRps();
                        nota = Newtonsoft.Json.JsonConvert.DeserializeObject <EnviarLoteRpsEnvioLoteRpsRps>(Encoding.ASCII.GetString(Arq.CorpoDocumento));
                        string valor       = String.Format("{0:C}", new Utils.Calculos().CalculoPorcentagem(32, (double)Arq.Valor));
                        string dias        = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month).ToString();
                        string cliente     = Arq.cnpjCpf.Replace("CNPJ:", "").Replace("CPF:", "").Replace(" ", "").Replace("-", "").Replace(".", "").Replace("/", "");
                        var    _Cliente    = db.cliente.First(x => x.CpfCnpj == cliente);
                        var    Contrato    = db.Contrato.First(x => x.ClienteId == _Cliente.ClienteId);
                        string Vvencimento = string.Empty;
                        if (Contrato._MapaFaturamento.First().MesParcelas == 2)
                        {
                            dias        = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.AddMonths(-1).Month).ToString();
                            Vvencimento = "01" + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + " - " + dias + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
                        }
                        if (Contrato._MapaFaturamento.First().MesParcelas == 3)
                        {
                            dias        = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.AddMonths(1).Month).ToString();
                            Vvencimento = "01" + "/" + DateTime.Now.AddMonths(1).Month + "/" + DateTime.Now.Year + " - " + dias + "/" + DateTime.Now.AddMonths(1).Month + "/" + DateTime.Now.Year;
                        }
                        new MVX.Print.Icms().Gera(nota, Arq.NumeroDocumento, Arq.Observacao, valor, Arq.Vencimento.ToString() + "/" + DateTime.Now.AddMonths(1).Month + "/" + DateTime.Now.Year, Vvencimento);
                    }
                    new MVX.Print.Icms().ImprimirFormulario(impressora, Arq.NumeroDocumento);
                }
                if (Arq.tipoArquivo == TiposEnum.TipoArquivo.DEBITO.ToString())
                {
                    try
                    {
                        new MVX.Print.Form1().ImprimirDebito(impressora, Arq.NumeroDocumento);
                    }
                    catch
                    {
                        CriaArquivo(IDD);
                        new MVX.Print.Form1().ImprimirDebito(impressora, Arq.NumeroDocumento);
                    }
                }
            }
        }
        static void Main()
        {
            string userInput;

            IntPtr       desktopPtr = Win32.GetDC(IntPtr.Zero);
            Graphics     g          = Graphics.FromHdc(desktopPtr);
            String       drawString = "BSUIR RULEZ THE WORLD";
            float        x          = 1700.0F;
            float        y          = 100.0F;
            StringFormat drawFormat = new StringFormat();

            drawFormat.FormatFlags = StringFormatFlags.DirectionRightToLeft;
            while (true)
            {
                Console.WriteLine("0 - Exit");
                Console.WriteLine("1 - Color Animated String (10 sec)");
                Console.WriteLine("2 - Some UnsafeSection From  C# .DLL");
                Console.WriteLine("3 - Some UnsafeCode From  C++ .DLL");

                userInput = Console.ReadLine();
                switch (userInput)
                {
                case ("0"):
                    return;

                case ("1"):
                    for (int counter = 0; counter <= 200; counter++)
                    {
                        Random     rnd       = new Random();
                        int        red       = rnd.Next(0, 256);
                        int        green     = rnd.Next(0, 256);
                        int        blue      = rnd.Next(0, 256);
                        Font       drawFont  = new Font("Arial", 80);
                        SolidBrush drawBrush = new SolidBrush(Color.FromArgb(red, green, blue));
                        g.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
                    }

                    break;

                case ("2"):
                    Class1.someFuncWithPointers();
                    break;

                case ("3"):
                    string matrixCollums;
                    string matrixRows;

                    Console.WriteLine("Enter Number Of Rows: ");
                    matrixRows = Console.ReadLine();
                    int matrixRowsInt = Int32.Parse(matrixRows);

                    Console.WriteLine("Enter Number Of Collums: ");
                    matrixCollums = Console.ReadLine();
                    int matrixCollumsInt = Int32.Parse(matrixRows);

                    cPlusPlusDLL.myMatrix(matrixRowsInt, matrixCollumsInt);
                    break;

                default:
                    Console.WriteLine("Wrong Input!");
                    break;
                }
            }
        }
Esempio n. 58
0
 public string Get()
 {
     classTemp = new Class1();
     return(classTemp.Name);
 }
Esempio n. 59
0
 public void TestMethod2()
 {
     Class1.emit(@"js");
 }
Esempio n. 60
0
        protected void Button17_Click(object sender, EventArgs e) //equal button
        {
            Class1 ob1 = new Class1();
            Class2 ob2 = new Class2();

            result_value = Convert.ToDouble(value);
            switch (operation)
            {
            case "+":
                Double add1    = Double.Parse(TextBox1.Text);
                Double adition = ob1.add(result_value, add1);
                TextBox1.Text = Convert.ToString(adition);

                break;



            case "-":

                Double sub1      = Double.Parse(TextBox1.Text);
                Double summation = ob1.sub(result_value, sub1);

                TextBox1.Text = Convert.ToString(summation);

                break;


            case "*":
                Double mul1  = Double.Parse(TextBox1.Text);
                Double multi = ob1.multiplication(result_value, mul1);

                TextBox1.Text = Convert.ToString(multi);

                break;


            case "/":

                Double div1 = Double.Parse(TextBox1.Text);
                Double div  = ob1.division(result_value, div1);
                TextBox1.Text = Convert.ToString(div);
                break;

            case "√":
                Double squre = Double.Parse(TextBox1.Text);
                Double sqr   = ob1.sqrt(result_value);
                TextBox1.Text = Convert.ToString(sqr);
                break;



            case "%":
                //Double c4 = Convert.ToDouble(TextBox1.Text);
                Double per = ob2.percentage(result_value);
                TextBox1.Text = Convert.ToString(per);
                break;


            case "1/x":
                Double in1 = ob2.invert(result_value);
                TextBox1.Text = Convert.ToString(in1);
                break;


            case "sin":
                Double sin1 = ob2.sin_s(result_value);
                TextBox1.Text = Convert.ToString(sin1);
                break;



            case "cos":

                Double cos1 = ob2.cosine(result_value);

                TextBox1.Text = Convert.ToString(cos1);

                break;

            case "tan":

                Double tan1 = ob2.tangent(result_value);
                TextBox1.Text = Convert.ToString(tan1);
                break;

            case "ln":

                Double ln1 = ob2.nlogarithm(result_value);
                TextBox1.Text = Convert.ToString(ln1);
                break;

            case "log":

                Double log1 = ob2.logarithm(result_value);

                TextBox1.Text = Convert.ToString(log1);

                break;

            case "^":

                Double pw1 = Double.Parse(TextBox1.Text);
                Double pw  = ob2.power(result_value, pw1);

                TextBox1.Text = Convert.ToString(pw);

                break;


            default: break;
            }
            operation_press = false;
        }