void BindChartAvgAge() { ConClass obj = new ConClass(); DataTable dt = obj.Selectdt(@"select ft.Name_local as Indicator, isnull(sum(p.amount),0)/1000 as [عواید] from zFeeType ft left outer join Payment p on ft.ID=p.FeeTypeID where ft.ID in (1,2) group by ft.Name_Local"); foreach (DataRow dr in dt.Rows) { Series series = new Series(); for (int i = 1; i < dt.Columns.Count; i++) { int y = Convert.ToInt32(dr[i]); series.Points.AddXY(dt.Columns[i].ColumnName.ToString(), y); series.Points[i - 1].Label = dr[i].ToString(); series.Points[i - 1].Font = new System.Drawing.Font("Trebuchet MS", 7.0F, System.Drawing.FontStyle.Regular); } chAvgAge.Series.Add(series); } chAvgAge.Series[0].LegendText = " (۰۰۰)فیس خدمات شهری"; chAvgAge.Series[0].Color = Color.DeepPink; chAvgAge.Series[1].LegendText = "(۰۰۰)فیس لوحه"; chAvgAge.Series[1].Color = Color.Green; chAvgAge.Visible = true; chAvgAge.Legends[0].Enabled = true; chAvgAge.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false; chAvgAge.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false; chAvgAge.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 7.25F, System.Drawing.FontStyle.Regular); chAvgAge.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 7.25F, System.Drawing.FontStyle.Regular); }
void LoadForm() { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt("select dbo.topersianDate(AssessmentDate) as AssessmentDate,ApprovalStatusID,ApprovalRemarks,ApprovedBy,Capital,AnnualSales,EmployeeMale,EmployeeFemale,latitude,longitude from business where ID=" + Session["BusinessID"].ToString()); if (dt.Rows.Count > 0) { txtApplicationDate.Value = dt.Rows[0][0].ToString(); ddlApprovalStatus.SelectedValue = dt.Rows[0][1].ToString(); txtRemarks.Value = dt.Rows[0][2].ToString(); txtApprovedBy.Value = dt.Rows[0][3].ToString(); txtCapital.Value = dt.Rows[0][4].ToString(); txtAnnualSales.Value = dt.Rows[0][5].ToString(); txtMale.Value = dt.Rows[0][6].ToString(); txtFemale.Value = dt.Rows[0][7].ToString(); txtLat.Value = dt.Rows[0][8].ToString(); txtLong.Value = dt.Rows[0][9].ToString(); } } } catch (Exception) { } }
protected void gvPayment_RowCommand(object sender, GridViewCommandEventArgs e) { string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' }); lblID.Text = commandArgs[0]; string TypeID = commandArgs[1]; // lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "Ed") { GetPayment(lblID.Text); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from CartLicense where ID=" + commandArgs[0]); gvPayment.DataBind(); } } else if (e.CommandName == "print") { Session["CartLicenseID"] = commandArgs[0]; if (TypeID == "1") { Response.Redirect("~/Reports/PrintCartCertificate.aspx"); } else if (TypeID == "2") { Response.Redirect("~/Reports/PrintCartIDCard.aspx"); } } }
void GetPayment(string ID) { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt("select case when paymentDate is not null then dbo.topersianDate(paymentDate) else null end as PaymentDate,FeetypeID,Amount,Receipt,remarks,yearID,paymentstatusID from payment where ID=" + ID); if (dt.Rows.Count > 0) { txtApplicationDate.Value = dt.Rows[0][0].ToString(); ddlApprovalStatus.SelectedValue = dt.Rows[0][1].ToString(); txtAmount.Value = dt.Rows[0][2].ToString(); txtReceipt.Value = dt.Rows[0][3].ToString(); txtSignBoard.Value = dt.Rows[0][4].ToString(); if (dt.Rows[0][1].ToString() == "2") { dvSpec.Visible = true; } if (!string.IsNullOrEmpty(dt.Rows[0][5].ToString())) { ddlYear.SelectedValue = dt.Rows[0][5].ToString(); } ddlPaymentStatus.SelectedValue = dt.Rows[0][6].ToString(); dt.Dispose(); } } }
void GetBusinessInfo() { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select b.ID,dbo.ToPersianDate(bl.IssueDate) as IssueDate,dbo.ToPersianDate(bl.ExpirationDate) as ExpiryDate,b.OwnerName,b.FatherName,c.Name_Local as Class,ct.Name_Local as Category, b.street+' - ' +b.ShopNumber as ShopAddress, d.Code as DistrictID,b.photo,b.Code from BusinessLicense bl inner join Business b on b.ID=bl.BusinessID inner join zDistrict d on d.ID=b.DistrictID inner join zBusinessClass c on c.ID=b.BusinessClassID inner join zBusinessCategory ct on ct.ID=b.BusinessCategoryID where bl.StatusID=1 and bl.ID=" + Session["LicenseID"].ToString()); if (dt.Rows.Count > 0) { ID = dt.Rows[0][0].ToString(); IssueDate = dt.Rows[0][1].ToString(); ExpiryDate = dt.Rows[0][2].ToString(); Name = dt.Rows[0][3].ToString(); FatherName = dt.Rows[0][4].ToString(); Class = dt.Rows[0][5].ToString(); Category = dt.Rows[0][6].ToString(); ShopAddress = dt.Rows[0][7].ToString(); DistrictID = dt.Rows[0][8].ToString(); //if (dt.Rows[0][9] != null) //{ // Photo = ByteToImage((Byte[])dt.Rows[0][9]); //} Code = dt.Rows[0][10].ToString(); } dt.Dispose(); } } catch (Exception) { } }
void NewBusinessID() { ConClass obj = new ConClass(); try { SqlDataReader rd = obj.Selectdr("select isnull(max(ID)+1,1) from business"); while (rd.Read()) { using (SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString)) { sqlConnection.Open(); string insert = @"if not exists(select businessid from businessindex where businessID=@businessID) insert into businessIndex(businessID) values(@BusinessID) else insert into businessIndex(businessID) values(@BusinessID+1) "; using (SqlCommand sqlCommand = new SqlCommand(insert, sqlConnection)) { sqlCommand.Parameters.Add("@BusinessID", SqlDbType.NVarChar).Value = rd[0].ToString(); sqlCommand.ExecuteNonQuery(); } } } rd.Close(); SqlDataReader rd1 = obj.Selectdr("select isnull(max(businessID),1) from businessindex"); while (rd1.Read()) { Session["BusinessID"] = rd1[0].ToString(); } rd1.Close(); } catch (Exception) { throw; } }
// This switch statement is based upon how many guesses the player has left //From 7 through to 0. Each case statement displays a different picture and runs the "GuessedWrongText" method, which just displays a text. private void GuessFailed() { switch (GuessesLeft) { case 7: imgHangman.SetImageResource(Resource.Drawable.F1); break; case 6: imgHangman.SetImageResource(Resource.Drawable.F2); break; case 5: imgHangman.SetImageResource(Resource.Drawable.F3); break; case 4: imgHangman.SetImageResource(Resource.Drawable.F4); break; case 3: imgHangman.SetImageResource(Resource.Drawable.F5); break; case 2: imgHangman.SetImageResource(Resource.Drawable.F6); break; case 1: imgHangman.SetImageResource(Resource.Drawable.F7); break; // Case 0(0 turns left), the player has lost the game. case 0: imgHangman.SetImageResource(Resource.Drawable.F8); // For losing the game, the player incurs a 12 point penalty to their score. If it puts their score below 0, it will be set to 0 score = score - 12; if (score < 0) { score = 0; } System.Threading.Thread.Sleep(200); Toast.MakeText(this, "You have run out of guesses! You LOSE. Your Score was " + score, ToastLength.Short).Show(); var cc = new ConClass(); cc.UpdateScore(Id, PlayerName, score); System.Threading.Thread.Sleep(500); StartActivity(typeof(MainActivity)); break; } }
protected void btnVerify_Click(object sender, EventArgs e) { using (ConClass obj = new ConClass()) { obj.execNonQuery("update business set IsVerified=1 where ID=" + Session["BusinessID"].ToString()); } Response.Redirect("BusinessToVerify.aspx"); }
void LoadForm(string code) { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select BusinessName,OwnerName,FatherName,Gender,Tazkira,dbo.topersianDate(ApplicationDate) as ApplicationDate, ProvinceID,DistrictID,Street,Address,Phone,Photo,Code,latitude,longitude,Verificationremarks from Cart where ID=" + code); if (dt.Rows.Count > 0) { txtCode.Value = dt.Rows[0]["Code"].ToString(); txtID.Value = code; Session["CartID"] = code; txtEName.Value = dt.Rows[0]["BusinessName"].ToString(); txtOwnerName.Value = dt.Rows[0]["OwnerName"].ToString(); txtFatherName.Value = dt.Rows[0]["FatherName"].ToString(); ddlGender.SelectedValue = dt.Rows[0]["Gender"].ToString(); txtNID.Value = dt.Rows[0]["Tazkira"].ToString(); txtApplicationDate.Value = dt.Rows[0]["ApplicationDate"].ToString(); ddlProvince.SelectedValue = dt.Rows[0]["ProvinceID"].ToString(); BindDistrict(); ddlDistrict.SelectedValue = dt.Rows[0]["DistrictID"].ToString(); txtStreet.Value = dt.Rows[0]["Street"].ToString(); txtAddress.Value = dt.Rows[0]["Address"].ToString(); txtPhone.Value = dt.Rows[0]["Phone"].ToString(); txtLatitude.Value = dt.Rows[0]["Latitude"].ToString(); txtLongnitude.Value = dt.Rows[0]["Longitude"].ToString(); txtRep.Value = dt.Rows[0]["Verificationremarks"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["Photo"].ToString()))// != null) { byte[] bytes = (byte[])dt.Rows[0]["Photo"]; string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); Image1.ImageUrl = "data:image/jpg;base64," + base64String; Image1.Visible = true; } //if (HttpContext.Current.User.IsInRole("Entry")) //{ // btnSave.Enabled = false; // // System.Windows.Forms.MessageBox.Show("Test"); //} } dt.Dispose(); } } catch (Exception ex) { //System.Windows.Forms.MessageBox.Show(ex.Message); } }
protected void btnSearch_Click(object sender, EventArgs e) { using (ConClass obj = new ConClass()) { //System.Windows.Forms.MessageBox.Show(GetFilter()); rptMarkers.DataSource = obj.Selectdt(@"Select top 5000 ID, Latitude, longitude, Address as Description, BusinessName as title, Street as Name from cart where latitude is not null and " + GetFilter()); rptMarkers.DataBind(); } }
protected void btnSearch_Click(object sender, EventArgs e) { using (ConClass obj = new ConClass()) { //System.Windows.Forms.MessageBox.Show(GetFilter()); rptMarkers.DataSource = obj.Selectdt(@";with Bpayment as (select BusinessID, 1 as PaymentStatus from payment where YearID=" + GetYear() + @") Select top 5000 ID, Latitude, longitude, Address as Description, BusinessName as title, Street as Name, isnull(p.PaymentStatus, 0) as PaymentStatus from business left join Bpayment p on p.BusinessID = business.ID where latitude is not null and " + GetFilter()); rptMarkers.DataBind(); } }
private void GameWon() { // Set the image to default DefaultImage(); // Display the text Toast.MakeText(this, "You guessed the word correctly", ToastLength.Short). Show(); var cc = new ConClass(); cc.UpdateScore(Id, PlayerName, score); // And load a new word LoadNewRandomWord(); }
void GetPayment(string ID) { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt("select dbo.topersianDate(IssueDate) as IssueDate,dbo.topersianDate(ExpirationDate) as ExpiryDate,StatusID from BusinessLicense where ID=" + ID); if (dt.Rows.Count > 0) { txtIssueDate.Value = dt.Rows[0][0].ToString(); //txtExpiryDate.Value = dt.Rows[0][1].ToString(); //ddlStatus.SelectedValue = dt.Rows[0][2].ToString(); dt.Dispose(); } } }
bool IsPaid(string ID) { bool returnVal = false; using (ConClass obj = new ConClass()) { //System.Windows.Forms.MessageBox.Show(GetFilter()); SqlDataReader rd = obj.Selectdr(@"select ID from payment where ID=" + ID + " and YearID=substring(dbo.ToPersianDate(getdate()),1,4) and paymentStatusID=2"); if (rd.HasRows) { returnVal = true; } return(returnVal); } }
void GetBusinessInfo() { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select b.ID, dbo.ToPersianDate(bl.IssueDate) as IssueDate, dbo.ToPersianDate(bl.ExpirationDate) as ExpiryDate, b.BusinessName, b.OwnerName, b.FatherName, b.Tazkira, b.Address, d.Code as DistrictID, b.photo, b.Code,b.VerificationRemarks from CartLicense bl inner join cart b on b.ID=bl.BusinessID inner join zDistrict d on d.ID=b.DistrictID where bl.StatusID=1 and bl.ID=" + Session["CartLicenseID"].ToString()); if (dt.Rows.Count > 0) { ID = dt.Rows[0][0].ToString(); IssueDate = dt.Rows[0][1].ToString(); ExpiryDate = dt.Rows[0][2].ToString(); BusinessName = dt.Rows[0][3].ToString(); Name = dt.Rows[0][4].ToString(); FatherName = dt.Rows[0][5].ToString(); Tazkira = dt.Rows[0][6].ToString(); ShopAddress = dt.Rows[0][7].ToString(); DistrictID = dt.Rows[0][8].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0][9].ToString())) { Photo = ByteToImage((Byte[])dt.Rows[0][9]); } else { Photo = (System.Drawing.Image)Bitmap.FromFile(Server.MapPath("~/images/no_photo.jpg")); // set image } Code = dt.Rows[0][10].ToString(); VerificationRemarks = dt.Rows[0][11].ToString(); } dt.Dispose(); } } catch (Exception) { } }
protected void gvPayment_RowCommand(object sender, GridViewCommandEventArgs e) { lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "Ed") { GetPayment(lblID.Text); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from payment where ID=" + e.CommandArgument.ToString()); gvPayment.DataBind(); } } }
void GetPayment(string ID) { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt("select case when paymentDate is not null then dbo.topersianDate(paymentDate) end as PaymentDate,FeetypeID,Amount,Receipt,PaymentStatusID,yearID from payment where ID=" + ID); if (dt.Rows.Count > 0) { txtApplicationDate.Value = dt.Rows[0][0].ToString(); ddlApprovalStatus.SelectedValue = dt.Rows[0][1].ToString(); txtAmount.Value = dt.Rows[0][2].ToString(); txtReceipt.Value = dt.Rows[0][3].ToString(); ddlPaymentStatus.SelectedValue = dt.Rows[0][4].ToString(); ddlYear.SelectedValue = dt.Rows[0][5].ToString(); dt.Dispose(); } } }
void GetAmount() { try { using (ConClass obj = new ConClass()) { if (gvGroup.Rows.Count > 0) { txtAmount.Value = obj.Selectdt("Select dbo.funLicenseFeeByID(" + Session["BusinessID"].ToString() + ")").Rows[0][0].ToString(); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
void LoadForm() { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select b.*,p.Name_Local as Province,d.Name_local as District, dbo.ToPersianDate(b.ApplicationDate) as ApplicationDate1, gn.Name_local as Gender1 from Cart b left outer join zGender gn on gn.ID=b.Gender left outer join zProvince p on p.ID=b.ProvinceID left outer join zDistrict d on d.id=b.DistrictID where b.ID=" + Session["CartID"].ToString()); if (dt.Rows.Count > 0) { lblCode.Text = dt.Rows[0]["Code"].ToString(); lblBusinessName.Text = dt.Rows[0]["BusinessName"].ToString(); lblOwnername.Text = dt.Rows[0]["Ownername"].ToString(); lblFatherName.Text = dt.Rows[0]["FatherName"].ToString(); lblGender.Text = dt.Rows[0]["Gender1"].ToString(); lblTazkira.Text = dt.Rows[0]["Tazkira"].ToString(); lblApplicationDate.Text = dt.Rows[0]["ApplicationDate1"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["Photo"].ToString())) { byte[] bytes = (byte[])dt.Rows[0]["Photo"]; string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); Image1.ImageUrl = "data:image/jpg;base64," + base64String; } lblProvince.Text = dt.Rows[0]["Province"].ToString(); lblDistrict.Text = dt.Rows[0]["District"].ToString(); lblStreet.Text = dt.Rows[0]["Street"].ToString(); lblPhone.Text = dt.Rows[0]["Phone"].ToString(); lblAddress.Text = dt.Rows[0]["Address"].ToString(); lblX.Text = dt.Rows[0]["Latitude"].ToString(); lblY.Text = dt.Rows[0]["Longitude"].ToString(); } dt.Dispose(); } } catch (Exception ex) { } }
protected void gvPayment_RowCommand(object sender, GridViewCommandEventArgs e) { lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "download") { Openfile(e.CommandArgument.ToString()); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from BusinessFile where ID=" + e.CommandArgument.ToString()); gvPayment.DataBind(); Clear(); } } }
void BindChartBusiness() { ConClass obj = new ConClass(); DataTable dt; if (Cache["data"] == null) { dt = obj.Selectdt(@"select N'اصناف' as Businesses, count(distinct case when datepart(q,applicationDate)=1 then ID else null end) Q1, count(distinct case when datepart(q,applicationDate)=2 then ID else null end) Q2, count(distinct case when datepart(q,applicationDate)=3 then ID else null end) Q3, count(distinct case when datepart(q,applicationDate)=4 then ID else null end) Q4 from business where left(dbo.ToPersianDate(applicationDate),4)=left(dbo.ToPersianDate(getdate()),4)"); Cache.Insert("data", dt, null, DateTime.MaxValue, TimeSpan.Zero); } else { dt = (DataTable)Cache["data"]; } foreach (DataRow dr in dt.Rows) { Series series = new Series(); for (int i = 1; i < dt.Columns.Count; i++) { int y = Convert.ToInt32(dr[i]); series.Points.AddXY(dt.Columns[i].ColumnName.ToString(), y); series.Points[i - 1].Label = dr[i].ToString(); series.Points[i - 1].Font = new System.Drawing.Font("Trebuchet MS", 7.0F, System.Drawing.FontStyle.Regular); } chBusiness.Series.Add(series); } chBusiness.Series[0].LegendText = " تعداد اصناف "; chBusiness.Series[0].Color = Color.DeepPink; chBusiness.Visible = true; chBusiness.Legends[0].Enabled = true; chBusiness.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false; chBusiness.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false; chBusiness.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 7.25F, System.Drawing.FontStyle.Regular); chBusiness.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 7.25F, System.Drawing.FontStyle.Regular); }
protected void btnSearch_Click(object sender, EventArgs e) { string filter = "1<1"; if (!string.IsNullOrEmpty(txtCode.Value)) { filter = " b.code=N'" + txtCode.Value + "'"; } if (!HttpContext.Current.User.IsInRole("Admin")) { filter = filter + " and b.DistrictID=" + HttpContext.Current.Profile["DistrictID"].ToString(); } if (!string.IsNullOrEmpty(txtBusinessName.Value)) { filter = " b.BusinessName=N'" + txtBusinessName.Value + "'"; } if (!string.IsNullOrEmpty(txtName.Value) && !string.IsNullOrEmpty(txtFName.Value)) { filter = " b.OwnerName=N'" + txtName.Value + "' and b.FatherName=N'" + txtFName.Value + "'"; } if (!string.IsNullOrEmpty(filter)) { dsPaymentCategory.SelectCommand = @"select b.ID, b.Code,b.BusinessName,b.OwnerName,b.fathername,d.name_local as District,c.Name_local as Class,b.phone,ct.Name_Local as Category,c.ID as ClassID,ct.ID as CatID from business b left outer join zBusinessClass c on c.ID=b.BusinessClassID left outer join zDistrict d on d.ID=b.DistrictID left outer join zBusinessCategory ct on ct.ID=b.BusinessCategoryID where " + filter; //dsPaymentCategory.SelectParameters[0].DefaultValue= txtCode.Value; dsPaymentCategory.DataBind(); gvGroup.DataBind(); if (gvGroup.Rows.Count > 0) { using (ConClass obj = new ConClass()) { Session["BusinessIDForPayment"] = obj.Selectdt("Select b.ID from business b where " + filter).Rows[0][0].ToString(); } } else { Session["BusinessIDForPayment"] = ""; } gvPayment.DataBind(); } }
protected void BindGrid(string BusinessID) { string filter = "1<1"; if (!string.IsNullOrEmpty(txtCode.Value)) { filter = " b.code=N'" + txtCode.Value + "'"; } if (!string.IsNullOrEmpty(txtName.Value)) { filter = " b.BusinessName=N'" + txtName.Value + "'"; } if (!string.IsNullOrEmpty(BusinessID)) { filter = " b.ID=" + BusinessID; } if (!string.IsNullOrEmpty(filter)) { // dsPaymentCategory.SelectCommand = @"select b.ID, b.Code,b.BusinessName,b.OwnerName,b.fathername,d.name_local as District,c.Name_local as Class,b.phone,ct.Name_Local as Category from business b left outer join zBusinessClass c on c.ID=b.BusinessClassID //left outer join zDistrict d on d.ID=b.DistrictID left outer join zBusinessCategory ct on ct.ID=b.BusinessCategoryID where b.ID in (select BusinessID from payment where yearID=left(dbo.topersianDate(getdate()),4)) and " + filter; dsPaymentCategory.SelectCommand = @"select b.ID, b.Code,b.BusinessName,b.OwnerName,b.fathername,d.name_local as District,c.Name_local as Class,b.phone,ct.Name_Local as Category from business b left outer join zBusinessClass c on c.ID=b.BusinessClassID left outer join zDistrict d on d.ID=b.DistrictID left outer join zBusinessCategory ct on ct.ID=b.BusinessCategoryID where " + filter; //dsPaymentCategory.SelectParameters[0].DefaultValue= txtCode.Value; dsPaymentCategory.DataBind(); gvGroup.DataBind(); if (gvGroup.Rows.Count > 0) { using (ConClass obj = new ConClass()) { Session["BusinessIDForLicense"] = obj.Selectdt("Select b.ID from business b where " + filter).Rows[0][0].ToString(); } } else { Session["BusinessIDForLicense"] = ""; } gvPayment.DataBind(); } }
void BindChartLoan() { ConClass obj = new ConClass(); DataTable dt = obj.Selectdt(@"select g.Name_Local as BusinessGroup,count(b.ID) as Businesses from business b inner join zBusinessGroup g on g.ID=b.GroupID group by g.Name_Local"); string[] x = new string[dt.Rows.Count]; int[] y = new int[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { x[i] = dt.Rows[i][0].ToString(); y[i] = Convert.ToInt32(dt.Rows[i][1]); } chLoanSector.Series[0].Points.DataBindXY(x, y); chLoanSector.Series[0].ChartType = SeriesChartType.Pie; chLoanSector.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false; chLoanSector.Legends[0].Enabled = true; chLoanSector.Visible = true; //obj.Dispose(); }
protected void gvPayment_RowCommand(object sender, GridViewCommandEventArgs e) { lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "Ed") { GetPayment(lblID.Text); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from BusinessLicense where ID=" + e.CommandArgument.ToString()); gvPayment.DataBind(); } } else if (e.CommandName == "print") { Session["LicenseID"] = e.CommandArgument.ToString(); Response.Redirect("~/Reports/PrintCertificate.aspx"); } }
protected void gvGroup_RowCommand(object sender, GridViewCommandEventArgs e) { lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "Ed") { //Session["BusinessID"] = lblID.Text; Response.Redirect("Create.aspx?ID=" + lblID.Text); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from payment where businessID=" + e.CommandArgument.ToString() + "; Delete from businesslicense where businessID=" + e.CommandArgument.ToString() + "; delete from business where ID=" + e.CommandArgument.ToString()); gvGroup.DataBind(); } } else if (e.CommandName == "View") { Session["BusinessID"] = lblID.Text; Response.Redirect("ViewBusiness.aspx"); } }
protected void gvGroup_RowCommand(object sender, GridViewCommandEventArgs e) { lblID.Text = e.CommandArgument.ToString(); if (e.CommandName == "Ed") { Session["BusinessID"] = lblID.Text; Response.Redirect("Create.aspx"); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { //obj.execNonQuery("Delete from PaymentCategory where ID=" + e.CommandArgument.ToString()); //gvGroup.DataBind(); } } else if (e.CommandName == "View") { Session["BusinessID"] = lblID.Text; Response.Redirect("VerifyBusiness.aspx"); } }
protected void gvPayment_RowCommand(object sender, GridViewCommandEventArgs e) { string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' }); lblID.Text = commandArgs[0]; string YearID = commandArgs[1]; if (e.CommandName == "Ed") { GetPayment(lblID.Text); } else if (e.CommandName == "Del") { using (ConClass obj = new ConClass()) { obj.execNonQuery("Delete from payment where ID=" + lblID.Text); gvPayment.DataBind(); } } else if (e.CommandName == "Print") { Response.Redirect(@"~/Reports/Tarufa3.aspx?ID=" + lblID.Text); } }
void LoadForm(string code) { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select BusinessName,OwnerName,FatherName,Gender,Tazkira, dbo.topersianDate(ApplicationDate) as ApplicationDate,GroupID,BusinessClassID,BusinessCategoryID, ProvinceID,DistrictID,Street,Address,Phone,Email,ShopNumber,Website,Photo,Code,LessThan6 from business where ID=" + code); if (dt.Rows.Count > 0) { txtCode.Value = dt.Rows[0]["Code"].ToString(); txtID.Value = code; Session["BusinessID"] = code; txtEName.Value = dt.Rows[0]["BusinessName"].ToString(); txtOwnerName.Value = dt.Rows[0]["OwnerName"].ToString(); txtFatherName.Value = dt.Rows[0]["FatherName"].ToString(); ddlGender.SelectedValue = dt.Rows[0]["Gender"].ToString(); txtNID.Value = dt.Rows[0]["Tazkira"].ToString(); txtApplicationDate.Value = dt.Rows[0]["ApplicationDate"].ToString(); ddlGroup.SelectedValue = dt.Rows[0]["GroupID"].ToString(); BindGroupDDL(dt.Rows[0]["GroupID"].ToString()); ddlClass.SelectedValue = dt.Rows[0]["BusinessClassID"].ToString(); ddlCategory.SelectedValue = dt.Rows[0]["BusinessCategoryID"].ToString(); ddlProvince.SelectedValue = dt.Rows[0]["ProvinceID"].ToString(); BindDistrict(); ddlDistrict.SelectedValue = dt.Rows[0]["DistrictID"].ToString(); txtStreet.Value = dt.Rows[0]["Street"].ToString(); txtAddress.Value = dt.Rows[0]["Address"].ToString(); txtPhone.Value = dt.Rows[0]["Phone"].ToString(); txtEmail.Value = dt.Rows[0]["Email"].ToString(); txtShopNumber.Value = dt.Rows[0]["ShopNumber"].ToString(); txtWebsite.Value = dt.Rows[0]["Website"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["LessThan6"].ToString())) { if (dt.Rows[0]["LessThan6"].ToString() == "True") { chkLessThan6.Checked = true; } else { chkLessThan6.Checked = false; } } if (!string.IsNullOrEmpty(dt.Rows[0]["Photo"].ToString()))// != null) { byte[] bytes = (byte[])dt.Rows[0]["Photo"]; string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); Image1.ImageUrl = "data:image/jpg;base64," + base64String; Image1.Visible = true; } //if (HttpContext.Current.User.IsInRole("Entry")) //{ // btnSave.Enabled = false; // // System.Windows.Forms.MessageBox.Show("Test"); //} btnPrint.Enabled = true; } dt.Dispose(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
void LoadForm() { try { using (ConClass obj = new ConClass()) { DataTable dt = obj.Selectdt(@"select b.*,g.name_local as BusinessGroup,c.Name_local as Class,ct.Name_local as Category,p.Name_Local as Province,d.Name_local as District, dbo.ToPersianDate(isnull(b.assessmentDate,'')) as AssessmentDate1,dbo.ToPersianDate(b.ApplicationDate) as ApplicationDate1, a.Name_local as ApprovalStatus,gn.Name_local as Gender1 from business b left outer join zBusinessGroup g on g.ID=b.GroupID left outer join zBusinessClass c on c.ID=b.BusinessClassID left outer join zBusinessCategory ct on ct.ID=b.BusinessCategoryID left outer join zGender gn on gn.ID=b.Gender left outer join zProvince p on p.ID=b.ProvinceID left outer join zDistrict d on d.id=b.DistrictID left outer join zApprovalStatus a on a.id=b.ApprovalStatusID where b.ID=" + Session["BusinessID"].ToString()); if (dt.Rows.Count > 0) { lblCode.Text = dt.Rows[0]["Code"].ToString(); lblBusinessName.Text = dt.Rows[0]["BusinessName"].ToString(); lblOwnername.Text = dt.Rows[0]["Ownername"].ToString(); lblFatherName.Text = dt.Rows[0]["FatherName"].ToString(); lblGender.Text = dt.Rows[0]["Gender1"].ToString(); lblTazkira.Text = dt.Rows[0]["Tazkira"].ToString(); lblApplicationDate.Text = dt.Rows[0]["ApplicationDate1"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["Photo"].ToString())) { byte[] bytes = (byte[])dt.Rows[0]["Photo"]; string base64String = Convert.ToBase64String(bytes, 0, bytes.Length); Image1.ImageUrl = "data:image/jpg;base64," + base64String; } lblGroup.Text = dt.Rows[0]["BusinessGroup"].ToString(); lblClass.Text = dt.Rows[0]["Class"].ToString(); lblCategory.Text = dt.Rows[0]["Category"].ToString(); lblProvince.Text = dt.Rows[0]["Province"].ToString(); lblDistrict.Text = dt.Rows[0]["District"].ToString(); lblStreet.Text = dt.Rows[0]["Street"].ToString(); lblPhone.Text = dt.Rows[0]["Phone"].ToString(); lblAddress.Text = dt.Rows[0]["Address"].ToString(); lblEmail.Text = dt.Rows[0]["Email"].ToString(); lblShopNumber.Text = dt.Rows[0]["ShopNumber"].ToString(); lblWebsite.Text = dt.Rows[0]["Website"].ToString(); lblAssessmentDate.Text = dt.Rows[0]["AssessmentDate1"].ToString(); lblApprovalStatus.Text = dt.Rows[0]["ApprovalStatus"].ToString(); lblRemarks.Text = dt.Rows[0]["ApprovalRemarks"].ToString(); lblApprovedBy.Text = dt.Rows[0]["ApprovedBy"].ToString(); lblCapital.Text = dt.Rows[0]["Capital"].ToString(); lblAnnualSales.Text = dt.Rows[0]["AnnualSales"].ToString(); lblMale.Text = dt.Rows[0]["EmployeeMale"].ToString(); lblFemale.Text = dt.Rows[0]["EmployeeFemale"].ToString(); lblX.Text = dt.Rows[0]["Latitude"].ToString(); lblY.Text = dt.Rows[0]["Longitude"].ToString(); } dt.Dispose(); } } catch (Exception) { } }