public static string savedata(string nid, string projectid, string budgetTitle, string createdby, string companyid, string tbl, string isimport)
        {
            string result = "";
            int    status = 1;

            if (projectid == "" || budgetTitle == "")
            {
                status = 0;
                result = @"[{""result"":""0"",""msg"":""Please fill required fields""}]";
            }
            if (status == 1)
            {
                ClsTimeSheet  objda  = new ClsTimeSheet();
                DataSet       ds     = new DataSet();
                GeneralMethod objgen = new GeneralMethod();
                DataTable     dt     = new DataTable();

                dt              = objgen.deserializetoDataTable(tbl);
                objda.nid       = nid;
                objda.title     = budgetTitle;
                objda.projectid = projectid;
                objda.companyId = companyid;
                objda.CreatedBy = createdby;
                objda.Status    = isimport;
                ds              = objda.Budget_Insert(dt);
                result          = @"[{""result"":""1"",""msg"":""""}]";
            }

            return(result);
        }
        public static string saveinvoice(string nid, string invoiceno, string invoicedate, string companyid, string projectid, string subtotal, string taxamount, string totalamount, string discount, string amountpaid, string dueamount, string address, string userid, string invoicedetail, string memo, string markbilled, string taxid, string taxpercent, string invoicetype, string retainage, string contactperson, string street2, string state, string city, string country, string zip, string billedtask)
        {
            ClsTimeSheet  objts  = new ClsTimeSheet();
            GeneralMethod objgen = new GeneralMethod();
            DataSet       ds     = new DataSet();
            DataTable     dt     = new DataTable();
            string        msg    = "success";

            try
            {
                if (subtotal == "")
                {
                    subtotal = "0.00";
                }
                if (discount == "")
                {
                    discount = "0.00";
                }
                if (taxamount == "")
                {
                    taxamount = "0.00";
                }
                if (amountpaid == "")
                {
                    amountpaid = "0.00";
                }
                if (dueamount == "")
                {
                    dueamount = "0.00";
                }
                if (retainage == "")
                {
                    retainage = "0.00";
                }
                objts.nid         = nid;
                objts.invoiceno   = invoiceno;
                objts.date        = invoicedate;
                objts.companyId   = companyid;
                objts.projectid   = projectid;
                objts.subamount   = subtotal;
                objts.tax         = taxamount;
                objts.totalamount = totalamount;
                objts.discount    = discount;
                objts.retainage   = "0.00";
                objts.amountpaid  = amountpaid;
                objts.dueamount   = dueamount;
                objts.description = address;
                objts.CreatedBy   = userid;
                objts.remark      = memo;
                objts.isbilled    = markbilled;
                objts.taxid       = taxid;
                objts.taxpercent  = taxpercent;
                objts.type        = invoicetype;
                objts.retainage   = retainage;

                objts.contact  = contactperson;
                objts.address2 = street2;
                objts.city     = city;
                objts.state    = state;
                objts.country  = country;
                objts.zip      = zip;

                objts.taskid = billedtask;
                dt           = objgen.deserializetoDataTable(invoicedetail);
                ds           = objts.insertInvoice(dt);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["nid"].ToString() == "0")
                            {
                                msg = "Already Exists";
                            }
                        }
                    }
                }
                return(msg);
            }
            catch (Exception ex)
            {
                msg = ex.Message.ToString();
                return(msg);
            }
        }