Exemple #1
0
        public void CreateNewDocument(string formname, string formtext, object controlname)
        {
            foreach (DockContainerItem item in bar1.Items)
            {
                if (item.Name == formname)
                {
                    bar1.SelectedDockContainerItem = item;
                    return;
                }
            }
            // Create new DockContainerItem with the edit control and add it to the barDocuments
            DockContainerItem document = new DockContainerItem(formname, formtext);

            // Create control to host inside of new document
            document.Control = CreateForms.CreateNewDocumentControl(controlname.ToString());
            bar1.Items.Add(document);
            if (!bar1.Visible)
            {
                bar1.Visible = true;
            }
            bar1.SelectedDockTab = bar1.Items.IndexOf(document);
            bar1.RecalcLayout();
        }
Exemple #2
0
        public ActionResult Create(CreateForms Form)
        {
            if (ModelState.IsValid)
            {
                //    if (Path.GetExtension(postedFile.FileName).ToLower() != ".jpg"
                //&& Path.GetExtension(postedFile.FileName).ToLower() != ".png"
                //&& Path.GetExtension(postedFile.FileName).ToLower() != ".gif"
                //&& Path.GetExtension(postedFile.FileName).ToLower() != ".jpeg")
                //    {
                //        return false;
                //    }

                string connectionString = "Data Source=HRMSDEV;user id=PERSON;password=PERSON;Unicode=True;";
                string FORM_ID;
                using (OracleConnection connection = new OracleConnection(connectionString))
                {
                    string number = null;
                    number = "";
                    OracleCommand cmd1 = new OracleCommand();
                    cmd1.CommandType = CommandType.Text;
                    cmd1.CommandText = "select nvl(max(substr(FORM_ID,7,3)),0) from KMIINTRANET_MASTER_FORMS where substr(FORM_ID,1,6)='" + Convert.ToDateTime(System.DateTime.Now).ToString("yyyyMM") + "'";
                    cmd1.Connection  = connection;
                    connection.Open();
                    objDataReader = cmd1.ExecuteReader();
                    if (objDataReader.HasRows)
                    {
                        objDataReader.Read();
                        number = Convert.ToString(Convert.ToInt32(objDataReader[0]) + 1);
                        if (number.Length == 1)
                        {
                            number = "00" + number;
                        }
                        else if (number.Length == 2)
                        {
                            number = "0" + number;
                        }
                        else if (number.Length == 3)
                        {
                            number = number;
                        }
                    }
                    cmd1 = null;
                    connection.Close();
                    OracleCommand cmd2 = new OracleCommand();
                    FORM_ID = Convert.ToDateTime(System.DateTime.Now).ToString("yyyyMM") + number;
                    byte[] tempFile = new byte[Form.formFile.InputStream.Length];
                    Form.formFile.InputStream.Read(tempFile, 0, tempFile.Length);
                    cmd2.CommandText = "INSERT INTO KMIINTRANET_MASTER_FORMS(FORM_ID,GROUP_,FORM_NAME,FORM_FILE,CREATE_BY,CREATE_DATE) VALUES (:formid,:groupp,:formname,:formfile,'" + Session["USER"] + "',sysdate)";
                    cmd2.CommandType = CommandType.Text;
                    cmd2.Connection  = connection;
                    connection.Open();
                    cmd2.Parameters.Add(":formfile", OracleType.Blob).Value    = tempFile;
                    cmd2.Parameters.Add(":formname", OracleType.VarChar).Value = Form.formname.ToString();
                    cmd2.Parameters.Add(":groupp", OracleType.VarChar).Value   = Form.group.ToString();
                    cmd2.Parameters.Add(":formid", OracleType.VarChar).Value   = FORM_ID;

                    cmd2.ExecuteNonQuery();

                    cmd2 = null;
                    connection.Close();
                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }