/// <summary>
        /// Creates a Xero line item for every Aquairum line item with a matching Invoice number,  and bundles them up into a Xero invoice
        /// </summary>
        /// <param name="theInvoiceLineItemToConvert"></param>
        /// <returns></returns>
        public static XeroApi.Model.Invoice ConvertMultipleOutboundInvoiceLineItemsToXeroInvoice(OutboundInvoiceLineItemList theInvoiceLineItemsToConvert, OutboundInvoiceLineItem theLineItemToMatchTo, Datalayer.Xero.Interresolve.InterResolveXeroService aService)
        {
            try
            {
                XeroApi.Model.Invoice theInvoiceToReturn = new XeroApi.Model.Invoice();
                theInvoiceToReturn.LineItems = new XeroApi.Model.LineItems();
                theInvoiceToReturn.Contact = new XeroApi.Model.Contact(); //NEED TO SPECIFY A CONTACT

                //assign the xero contact
                aService.LoginToXero();
                theInvoiceToReturn.Contact = aService.GetXeroContactFromAquariumInvoiceLineItemList(theLineItemToMatchTo);

                //assign top level invoice fields for the passed invoice to the Xero counterpart
                theInvoiceToReturn.InvoiceNumber = theLineItemToMatchTo.InvoiceNumber.ToString();
                theInvoiceToReturn.Status = "DRAFT";
                theInvoiceToReturn.Type = "ACCREC"; //Sales invoice
                theInvoiceToReturn.Reference = theLineItemToMatchTo.SageNarrative + " " + theLineItemToMatchTo.YourRef;
                theInvoiceToReturn.LineAmountTypes = XeroApi.Model.LineAmountType.Exclusive;
                theInvoiceToReturn.SubTotal = theLineItemToMatchTo.OriginalPurchaseInvoiceTotal;
                theInvoiceToReturn.DueDate = DateTime.Now.AddDays(14);
                theInvoiceToReturn.Date = theLineItemToMatchTo.InvoiceDate;
               // theInvoiceToReturn.TotalTax //this must be calculated AFTER by summing all the line item VATs
                theInvoiceToReturn.Total = theLineItemToMatchTo.OriginalPurchaseInvoiceTotal;

                //iterate through and if number matches specified invoice number, add it to the list
                decimal RunningVATTotalForInvoice = new decimal(0.00);

                for (int i = 0; i < theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.Count(); i++)
                {
                    if (theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i).InvoiceNumber == theLineItemToMatchTo.InvoiceNumber)
                    {
                         //if the invoice numbers match, create a new line item and add this line item to the list
                        XeroApi.Model.LineItem aLineItem = new XeroApi.Model.LineItem();
                        aLineItem.Quantity = 1; //always one line item
                        aLineItem.Description = theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i).InvoiceType; //
                        aLineItem.UnitAmount = theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i).OriginalPurchaseInvoiceAmount;
                        aLineItem.TaxAmount = theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i).OriginalPurchaseInvoiceVAT;
                        aLineItem.LineAmount = (aLineItem.Quantity * aLineItem.UnitAmount);
                        aLineItem.AccountCode = InterResolveXeroService.GetXeroAccountCodeForAquariumLineItem(theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i));

                        //add the VAT to the running total
                        RunningVATTotalForInvoice =+ theInvoiceLineItemsToConvert.OutboundInvoiceLineItems.ElementAt(i).OriginalPurchaseInvoiceVAT;

                        //add it to the list
                        theInvoiceToReturn.LineItems.Add(aLineItem);
                     }

                 }

                //assign the overall invoice VAT
                theInvoiceToReturn.TotalTax = RunningVATTotalForInvoice;

                return theInvoiceToReturn;
                }

            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable QueryInvoices(CustomProcessingSoapClient customSdk, Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails sessionDetails, AquariumInvoiceTypeToQuery theInvoiceType)
        {
            DataTable TableToReturn = new DataTable();
            string ProcName = "";

            switch(theInvoiceType)
            {
                case AquariumInvoiceTypeToQuery.InboundInvoice:
                    ProcName = System.Configuration.ConfigurationManager.AppSettings["_C74_Xero_GetInboundInvoiceData"].ToString();
                    break;

                case AquariumInvoiceTypeToQuery.OutboundInvoice:
                    ProcName = System.Configuration.ConfigurationManager.AppSettings["_C74_Xero_GetInvoiceData"].ToString();
                    break;

            }

            string[] ProcParm = null;

            ReportResult result = new ReportResult();

            result = customSdk.RunCustomProc(sessionDetails, ProcName, ProcParm);

            if (result.ResultInfo.ReturnCode == Datalayer.Xero.Interresolve.AquariumCustomProcessing.BasicCode.OK)
            {
                TableToReturn = SDKGeckoboardHelper.GetDataTableFromSdkResult(result.Data.Columns, result.Data.Rows);
                return TableToReturn;
            }

            else
            {
                Exception ex = new Exception("There has been a problem in the QueryInvoices method in the invoice helper class");
                throw ex;
            }
        }
