Ejemplo n.º 1
0
        //public DataSet FillDataSetMentalStatus(int DocumentId, int version)
        //{
        //    DataSet DataSetMentalStatus = new DataSet();
        //    try
        //    {
        //        objCommonBase = new Streamline.DataService.CommonBase();
        //        DataSetMentalStatus = objCommonBase.FillDataSetMentalStatus(DocumentId, version);
        //        return DataSetMentalStatus;
        //    }
        //    catch (Exception ex)
        //    {
        //        return null;
        //    }
        //}


        //Code added by Priya on 8th Feb '08

        //public DataSet FillDataSetAssesmentInitial(int DocumentId, int version)
        //{
        //    DataSet DataSetAssesmentInitial = new DataSet();
        //    try
        //    {
        //        objCommonBase = new Streamline.DataService.CommonBase();
        //        DataSetAssesmentInitial = objCommonBase.FillDataSetInitial(DocumentId, version);
        //        return DataSetAssesmentInitial;
        //    }
        //    catch (Exception ex)
        //    {
        //        return null;
        //    }

        //}

        public DataSet RetreiveData(string spName, string[] tableNames, System.Collections.Hashtable args)
        {
            try
            {
                using (Streamline.DataService.CommonBase objCommonBase = new Streamline.DataService.CommonBase())
                {
                    DataSet datasetRetrieve = objCommonBase.RetrieveDataset(spName, tableNames, args);
                    if (datasetRetrieve.Tables.Count > 0)
                    {
                        if (datasetRetrieve.Tables[0].Rows.Count > 0)
                        {
                            string updateFile = System.Guid.NewGuid().ToString() + ".xml";
                            datasetRetrieve.WriteXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + updateFile, XmlWriteMode.WriteSchema);
                            datasetRetrieve.ExtendedProperties.Add("XMLFileName", updateFile);
                        }
                    }

                    return(datasetRetrieve);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates dataset passed
        /// </summary>
        /// <param name="datasetUpdate">dataset for update</param>
        /// <param name="objTemp">Object which contains values regarding the documentrow</param>
        /// <returns>true on successful update</returns>
        public bool UpdateData(DataSet datasetUpdate, ref object objTemp)
        {
            try
            {
                System.Collections.Hashtable hashTableTemp = (System.Collections.Hashtable)objTemp;
                datasetMain = datasetUpdate;
                datasetMain.Merge(getDocumentTable(objTemp));
                using (objCommonBase = new Streamline.DataService.CommonBase())
                {
                    DataSet dsUpdated  = objCommonBase.UpdateDocuments(datasetMain);
                    string  updateFile = System.Guid.NewGuid().ToString() + ".xml";
                    dsUpdated.WriteXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + updateFile, XmlWriteMode.WriteSchema);
                    //PanelControls.Attributes["DataFileAfterUpdate"] = updateFile;

                    // setting back the updated documentid and version id to the arguments passed by the parent class
                    if (dsUpdated.Tables.Count > 0)
                    {
                        if (dsUpdated.Tables[0].Columns.Contains("DocumentId"))
                        {
                            if (dsUpdated.Tables[0].Rows.Count > 0)
                            {
                                if (hashTableTemp.ContainsKey("DocumentId"))
                                {
                                    hashTableTemp["DocumentId"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]);
                                }
                                else
                                {
                                    hashTableTemp.Add("DocumentId", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]));
                                }

                                if (hashTableTemp.ContainsKey("Version"))
                                {
                                    hashTableTemp["Version"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]);
                                }
                                else
                                {
                                    hashTableTemp.Add("Version", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]));
                                }
                            }
                        }
                    }
                }


                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Created By Pramod Prakash on 11th Feb 2008
        /// This fucntion is a generic function that will retun dataset after executing procedure
        /// that is passed to it and this function will not create .Xml file.
        /// </summary>
        /// <param name="spName"></param>
        /// <param name="tableNames"></param>
        /// <returns></returns>
        public DataSet RetreiveDataWithoutXml(string spName, string[] tableNames, System.Collections.Hashtable args)
        {
            try
            {
                using (Streamline.DataService.CommonBase objCommonBase = new Streamline.DataService.CommonBase())
                {
                    DataSet datasetRetrieve = objCommonBase.RetrieveDataset(spName, tableNames, args);


                    return(datasetRetrieve);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
 private void FillDropDowns(System.Web.UI.WebControls.DropDownList dropDownTemp, string dataSource, string dataTextField, string dataValueField, string SelectCase, string SelectType)
 {
     try
     {
         objCommonBase = new Streamline.DataService.CommonBase();
         DataSet DataSetDropdown = new DataSet();
         DataSetDropdown = objCommonBase.FillDropDown(SelectType, SelectCase);
         if (DataSetDropdown.Tables.Count > 0)
         {
             if (DataSetDropdown.Tables[0].Rows.Count > 0)
             {
                 dropDownTemp.DataSource     = DataSetDropdown.Tables[0];
                 dropDownTemp.DataValueField = dataValueField;
                 dropDownTemp.DataTextField  = dataTextField;
                 dropDownTemp.DataBind();
             }
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates datarows pertaining to the controls in the panel and updates them
        /// </summary>
        /// <param name="PanelControls">Panel with contains the collection </param>
        /// <param name="objTemp">Object which contains values regarding the documentrow</param>
        /// <returns>true on successful update</returns>
        public bool UpdateData(System.Web.UI.WebControls.Panel PanelControls, ref object objTemp)
        {
            try
            {
                objCommonBase = new Streamline.DataService.CommonBase();
                System.Collections.Hashtable hashTableTemp = (System.Collections.Hashtable)objTemp;
                string dataFileTemp        = PanelControls.Attributes["DataFile"];
                string dataFileAfterUpdate = PanelControls.Attributes["DataFileAfterUpdate"];

                //This statement is used to get the collections of controls in the panel.
                //GetEnumerator is a forward only and light weight cursor.Hence it is more efficient than
                // For each control in Panel.
                System.Collections.IEnumerator eControls = PanelControls.Controls.GetEnumerator();
                datasetMain = new DataSet();


                if (!String.IsNullOrEmpty(dataFileAfterUpdate))
                {
                    datasetMain.ReadXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + dataFileAfterUpdate, XmlReadMode.ReadSchema);
                    datasetMain.AcceptChanges();
                }
                else
                {
                    datasetMain.ReadXmlSchema(PATH + dataFileTemp);
                }

                newRow = true;
                //if(hashTableTemp.ContainsKey("DocumentId"))
                //   AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);
                //if(hashTableTemp.ContainsKey("Version"))
                //   AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);

                while (eControls.MoveNext())
                {
                    object objCurrentControl = eControls.Current;
                    switch (objCurrentControl.GetType().ToString())
                    {
                    case "System.Web.UI.HtmlControls.HtmlInputHidden":
                    {
                        System.Web.UI.HtmlControls.HtmlInputHidden hdnTemp = (System.Web.UI.HtmlControls.HtmlInputHidden)objCurrentControl;
                        string primaryKey = hdnTemp.Attributes["PrimaryKey"];
                        if (!String.IsNullOrEmpty(primaryKey))
                        {
                            string fieldName = hdnTemp.Attributes["FieldName"];
                            string tableName = hdnTemp.Attributes["TableName"];
                            if (primaryKey == "True")
                            {
                                if (String.IsNullOrEmpty(hdnTemp.Value))
                                {
                                    if (hashTableTemp.ContainsKey(fieldName))
                                    {
                                        hdnTemp.Value = hashTableTemp[fieldName].ToString();
                                    }
                                }
                                else
                                {
                                    newRow = false;
                                }
                                AddDataRowValues(tableName, fieldName, hdnTemp.Value, primaryKey == "True" ? true : false);
                            }
                        }
                        break;
                    }

                    case "System.Web.UI.WebControls.TextBox":
                    {
                        System.Web.UI.WebControls.TextBox txtTemp = (System.Web.UI.WebControls.TextBox)objCurrentControl;
                        string fieldName = txtTemp.Attributes["FieldName"];
                        string tableName = txtTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, txtTemp.Text, false);
                        break;
                    }

                    case "System.Web.UI.WebControls.CheckBox":
                    {
                        System.Web.UI.WebControls.CheckBox chkTemp = (System.Web.UI.WebControls.CheckBox)objCurrentControl;
                        string fieldName = chkTemp.Attributes["FieldName"];
                        string tableName = chkTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, chkTemp.Checked == true ? "Y" : "N", false);
                        break;
                    }

                    case "System.Web.UI.WebControls.DropDownList":
                    {
                        System.Web.UI.WebControls.DropDownList ddlTemp = (System.Web.UI.WebControls.DropDownList)objCurrentControl;
                        string fieldName = ddlTemp.Attributes["FieldName"];
                        string tableName = ddlTemp.Attributes["TableName"];
                        AddDataRowValues(tableName, fieldName, ddlTemp.SelectedValue, false);
                        break;
                    }

                    case "System.Web.UI.WebControls.RadioButton":
                    {
                        System.Web.UI.WebControls.RadioButton rbTemp = (System.Web.UI.WebControls.RadioButton)objCurrentControl;
                        string fieldName = rbTemp.Attributes["FieldName"];
                        string tableName = rbTemp.Attributes["TableName"];
                        string value     = rbTemp.Attributes["Value"];
                        if (rbTemp.Checked == true)
                        {
                            AddDataRowValues(tableName, fieldName, value, false);
                        }
                        break;
                    }
                    }
                }

                //Merging the documents table to the maindataset
                datasetMain.Merge(getDocumentTable(objTemp));

                DataSet dsUpdated  = objCommonBase.UpdateDocuments(datasetMain);
                string  updateFile = System.Guid.NewGuid().ToString() + ".xml";
                dsUpdated.WriteXml(PATH + System.Web.HttpContext.Current.Session.SessionID + "\\" + updateFile, XmlWriteMode.WriteSchema);
                PanelControls.Attributes["DataFileAfterUpdate"] = updateFile;

                // setting back the updated documentid and version id to the arguments passed by the parent class
                if (dsUpdated.Tables.Count > 0)
                {
                    if (dsUpdated.Tables[0].Columns.Contains("DocumentId"))
                    {
                        if (dsUpdated.Tables[0].Rows.Count > 0)
                        {
                            if (hashTableTemp.ContainsKey("DocumentId"))
                            {
                                hashTableTemp["DocumentId"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]);
                            }
                            else
                            {
                                hashTableTemp.Add("DocumentId", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["DocumentId"]));
                            }

                            if (hashTableTemp.ContainsKey("Version"))
                            {
                                hashTableTemp["Version"] = Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]);
                            }
                            else
                            {
                                hashTableTemp.Add("Version", Convert.ToInt32(dsUpdated.Tables[0].Rows[0]["Version"]));
                            }
                        }
                    }
                }


                // SetControlValues(PanelControls, dsUpdated);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }