Exemplo n.º 1
0
    public static string InsertMethod_Vacant(object myData_vaccant)
    {
        string check                          = "";
        JavaScriptSerializer js               = new JavaScriptSerializer();
        List <jdata>         myformElement    = js.Deserialize <List <jdata> >(myData_vaccant.ToString());
        DataTable            dt_insertvaccant = new DataTable();

        dt_insertvaccant.Columns.Add("timestamp", typeof(string));
        dt_insertvaccant.Columns.Add("SeatID", typeof(string));
        dt_insertvaccant.Columns.Add("AuditNo", typeof(int));
        dt_insertvaccant.Columns.Add("ShowName", typeof(string));
        dt_insertvaccant.Columns.Add("ShowLocation", typeof(string));
        dt_insertvaccant.Columns.Add("ShowDate", typeof(string));
        dt_insertvaccant.Columns.Add("ShowTime", typeof(string));
        dt_insertvaccant.Columns.Add("Status", typeof(string));
        dt_insertvaccant.Columns.Add("Remark", typeof(string));
        dt_insertvaccant.Columns.Add("EditTime", typeof(DateTime));
        dt_insertvaccant.Columns.Add("SeatDescription", typeof(string));
        dt_insertvaccant.Columns.Add("IsCompleted", typeof(int));
        dt_insertvaccant.Columns.Add("Category", typeof(string));
        dt_insertvaccant.Columns.Add("ERPStatus", typeof(string));
        foreach (var vac in myformElement)
        {
            dt_insertvaccant.Rows.Add("", vac.SeatID, Convert.ToInt32(vac.AuditNo), vac.ShowName, vac.ShowLocation, DateTime.Now.ToString("dd/MM/yyyy"), vac.ShowTime, vac.Status, vac.Remark, DateTime.Now.ToString(), vac.SeatDescription, Convert.ToInt32(vac.Iscompleted), vac.Category, vac.ERPStatus);
            check = vac.SeatID.Substring(0, 1);
        }
        int i = GTICKBOL.Delete_audit(check);
        int j = GTICKBOL.Update_audit(dt_insertvaccant);

        if (j == 0)
        {
            return("false");
        }
        else
        {
            return("true");
        }
    }
Exemplo n.º 2
0
    public static string InsertMethod_Vacant(object myData_vaccant)
    {
        string check                          = "";
        JavaScriptSerializer js               = new JavaScriptSerializer();
        List <jdata>         myformElement    = js.Deserialize <List <jdata> >(myData_vaccant.ToString());
        DataTable            dt_insertvaccant = new DataTable();

        dt_insertvaccant.Columns.Add("timestamp", typeof(string));
        dt_insertvaccant.Columns.Add("SeatID", typeof(string));
        dt_insertvaccant.Columns.Add("AuditNo", typeof(int));
        dt_insertvaccant.Columns.Add("ShowName", typeof(string));
        dt_insertvaccant.Columns.Add("ShowLocation", typeof(string));
        dt_insertvaccant.Columns.Add("ShowDate", typeof(string));
        dt_insertvaccant.Columns.Add("ShowTime", typeof(string));
        dt_insertvaccant.Columns.Add("Status", typeof(string));
        dt_insertvaccant.Columns.Add("Remark", typeof(string));
        dt_insertvaccant.Columns.Add("EditTime", typeof(DateTime));
        dt_insertvaccant.Columns.Add("SeatDescription", typeof(string));
        dt_insertvaccant.Columns.Add("IsCompleted", typeof(int));
        dt_insertvaccant.Columns.Add("Category", typeof(string));
        dt_insertvaccant.Columns.Add("ERPStatus", typeof(string));
        foreach (var vac in myformElement)
        {
            dt_insertvaccant.Rows.Add("", vac.SeatID, Convert.ToInt32(vac.AuditNo), vac.ShowName, vac.ShowLocation, DateTime.Now.ToString("dd/MM/yyyy"), vac.ShowTime, vac.Status, vac.Remark, DateTime.Now.ToString(), vac.SeatDescription, Convert.ToInt32(vac.Iscompleted), vac.Category, vac.ERPStatus);
            check = vac.SeatID.Substring(0, 1);
        }
        int i = GTICKBOL.Delete_audit(check);
        int j = GTICKBOL.Update_audit(dt_insertvaccant);

        if (j == 0)
        {
            return("false");
        }
        else
        {
            return("true");
        }
        // SqlConnection connection = new SqlConnection("server=biztrack.co.in;database=MSTicketDB_Live_Latest;uid=sa;pwd=kranti123@123;");
        //SqlCommand cmd = new SqlCommand("delete from [dbo].[ShowAudit_Table] where SUBSTRING([SeatID], 1, 1)='"+check+"' and Iscompleted='" + 0 + "'", connection);
        ////try
        ////{
        ////    connection.Open();
        ////    cmd.ExecuteNonQuery();
        ////}
        ////catch (Exception ex)
        ////{
        ////    return "false";
        ////}
        ////finally
        ////{
        ////    connection.Close();
        ////}

        ////connection.Open();
        //using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connection))
        //{

        //    bulkCopy.DestinationTableName =
        //        "[dbo].[ShowAudit_Table]";

        //    try
        //    {
        //        bulkCopy.WriteToServer(dt_insertvaccant);
        //    }
        //    catch (Exception ex)
        //    {
        //        return "false";
        //    }
        //    finally
        //    {
        //        connection.Close();
        //    }
        //}
        //return "true";
    }