Exemple #3
0
        public StartCentre()
        {
            InitializeComponent();

            Datalayer dl = Datalayer.Instance;

            dl.Open();

            lblSite.Text = String.Format("{0} Workorder Backlog Prioritisation", dl.Site);

            DataPointCollection pc = progressPie.Series[0].Points;
            DataPoint           p  = null;
            Button b = null;

            DataSet prog = dl.GetProgressSummary();

            foreach (DataRow row in prog.Tables["Progress"].Rows)
            {
                AssessmentStatus status = AssessmentStatuses.GetStatus(row["AssessmentStatus"].ToString());
                switch (status)
                {
                case AssessmentStatus.New:
                    p       = pc[0];
                    p.Color = Color.Orange;
                    b       = btnNew;
                    break;

                case AssessmentStatus.Completed:
                    p       = pc[1];
                    p.Color = Color.SeaGreen;
                    b       = btnComp;
                    break;

                case AssessmentStatus.Cancelled:
                    p       = pc[2];
                    p.Color = Color.Crimson;
                    b       = btnCan;
                    break;
                }
                p.AxisLabel  = AssessmentStatuses.GetStatusDescription(status);
                p.YValues[0] = double.Parse(row["WoCount"].ToString());
                b.Text       = p.AxisLabel;
                b.BackColor  = p.Color;
                b.Tag        = p.Tag = status;
            }

            progressPie.Invalidate();
            progressPie.Update();

            priorityChart.Series[0].Points[0].Color = Color.PaleTurquoise;
            priorityChart.Series[0].Points[1].Color = Color.MediumAquamarine;
            priorityChart.Series[0].Points[2].Color = Color.Teal;
            priorityChart.Series[0].Points[3].Color = Color.DarkSlateGray;
        }
        public void PhotoBag()
        {
            Property  p  = new Property();
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();

            p.Condition1 = "5";
            p.Condition2 = "";
            p.Condition3 = "";
            p.onTable    = "FETCH_HOME_CONTENT";
            ds           = dl.FETCH_CONDITIONAL_QUERY(p);
            List <Property> Photo = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Property p1 = new Property();
                    p1.id          = ds.Tables[0].Rows[i]["id"].ToString();
                    p1.Title       = ds.Tables[0].Rows[i]["Title"].ToString();
                    p1.URLTitle    = ds.Tables[0].Rows[i]["URL"].ToString();
                    p1.Description = ds.Tables[0].Rows[i]["Description"].ToString();

                    Regex rstr = new Regex("<(.|\n)*?>");
                    if (rstr.IsMatch(p1.Description))
                    {
                        p1.Description = rstr.Replace(p1.Description, "");
                    }
                    if (p1.Description.Length >= 100)
                    {
                        p1.Description = p1.Description.Substring(0, 100) + "...";
                    }
                    else
                    {
                        p1.Description = p1.Description;
                    }
                    p1.ThumbImgURL = ds.Tables[0].Rows[i]["ThumbImgURL"].ToString().Replace("~", "");
                    p1.ImgURL      = ds.Tables[0].Rows[i]["ImgURL"].ToString().Replace("~", "");
                    Photo.Add(p1);
                }
            }
            else
            {
                Property p1 = new Property();
                p1.id    = "0";
                p1.Title = "NONE";

                p1.Description = "NONE";
                Photo.Add(p1);
            }

            ViewBag.PhotoList = Photo;
        }
