private void btnsave_Click(object sender, EventArgs e) { int addnotecarid = Convert.ToInt32(GlobalNoteCarId.notecarid); string note = textBox1.Text; int AddedBy = 4; DataSet dsnt = objSubmitionDetailsBL.MultiSaveNotes(addnotecarid, note, AddedBy); if (dsnt.Tables[0].Columns.Count > 0) { if (dsnt.Tables[0].Rows.Count > 0) { Main objm = new Main(); Globalnotestext.notetext = dsnt.Tables[0].Rows[0]["Note"].ToString(); objm.textBox4.Text=dsnt.Tables[0].Rows[0]["Note"].ToString(); } } }
private void btnsubmit_Click(object sender, EventArgs e) { if (txturl.Text == "") { MessageBox.Show("URL Required"); } else { // string cell = //dtgvRecent.Rows[e.RowIndex].Cells[e.ColumnIndex].ToString(); int urlid = GlobalUrlid.Urlid; string sitename = GlobalSite.Site; if (txturl.Text.Contains(sitename)) { // string Regex = " /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!-\\/]))?/;"; //if (Regex.(txtpndg.Text)) //{ //} Regex urlCheck = new Regex(@"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); if (urlCheck.IsMatch(txturl.Text)) { objSubmitionDetailsBL.UpdatePendingDetails(urlid, GlobalLogId.globallogidVar, "Completed", txturl.Text); //string QcStaus = "Pending"; //string SubStatus = "completed"; //objSubmitionDetailsBL.GetSubmitionDetails(); //objSubmitionDetailsBL.MultiSaveSubmitionDetails( GlobalCARId.globcarid, txturl.Text, websiteId, subby, SubStatus, QcStaus); MessageBox.Show("Url Updated Successfully"); txturl.Text = ""; ////PendingDetails objpend = new PendingDetails(); ////objpend.Show(); ////objpend.Text = "Submit Pending URL"; this.Hide(); Main objpen = new Main(); objpen.Getpending(); objpen. tabControl1.SelectedIndex = 1; } else { MessageBox.Show("Submit Correct URL"); txturl.Text = ""; } } else { MessageBox.Show("Enter Correct URL"); txturl.Text = ""; } } }
private void logOutToolStripMenuItem_Click_1(object sender, EventArgs e) { // label1.Visible = false; popform.popform1.Hide(); popform.popform2.Hide(); popform.popform3.Hide(); //Main newForm = new Main(objlogin); //newForm.Hide(); uploadCarDetailsToolStripMenuItem.Enabled = false; recentCarIdsToolStripMenuItem.Enabled = false; qcCheckToolStripMenuItem.Enabled = false; pendingUrlsToolStripMenuItem1.Enabled = false; postToolStripMenuItem.Enabled = false; qcCheckToolStripMenuItem.Visible = false; c3.Hide(); u3.Hide(); m3.Hide(); //newForm.Hide(); l3.MdiParent = this; l3.Show(); logOutToolStripMenuItem.Enabled = false; // M_parent.msgme(); Main obj = new Main(); obj.Close(); }
//public void msgme() //{ // MessageBox.Show("Parent Function Called"); //} private void btnLogin_Click(object sender, EventArgs e) { try { if ((txtUname.Text == "") || (txtPwd.Text == "")) { MessageBox.Show("Please enter UserName and Password", "", MessageBoxButtons.OK, MessageBoxIcon.Hand); txtUname.Focus(); txtUname.Text = ""; txtPwd.Text = ""; } else { Cursor.Current = Cursors.WaitCursor; //circularProgressControl1.Start(); String strHostName = System.Net.Dns.GetHostName(); // string strIp1 = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString(); IPHostEntry ipEntry = Dns.GetHostEntry(strHostName); IPAddress[] addr = ipEntry.AddressList; // for (int iip = 0; iip < addr.Length; iip++) // { // string ipp = addr[iip].ToString(); Regex ip = new Regex(@"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"); ////if (ip.IsMatch(ipp)) ////{ //string[] result = ip.; // string strIp1 = addr[iip].ToString(); string strIP2 = string.Empty; string strIP3 = string.Empty; DataSet dsIP = new DataSet(); // dsIP = objLogBL.GetIpAddressList(strIp1); //if (dsIP.Tables.Count > 0) //{ // if (dsIP.Tables[0].Rows.Count > 0) // { if (txtUname.Text != "" || txtPwd.Text != "") { DataSet PerformLogin = new DataSet(); objLogInIfno.UserName = txtUname.Text; objLogInIfno.Password = txtPwd.Text; PerformLogin = objLogBL.PerformLogin(txtUname.Text, txtPwd.Text); // String strHostName = "hugo56"; if (PerformLogin.Tables.Count > 0) { if (PerformLogin.Tables[0].Rows.Count > 0) { object o = PerformLogin.Tables[0].Rows[0]["MultiUID"]; GlobalLogId.globallogidVar = Convert.ToInt32(o); // Form1 newForm1 = new Form1(txtUname.Text, objLogInIfno.TypeOfUser); // newForm1.Show(); GlobalUserName.UserName = txtUname.Text; // Main newForm = new Main(txtUname.Text, objLogInIfno.TypeOfUser); Main newForm = new Main(); //Form1 objform = new Form1(txtUname.Text, objLogInIfno.TypeOfUser); // newForm.Closed += (sender1, args) => this.Close(); // newForm.Show(); this.Hide(); //objform.Show(); } else { MessageBox.Show("Invalid UserName & Password", "", MessageBoxButtons.OK, MessageBoxIcon.Hand); txtUname.Text = ""; txtPwd.Text = ""; txtUname.Focus(); } } } else { MessageBox.Show("Please Provide Credentials", "", MessageBoxButtons.OK, MessageBoxIcon.Hand); txtUname.Text = ""; txtPwd.Text = ""; txtUname.Focus(); } // } // else // { // } // } // } // } Cursor.Current = Cursors.Default; // } // } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); //MessageBox.Show("I am Sorry we cannot provide you the service .Please contact Our Administrator"); } // circularProgressControl1.Stop(); Cursor.Current = Cursors.WaitCursor; }
public string ShowCarDialog(string text, string caption) { Form promptDt = new Form(); promptDt.Width = 300; promptDt.Height = 150; promptDt.Text = caption; Label textLabelDt = new Label() { Left = 70, Top = 30, Width = 80, Text = text }; TextBox textBoxDt = new TextBox() { Left = 150, Top = 29, Width = 80 }; textBoxDt.Height = 100; Button confirmationDt = new Button() { Text = "Submit", Left = 155, Width = 70, Top = 58 }; confirmationDt.Click += (sender, e) => { if (textBoxDt.Text != "") { Main objmn = new Main(); objmn.Show(); // string num = textBoxDt.Text; // objmn.BringToFront(); objmn.GetCarDetails(textBoxDt.Text); // promptDt.Close(); } else { MessageBox.Show("enter carid", "", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }; //Button btnclose = new Button() { Text = "Abandon", Left = 70, Width = 70, Top = 58 }; // btnclose.Click += (sender, e) => // { // prompt.Close(); // }; promptDt.Controls.Add(confirmationDt); promptDt.Controls.Add(textLabelDt); promptDt.Controls.Add(textBoxDt); // prompt.Controls.Add(btnclose); // prompt.Close(); promptDt.ShowDialog(); return textBoxDt.Text; }
public DataTable Statictics() { //Adding// SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ds"].ToString()); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; con.Open(); //taemp1 cmd.CommandText = "delete Tempt1"; cmd.ExecuteNonQuery(); string str = " insert into Tempt1 (Smname,Thisweek ) " + "select SU.SmartzUname,count(SMS.PostedBy) 'This wk#' from Tbl_MultiStatusbySite " + " as SMS inner join Tbl_SmartzUsers as SU on Su.SmartzUID=SMS.PostedBy where " + " SMS.UrlPostDate>= DATEADD(dd, -7, getdate()) group by SMS.postedBy,SU.SmartzUname"; cmd.CommandText = str; cmd.ExecuteNonQuery(); cmd.CommandText = "delete tempt2"; cmd.ExecuteNonQuery(); //temp2 string str1 = " insert into tempt2 (smartnam,lifetime ) " + "select SU.SmartzUname,count(SMS.PostedBy) 'Life time#'from Tbl_MultiStatusbySite as SMS inner join " + " Tbl_SmartzUsers as SU on Su.SmartzUID=SMS.PostedBy group by SMS.postedBy,SU.SmartzUname "; cmd.CommandText = str1; cmd.ExecuteNonQuery(); cmd.CommandText = "delete Temp3"; cmd.ExecuteNonQuery(); //Main Table string str2 = " insert into Temp3 (Sname,LifeTime,ThisWeek ) " + "select a.smartnam,a.lifetime,b.Thisweek from tempt2 as a left join Tempt1 as b on a.smartnam=b.Smname "; cmd.CommandText = str2; cmd.ExecuteNonQuery(); cmd.CommandText = "delete Tempt1"; cmd.ExecuteNonQuery(); cmd.CommandText = "delete tempt2"; cmd.ExecuteNonQuery(); //urlPening string str4 = " insert into Tempt1 (Smname,Thisweek) " + "select SU.SmartzUname, count(MSS.PostedBy) as 'Pending' from Tbl_MultiStatusbySite as MSS " + "inner join Tbl_SmartzUsers as SU on MSS.PostedBy=SU.SmartzUID where SubStatus='Pending' group by " + " MSS.PostedBy,SU.SmartzUname "; cmd.CommandText = str4; cmd.ExecuteNonQuery(); //Main Table with url pending string str7 = " insert into Temp3 (Sname,LifeTime,ThisWeek ) " + "select a.smartnam,a.lifetime,b.Thisweek from tempt2 as a left join Tempt1 as b on a.smartnam=b.Smname "; cmd.CommandText = str7; cmd.ExecuteNonQuery(); //QcPening in t2 //Main Table with url pending string str6 = " insert into tempt2 (smartnam,lifetime ) " + "select SU.SmartzUname, count(MSS.PostedBy) as 'Pending' from Tbl_MultiStatusbySite as MSS inner join Tbl_SmartzUsers as SU on " + " MSS.PostedBy=SU.SmartzUID where QcStatus='Pending'and SubStatus='Completed' group by MSS.PostedBy,SU.SmartzUname "; cmd.CommandText = str6; cmd.ExecuteNonQuery(); int value = 0; int value1; int value2 = 0; //GridBinding string S1 = "select isnull(a.Sname,'0')as 'Users',isnull(a.ThisWeek,'0')as 'ThisWeek#',isnull(a.lastWeek,'0')as 'LastWeek#',isnull(a.LifeTime,'0')as 'LifeTime#',isnull(b.Thisweek,'0') as UrlPending, " + " isnull(c.lifetime,'0') as [QC Pending] from Temp3 as a "; try { SqlDataReader dr; string str11 = " select count(lifetime) as Va from tempt2"; cmd.CommandText = str11; dr = cmd.ExecuteReader(); if (dr.Read()) { value2 = Convert.ToInt32(dr["Va"].ToString()); } dr.Close(); } catch { value = 0; } //try //{ // string str111 = " select count(lifetime) from tempt2"; // cmd.CommandText = str111; // value1 = cmd.ExecuteNonQuery(); //} //catch { value = 0; } if (value2 == 0) //S1 += " left join Tempt1 as b on a.Sname=B.Smname left join tempt2 as c on B.Smname=c.smartnam "; S1 += " FULL OUTER JOIN Tempt1 as b on a.Sname=B.Smname FULL OUTER JOIN tempt2 as c on B.Smname=c.smartnam "; else //S1 += " left join tempt2 as c on a.Sname=c.smartnam left join Tempt1 as B on c.smartnam=B.Smname "; S1 += " FULL OUTER JOIN tempt2 as c on a.Sname=c.smartnam FULL OUTER JOIN Tempt1 as B on c.smartnam=B.Smname "; SqlDataAdapter dap = new SqlDataAdapter(S1, con); DataTable dt = new DataTable(); dap.Fill(dt); Main objmn = new Main(); objmn.dataGridView2.DataSource = dt; return dt; }