Beispiel #1
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        dao.ContentNotesDAO objcontent = new dao.ContentNotesDAO();

        Reportfunction obj1 = new Reportfunction();
        ArrayList      list = new ArrayList();

        objcontent.Scompanyid = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID.ToString();
        objcontent.SCreatedBy = ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID.ToString();
        objcontent.STitle     = Txttitle.Text;
        objcontent.SProcess   = DDLprocess.SelectedItem.Value;

        for (int i = 0; i < grdDesc.VisibleRowCount; i++)
        {
            dao.ContentSubNotesDAO objsubcontent = new dao.ContentSubNotesDAO();
            GridViewDataColumn     c             = (GridViewDataColumn)grdDesc.Columns[0]; // textbox column
            ASPxTextBox            txtbox        = (ASPxTextBox)grdDesc.FindRowCellTemplateControl(i, c, "txtsubtitle");
            GridViewDataColumn     c1            = (GridViewDataColumn)grdDesc.Columns[1]; // txtMemo column
            ASPxMemo txtMemo = (ASPxMemo)grdDesc.FindRowCellTemplateControl(i, c1, "txtDesc");

            if (txtbox.Text.Trim() != "" && txtMemo.Text.Trim() != "")
            {
                objsubcontent.SSubTitle       = txtbox.Text;
                objsubcontent.SSubDescription = txtMemo.Text;
                objsubcontent.SCompanyId1     = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID.ToString();
                objsubcontent.SCreatedBy      = ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_ID.ToString();
                objcontent.AddContent(objsubcontent);
            }
        }
        objcontent.SFileName = Fileupload.FileName;
        Result result = new Result();

        result = obj1.SaveNotesTransaction(objcontent);
        //obj1.addnotes(objcontent);
    }
Beispiel #2
0
    //public int addnotes(dao.ContentNotesDAO obj )
    //{
    //    conn = new SqlConnection(strsqlcon);
    //    int result = 0;
    //    try
    //    {

    //        conn.Open();
    //        comm = new SqlCommand("sp_Add_notes", conn);
    //        comm.CommandTimeout = 500;
    //        comm.CommandType = CommandType.StoredProcedure;
    //        comm.Connection = conn;
    //        comm.Parameters.AddWithValue("@sz_companyid", obj.IContentID.ToString());
    //        comm.Parameters.AddWithValue("@sz_title", obj.STitle.ToString());
    //        comm.Parameters.AddWithValue("@sz_process", obj.SProcess.ToString());
    //        comm.Parameters.AddWithValue("@sz_User_Id", obj.SCreatedBy.ToString());
    //        comm.Parameters.AddWithValue("@")
    //        result = comm.ExecuteNonQuery();
    //        if (result == 1)
    //        {
    //            return result;
    //        }
    //        else if (result == -1)
    //        {
    //            return result;
    //        }

    //    }

    //   catch (Exception ex)
    //    {
    //        _ex.Message.ToString();
    //    }

    //    finally
    //    {
    //        if (conn.State == ConnectionState.Open)
    //        {
    //            conn.Close();

    //        }
    //    }

    //    return result;
    //}

    public Result SaveNotesTransaction(dao.ContentNotesDAO obj)
    {
        Result objResult = new Result();

        conn = new SqlConnection(strsqlcon);
        conn.Open();
        comm = new SqlCommand();
        comm.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
        SqlTransaction transaction;

        transaction = conn.BeginTransaction();
        try
        {
            comm.CommandText = "sp_Add_notes";
            comm.CommandType = CommandType.StoredProcedure;
            comm.Connection  = conn;
            comm.Transaction = transaction;
            comm.Parameters.AddWithValue("@sz_title", obj.STitle.ToString());
            comm.Parameters.AddWithValue("@sz_process", obj.SProcess.ToString());
            comm.Parameters.AddWithValue("@sz_filename", obj.SFileName.ToString());
            comm.Parameters.AddWithValue("@sz_user_id", obj.SCreatedBy.ToString());
            comm.Parameters.AddWithValue("@sz_companyid", obj.Scompanyid.ToString());
            //comm.ExecuteNonQuery();

            SqlDataReader dr         = comm.ExecuteReader();
            string        IContentID = "";
            while (dr.Read())
            {
                IContentID = Convert.ToString(dr[0]);
            }
            dr.Close();
            ArrayList arr = obj.GetContain();
            if (IContentID != null)
            {
                if (arr != null)
                {
                    if (arr.Count > 0)
                    {
                        for (int i = 0; i < arr.Count; i++)
                        {
                            dao.ContentSubNotesDAO obj1 = (dao.ContentSubNotesDAO)arr[i];
                            comm = new SqlCommand();
                            comm.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CommandTimeOut"].ToString());
                            comm.CommandText    = "sp_add_detail_notes";
                            comm.CommandType    = CommandType.StoredProcedure;
                            comm.Connection     = conn;
                            comm.Transaction    = transaction;

                            comm.Parameters.AddWithValue("@id_mst_notes", IContentID);
                            comm.Parameters.AddWithValue("@sz_userid", obj1.SCreatedBy.ToString());
                            comm.Parameters.AddWithValue("@sz_sub_title", obj1.SSubTitle.ToString());
                            comm.Parameters.AddWithValue("@sz_description", obj1.SSubDescription.ToString());
                            comm.ExecuteNonQuery();
                        }
                    }
                }
            }
            transaction.Commit();
        }
        catch (Exception ex)

        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            transaction.Rollback();
        }
        finally
        {
            conn.Close();
        }
        return(objResult);
    }