Exemple #5
0
 public JsonResult Getalluser()
 {
     try
     {
         Datalayer        dl       = new Datalayer();
         List <UserModel> userlist = dl.getusers();
         return(Json(userlist));
     }
     catch (Exception ex)
     {
         return(Json(new { status = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
        public void Updatemodel(DataGridView drv)
        {
            Datalayer d1 = new Datalayer();

            foreach (DataGridViewRow row in drv.Rows)
            {
                if (!row.IsNewRow)
                {
                    d1.Updatemodel(row.Cells["Company_Name"].Value + "", row.Cells["Mod_Name"].Value + "", row.Cells["Mod_Quantity"].Value + "", row.Cells["Mod_Sell_Cost"].Value + "", row.Cells["Ram"].Value + "", row.Cells["CPU"].Value + "", row.Cells["Internal_Storage"].Value + "", row.Cells["Screen_Size"].Value + "", row.Cells["Primary_Camera"].Value + "", row.Cells["Secondry_Camera"].Value + "");
                    MessageBox.Show("Update Operation is Completed");
                }
            }
        }
        public void companyCheck(DataGridView drv)
        {
            Datalayer d1 = new Datalayer();

            foreach (DataGridViewRow row in drv.Rows)
            {
                if (!row.IsNewRow)
                {
                    d1.companyCheck(row.Cells["Company_Name"].Value + "", row.Cells["mod_Serial"].Value + "");
                    MessageBox.Show("Update Operation is Completed");
                }
            }
        }
        public void UpdateCust(DataGridView drv)
        {
            Datalayer dl = new Datalayer();

            foreach (DataGridViewRow row in drv.Rows)
            {
                if (!row.IsNewRow)
                {
                    dl.UpdateCust(row.Cells["SSN"].Value + "", row.Cells["Name"].Value + "", row.Cells["Phone"].Value + "", row.Cells["Email"].Value + "");
                    MessageBox.Show("Update Operation is Completed");
                }
            }
        }
Exemple #9
0
        private void frmCustomerBalance_Load(object sender, EventArgs e)
        {
            Datalayer.SetButtion(btnSearch);
            Datalayer.SetButtion(btnClear);
            Datalayer.SetSoftwareThems(pnlHeader, pnlFooter);

            dbo.FillAccountList(cmbName, "c");

            if (cmbName.Items.Count > 0)
            {
                cmbName.SelectedIndex = -1;
            }
        }
        public void Vedio()
        {
            Property  p  = new Property();
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();

            p.Condition1 = "";
            p.Condition2 = "";
            p.Condition3 = "";
            p.onTable    = "FETCH_VEDIO_CONTENT";
            ds           = dl.FETCH_CONDITIONAL_QUERY(p);
            List <Property> Detail = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Property p1 = new Property();
                    p1.id          = ds.Tables[0].Rows[i]["id"].ToString();
                    p1.Title       = ds.Tables[0].Rows[i]["Title"].ToString();
                    p1.URLTitle    = ds.Tables[0].Rows[i]["URL"].ToString();
                    p1.Description = ds.Tables[0].Rows[i]["Description"].ToString();
                    p1.Menu        = ds.Tables[0].Rows[i]["MenuID"].ToString();
                    Regex rstr = new Regex("<(.|\n)*?>");
                    if (rstr.IsMatch(p1.Description))
                    {
                        p1.Description = rstr.Replace(p1.Description, "");
                    }
                    if (p1.Description.Length >= 1000)
                    {
                        p1.Description = p1.Description.Substring(0, 1000) + "...";
                    }
                    else
                    {
                        p1.Description = p1.Description;
                    }

                    Detail.Add(p1);
                }
            }
            else
            {
                Property p1 = new Property();
                p1.id          = "0";
                p1.Title       = "NONE";
                p1.Description = "NONE";
                Detail.Add(p1);
            }

            ViewBag.vediocontentlist = Detail;
        }
        public bool IsSSNExist(String CustomerSSN)
        {
            Datalayer       dl = new Datalayer();
            MySqlDataReader dr = dl.Select(null, "customer", "SSN", CustomerSSN);

            if (dr.Read())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #12
0
        private void loginB_Click(object sender, EventArgs e)
        {
            String res = bl.LoginCheck(user.Text, password.Text);
            ///MessageBox.Show(Global.BillNo+"");
            ///

            //MessageBox.Show(Global.BillNo + "-------"+Global.Time+"----");


            bool bo = true;

            if (res == null)
            {
                bo = false;
                MessageBox.Show("Invalid Username or Password");
            }
            else if (res.Equals("admin"))
            {
                this.Parent.Parent.Hide();
                Form2 adminF = new Form2();
                adminF.Show();
            }
            else
            {
                this.Parent.Parent.Hide();
                Form1 empF = new Form1();
                empF.Show();
            }
            if (bo)
            {
                MySqlDataReader dr = new Datalayer().GetMaxDate();
                dr.Read();
                Global.Time   = Convert.ToDateTime(dr.GetString(0));
                Global.BillNo = Convert.ToInt32(dr.GetString(1));
            }

            //if (Global.Time.Day != DateTime.Now.Day || Global.Time.Month != DateTime.Now.Month || Global.Time.Year != DateTime.Now.Year)
            //{
            //    //MessageBox.Show("Hoba");
            //    Global.BillNo = 1;
            //}
            //else
            //{
            //    Global.BillNo++;
            //}


            //Global.Time = DateTime.Now;
        }
Exemple #13
0
        private void tsbCount_Click(object sender, EventArgs e)
        {
            Datalayer d = Datalayer.Instance;

            try
            {
                Properties.Settings s = Properties.Settings.Default;

                statusLabel.Text = String.Format("Locations {0}", d.Open(s.OraUsername, s.OraPassword, s.OraTNS));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public List <string> SearchComboBoxItems(String Table)
        {
            Datalayer       dl      = new Datalayer();
            MySqlDataReader dr      = dl.GetComboBoxItems(Table);
            List <string>   ColName = new List <string>();

            for (int i = 0; i < dr.FieldCount; i++)
            {
                if (!dr.GetName(i).Equals("Type") && !dr.GetName(i).Equals("ssnImage"))
                {
                    ColName.Add(dr.GetName(i));
                }
            }
            dr.Close();
            return(ColName);
        }
        public void InsertCust(String username, String Phone, String SSN, String Email, String fileName)
        {
            Datalayer dl       = new Datalayer();
            string    FileName = fileName;

            byte[]       ImageData;
            FileStream   fs;
            BinaryReader br;

            fs        = new FileStream(FileName, FileMode.Open, FileAccess.Read);
            br        = new BinaryReader(fs);
            ImageData = br.ReadBytes((int)fs.Length);
            br.Close();
            fs.Close();
            dl.insertCust(username, Phone, SSN, Email, ImageData);
        }
Exemple #16
0
        /// <summary>
        /// This would save the Personal details in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ClassLibrary.MainClasses.PersonalDetails personalDetails = new ClassLibrary.MainClasses.PersonalDetails();
            personalDetails.address1      = txtAddress1.Text;
            personalDetails.address2      = txtaddress2.Text;
            personalDetails.address3      = txtaddress3.Text;
            personalDetails.adhaarNumber  = txtAdharrNumber.Text;
            personalDetails.age           = txtAge.Text;
            personalDetails.attendanceId  = Int32.Parse(txtattendanceid.Text);
            personalDetails.emialaddress  = txtEmailAddress.Text;
            personalDetails.employeeID    = Int32.Parse(txtempid.Text);
            personalDetails.EmployeeName  = txtempname.Text;
            personalDetails.passportNumer = txtPassPortNumber.Text;
            personalDetails.age           = txtAge.Text;
            personalDetails.fatherName    = txtFathersName.Text;
            personalDetails.phone1        = txtphone1.Text;
            personalDetails.phone2        = txtphone2.Text;
            personalDetails.phone3        = txtphone3.Text;
            personalDetails.panNumber     = txtPannumber.Text;
            Datalayer dl  = new Datalayer();
            Response  res = dl.PersonalDetailsInTheDataBAse(personalDetails);

            if (res.success)
            {
                MessageBox.Show("Details Saved");
                txtAddress1.Text       = "";
                txtaddress2.Text       = "";
                txtaddress3.Text       = "";
                txtAdharrNumber.Text   = "";
                txtAge.Text            = "";
                txtattendanceid.Text   = "";
                txtEmailAddress.Text   = "";
                txtempid.Text          = "";
                txtempname.Text        = "";
                txtPassPortNumber.Text = "";
                txtAge.Text            = "";
                txtFathersName.Text    = "";
                txtphone1.Text         = "";
                txtphone2.Text         = "";
                txtphone3.Text         = "";
                txtPannumber.Text      = "";
            }
            else if (res.isException)
            {
                MessageBox.Show("Exception occured : " + res.exception);
            }
        }
Exemple #17
0
        void PopualteData()
        {
            string TM02_PARTYID  = "";
            int    iTM02_PARTYID = 0;

            if (!string.IsNullOrEmpty(cmbName.Text.Trim()))
            {
                int.TryParse(cmbName.SelectedValue.ToString(), out iTM02_PARTYID);
            }

            if (iTM02_PARTYID > 0)
            {
                TM02_PARTYID = iTM02_PARTYID.ToString();
            }

            DAL       dl = new DAL();
            DataTable dt = new DataTable();

            dt = dl.SelectMethod("exec USP_VP_GET_CUSTOMER_BAL_SUMMARY '" + TM02_PARTYID + "','" + Datalayer.iT001_COMPANYID + "'");
            if (dt.Rows.Count > 0)
            {
                DataTable dt1 = new DataTable();
                DataRow[] dr  = dt.Select("TOTALSALE >0 ");
                if (dr.Length > 0)
                {
                    dt1 = dr.CopyToDataTable();
                }

                ReportDocument RptDoc = new ReportDocument();

                RptDoc.Load(Application.StartupPath + @"\Report\rptCustomerBalSummary.rpt");
                RptDoc.SetDataSource(dt1);

                Datalayer.RptReport   = RptDoc;
                Datalayer.sReportName = "Customer Balance Report";

                Report.frmReportViwer fmReport = new Report.frmReportViwer();
                fmReport.Show();
            }
            else
            {
                Datalayer.InformationMessageBox("No Record..");
            }
        }
        public void ListMenu()
        {
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();
            Property  p1 = new Property();

            p1.Condition1 = "";
            p1.Condition2 = "";
            p1.Condition3 = "";
            p1.onTable    = "LIST_MENU";

            ds = dl.FETCH_CONDITIONAL_QUERY(p1);

            List <Property> Menu = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Property p = new Property();
                    p.id = ds.Tables[0].Rows[i]["id"].ToString();

                    p.Menu = ds.Tables[0].Rows[i]["Menu"].ToString();

                    p.URLTitle = ds.Tables[0].Rows[i]["URL"].ToString();
                    Menu.Add(p);
                }
            }
            else
            {
                Property p = new Property();
                p.id = "0";

                p.Menu = "NONE";

                p.URLTitle = "NONE";
                Menu.Add(p);
            }



            ViewBag.MenuList = Menu;
        }
Exemple #19
0
        public string EMAILID_CHECK(string Id)
        {
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();
            Property  p1 = new Property();

            p1.Condition1 = Id;
            p1.Condition2 = "";
            p1.onTable    = "EMAIL_CHECK";
            ds            = dl.FETCH_CONDITIONAL_QUERY(p1);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return("Email ID Already Exists.");
            }
            else
            {
                return("Available");
            }
        }
Exemple #20
0
 private void populateYears()
 {
     try
     {
         Datalayer dl  = new Datalayer();
         Response  res = dl.getallYears();
         if (res.success)
         {
             String[] YearName = (String[])res.body;
             cmbselectyear.ItemsSource = YearName;
         }
         else if (res.isException)
         {
             MessageBox.Show("Exception in populationg the Month names " + res.exception);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception on the front Page" + ex);
     }
 }
Exemple #21
0
        public ActionResult Menu(Property p)
        {
            Datalayer dl = new Datalayer();

            try
            {
                p.id = "0";

                if (dl.INSERT_MENU(p) > 0)
                {
                    TempData["MSG"] = "Record Saved Successfully!";
                    ModelState.Clear();
                }
            }
            catch (Exception ex)
            {
                TempData["MSG"] = ex.ToString();
            }

            return(RedirectToAction("Menu"));
        }
Exemple #22
0
        public ActionResult Menu()
        {
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();
            Property  p1 = new Property();

            p1.Condition1 = "";
            p1.Condition2 = "";
            p1.Condition3 = "";
            p1.onTable    = "MAIN_MENU";
            ds            = dl.FETCH_CONDITIONAL_QUERY(p1);
            List <Property> Menu = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Property p = new Property();

                    p.id       = ds.Tables[0].Rows[i]["id"].ToString();
                    p.Menu     = ds.Tables[0].Rows[i]["Menu"].ToString();
                    p.Position = ds.Tables[0].Rows[i]["Position"].ToString();
                    p.Status   = ds.Tables[0].Rows[i]["Status"].ToString();
                    Menu.Add(p);
                }
            }
            else
            {
                Property p = new Property();
                p.id       = "0";
                p.Menu     = "NONE";
                p.Position = "NONE";
                p.Status   = "NONE";

                Menu.Add(p);
            }

            ViewBag.MenuList = Menu;
            return(View());
        }
        public void HomeContent(string Id)
        {
            Property  p  = new Property();
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();

            p.Condition1 = Id;
            p.Condition2 = "";
            p.Condition3 = "";
            p.onTable    = "FETCH_HOME_CONTENT";
            ds           = dl.FETCH_CONDITIONAL_QUERY(p);
            List <Property> Detail = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    p.id          = ds.Tables[0].Rows[i]["id"].ToString();
                    p.Title       = ds.Tables[0].Rows[i]["Title"].ToString();
                    p.Menu        = ds.Tables[0].Rows[i]["Menu"].ToString();
                    p.Description = ds.Tables[0].Rows[i]["Description"].ToString();
                    p.ThumbImgURL = ds.Tables[0].Rows[i]["ThumbImgURL"].ToString().Replace("~", "");
                    p.ImgURL      = ds.Tables[0].Rows[i]["ImgURL"].ToString().Replace("~", "");


                    Detail.Add(p);
                }
            }
            else
            {
                p.id          = "0";
                p.Title       = "NONE";
                p.Menu        = "NONE";
                p.Description = "NONE";
                Detail.Add(p);
            }

            ViewBag.contentlist = Detail;
        }
Exemple #24
0
 private void populateMonths()
 {
     try
     {
         Datalayer dl  = new Datalayer();
         Response  res = dl.getallMonths();
         if (res.success)
         {
             String[] Monthnames = (String[])res.body;
             cmbselectMonth.ItemsSource = Monthnames;
             //cmbselectMonth.DisplayMemberPath = "Monthnames";
         }
         else if (res.isException)
         {
             MessageBox.Show("Exception in populationg the Month names " + res.exception);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception on the front Page" + ex);
     }
 }
Exemple #25
0
        public ActionResult Detail(string id)
        {
            ListMenu();
            Property  p1 = new Property();
            DataSet   ds = new DataSet();
            Datalayer dl = new Datalayer();

            try
            {
                p1.Condition1 = id;
            }
            catch
            {
                p1.Condition1 = "";
            }
            p1.Condition2 = "";
            p1.Condition3 = "";
            p1.onTable    = "FETCH_DETAIL";

            ds = dl.FETCH_CONDITIONAL_QUERY(p1);
            if (ds.Tables[0].Rows.Count > 0)
            {
                TempData["Found"] = "1";
                var info = new collegedaze.Models.Property()
                {
                    id          = ds.Tables[0].Rows[0]["id"].ToString(),
                    Title       = ds.Tables[0].Rows[0]["Title"].ToString(),
                    Description = ds.Tables[0].Rows[0]["Description"].ToString(),
                    ImgURL      = ds.Tables[0].Rows[0]["ImgURL"].ToString().Replace("~", ""),
                };

                return(View(info));
            }
            else
            {
                TempData["MSG"] = "Invalid ID!!!";
                return(Redirect("/"));
            }
        }
        public String LoginCheck(String username, String password)
        {
            Datalayer       dl = new Datalayer();
            MySqlDataReader dr = dl.LoginCheck(username, password);

            if (dr.Read())
            {
                Global.GlobalVar = dr["SSN"].ToString();

                if (dr["Type"].Equals("admin"))
                {
                    return("admin");
                }
                else
                {
                    return("emp");
                }
            }
            else
            {
                return(null);
            }
        }
Exemple #27
0
 public void populateEmployees()
 {
     try
     {
         Datalayer dl  = new Datalayer();
         Response  res = dl.fetchallEmployees();
         if (res.success)
         {
             List <Employee> employees = (List <Employee>)res.body;
             cmbEmployees.ItemsSource       = employees;
             cmbEmployees.DisplayMemberPath = "employeeNameToshow";
             // cmbEmployeeName.SelectionChanged += cmbEmployeeName_SelectionChanged;
         }
         else if (res.isException)
         {
             MessageBox.Show("Exception while populating companies : " + res.exception);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show("Exception in populate companies cmb : " + exception);
     }
 }
        public ActionResult Home()
        {
            Property p = new Property();

            p.Condition1 = "HOME";
            p.Condition2 = "";
            p.Condition3 = "";
            p.onTable    = "HOME_CONTENT";

            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();

            ds = dl.FETCH_CONDITIONAL_QUERY(p);

            var home = new collegedaze.Models.Property()
            {
                id          = ds.Tables[0].Rows[0]["id"].ToString(),
                Title       = ds.Tables[0].Rows[0]["Title"].ToString(),
                Description = ds.Tables[0].Rows[0]["Description"].ToString(),
            };

            return(View(home));
        }
        public void SliderBag()
        {
            Property  p  = new Property();
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();

            p.Condition1 = "9";
            p.Condition2 = "";
            p.Condition3 = "";
            p.onTable    = "FETCH_HOME_CONTENT";
            ds           = dl.FETCH_CONDITIONAL_QUERY(p);
            List <Property> Photo = new List <Property>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Property p1 = new Property();
                    p1.id          = ds.Tables[0].Rows[i]["id"].ToString();
                    p1.Title       = ds.Tables[0].Rows[i]["Title"].ToString();
                    p1.URLTitle    = ds.Tables[0].Rows[i]["URL"].ToString();
                    p1.Description = ds.Tables[0].Rows[i]["Description"].ToString();
                    p1.ImgURL      = ds.Tables[0].Rows[i]["ImgURL"].ToString().Replace("~", "");
                    Photo.Add(p1);
                }
            }
            else
            {
                Property p1 = new Property();
                p1.id          = "0";
                p1.Title       = "NONE";
                p1.Description = "NONE";
                Photo.Add(p1);
            }

            ViewBag.SliderList = Photo;
        }
        //returns two 'out' parameters = the custom session details and the user session details, which can be used with
        //both SDKs
        public static bool LoginToAquariumAndCreateUserAndCustomSDKHelpersInSession(out Datalayer.Xero.Interresolve.AquariumUserManagement.SessionDetails userSession, Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails customSession )
        {
            try
            {

                AquariumLogin login = new AquariumLogin();
                login.LoginToAquarium();

                LoggedOnUserResult theUserResult = login.GetLoggedOnUserResult();

                Datalayer.Xero.Interresolve.AquariumUserManagement.SessionDetails sessionDetails = new Datalayer.Xero.Interresolve.AquariumUserManagement.SessionDetails(); //set this from the logon

                //set the USER sesson
                sessionDetails.SessionKey = theUserResult.SessionKey;
                sessionDetails.Username = theUserResult.Username;
                sessionDetails.ThirdPartySystemId = 29;

                userSession = sessionDetails; //assign out param

                //map a custom session
                Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails customSessionDetails = new Datalayer.Xero.Interresolve.AquariumCustomProcessing.SessionDetails();
                customSessionDetails.SessionKey = sessionDetails.SessionKey;
                customSessionDetails.ThirdPartySystemId = 29;
                customSessionDetails.Username = theUserResult.Username;

                customSession = customSessionDetails; //assign out param

                return true;

            } catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult Delete()
        {
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();
            Property  p1 = new Property();

            string str = "";

            p1.ImgURL      = "";
            p1.ThumbImgURL = "";
            p1.id          = Request.QueryString["id"].ToString();
            p1.Condition1  = Request.QueryString["id"].ToString();
            p1.Condition2  = "";
            p1.Condition3  = "";

            if (Request.QueryString["type"].ToString() == "Content")
            {
                p1.onTable = "CONTENT_EDIT";
                str        = "DELETE FROM tbl_Content WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    p1.ImgURL      = ds.Tables[0].Rows[0]["ImgURL"].ToString();
                    p1.ThumbImgURL = ds.Tables[0].Rows[0]["ThumbImgURL"].ToString();
                }
                string completIMG    = Server.MapPath(p1.ImgURL);
                string completeThumb = Server.MapPath(p1.ThumbImgURL);
                try
                {
                    if (System.IO.File.Exists(completIMG))
                    {
                        System.IO.File.Delete(completIMG);
                    }
                    if (System.IO.File.Exists(completeThumb))
                    {
                        System.IO.File.Delete(completeThumb);
                    }
                }
                catch (Exception ex)
                {
                    TempData["MSG"] = ex.ToString();
                }
            }
            else if (Request.QueryString["type"].ToString() == "Contact")
            {
                p1.onTable = "CONTENT_EDIT";
                str        = "DELETE FROM tbl_Contact WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);
            }
            else if (Request.QueryString["type"].ToString() == "Multiple")
            {
                p1.onTable = "MULTIPLE_URL";
                str        = "DELETE FROM tbl_Multiple WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    p1.ImgURL      = ds.Tables[0].Rows[0]["ImgURL"].ToString();
                    p1.ThumbImgURL = ds.Tables[0].Rows[0]["ThumbImgURL"].ToString();
                }
                string completIMG    = Server.MapPath(p1.ImgURL);
                string completeThumb = Server.MapPath(p1.ThumbImgURL);
                try
                {
                    if (System.IO.File.Exists(completIMG))
                    {
                        System.IO.File.Delete(completIMG);
                    }
                    if (System.IO.File.Exists(completeThumb))
                    {
                        System.IO.File.Delete(completeThumb);
                    }
                }
                catch (Exception ex)
                {
                    TempData["MSG"] = ex.ToString();
                }
            }
            else
            {
                p1.onTable = "";
                str        = "";
            }

            SqlConnection con = new SqlConnection(p1.Con);

            con.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(str, con);
                int        i   = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    TempData["MSG"] = "Data Deleted Successfully!!!";
                }
                else
                {
                    TempData["MSG"] = "Record Not Deleted.";
                }
            }
            catch (Exception ex)
            {
                TempData["MSG"] = ex.ToString();
            }
            con.Close();


            if (Request.QueryString["type"].ToString() == "Content")
            {
                return(RedirectToAction("List", "Content"));
            }
            else if (Request.QueryString["type"].ToString() == "Contact")
            {
                return(RedirectToAction("Contact", "Content"));
            }

            else if (Request.QueryString["type"].ToString() == "Multiple")
            {
                return(RedirectToAction("Multiple", "Content"));
            }
            else
            {
                return(RedirectToAction("Index", "Admin"));
            }
        }
        public void DeleteRow(String table, String col, String val)
        {
            Datalayer dl = new Datalayer();

            dl.DeleteRow(table, col, val);
        }
Exemple #33
0
        public ActionResult Delete()
        {
            Datalayer dl = new Datalayer();
            DataSet   ds = new DataSet();
            Property  p1 = new Property();

            string str = "";

            p1.ImgURL      = "";
            p1.ThumbImgURL = "";
            p1.id          = Request.QueryString["id"].ToString();
            p1.Condition1  = Request.QueryString["id"].ToString();
            p1.Condition2  = "";
            p1.Condition3  = "";

            if (Request.QueryString["type"].ToString() == "Menu")
            {
                p1.onTable = "";
                str        = "DELETE FROM tbl_Menu WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);
            }

            else if (Request.QueryString["type"].ToString() == "SubMenu")
            {
                p1.onTable = "";
                str        = "DELETE FROM tbl_SubMenu WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);
            }
            else if (Request.QueryString["type"].ToString() == "SubMenuLevel")
            {
                p1.onTable = "";
                str        = "DELETE FROM tbl_SubMenu_Level2 WHERE id='" + p1.id + "'";
                ds         = dl.FETCH_CONDITIONAL_QUERY(p1);
            }
            else
            {
                p1.onTable = "";
                str        = "";
            }

            SqlConnection con = new SqlConnection(p1.Con);

            con.Open();
            try
            {
                SqlCommand cmd = new SqlCommand(str, con);
                int        i   = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    TempData["MSG"] = "Data Deleted Successfully!!!";
                }
                else
                {
                    TempData["MSG"] = "Record Not Deleted.";
                }
            }
            catch (Exception ex)
            {
                TempData["MSG"] = ex.ToString();
            }
            con.Close();


            if (Request.QueryString["type"].ToString() == "Menu")
            {
                return(RedirectToAction("Menu", "Settings"));
            }
            else if (Request.QueryString["type"].ToString() == "SubMenu")
            {
                return(RedirectToAction("SubMenu", "Settings"));
            }

            else if (Request.QueryString["type"].ToString() == "SubMenuLevel")
            {
                return(RedirectToAction("SubMenuLevel2", "Settings"));
            }
            else
            {
                return(RedirectToAction("Index", "Admin"));
            }
        }
 public Datalayer.Models.User AddUpdate(Datalayer.Models.User user, UserType type = UserType.User)
 {
     return _userRepository.AddUpdate(user, type);
 }